本文整理汇总了C++中device_find_child函数的典型用法代码示例。如果您正苦于以下问题:C++ device_find_child函数的具体用法?C++ device_find_child怎么用?C++ device_find_child使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了device_find_child函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: mdio_identify
static void
mdio_identify(driver_t *driver, device_t parent)
{
if (device_find_child(parent, mdio_driver.name, -1) == NULL)
BUS_ADD_CHILD(parent, 0, mdio_driver.name, -1);
}
开发者ID:2asoft,项目名称:freebsd,代码行数:7,代码来源:mdio.c
示例2: hotplug_devices
/*
* hotplug_device tries to find changes in the device page.
*/
static void hotplug_devices(struct work_struct *dummy)
{
unsigned int i;
struct kvm_device_desc *d;
struct device *dev;
for (i = 0; i < PAGE_SIZE; i += desc_size(d)) {
d = kvm_devices + i;
/* end of list */
if (d->type == 0)
break;
/* device already exists */
dev = device_find_child(kvm_root, d, match_desc);
if (dev) {
/* XXX check for hotplug remove */
put_device(dev);
continue;
}
/* new device */
printk(KERN_INFO "Adding new virtio device %p\n", d);
add_kvm_device(d, i);
}
}
开发者ID:AllenDou,项目名称:linux,代码行数:29,代码来源:kvm_virtio.c
示例3: chromebook_i2c_identify
static void
chromebook_i2c_identify(driver_t *driver, device_t bus)
{
device_t controller;
device_t child;
int i;
/*
* A stopgap approach to preserve the status quo.
* A more intelligent approach is required to correctly
* identify a machine model and hardware available on it.
* For instance, DMI could be used.
* See http://lxr.free-electrons.com/source/drivers/platform/chrome/chromeos_laptop.c
*/
controller = device_get_parent(bus);
if (strcmp(device_get_name(controller), "ig4iic_pci") != 0)
return;
for (i = 0; i < nitems(slaves); i++) {
if (device_find_child(bus, slaves[i].name, -1) != NULL)
continue;
if (slaves[i].pci_id != pci_get_devid(controller))
continue;
child = BUS_ADD_CHILD(bus, 0, slaves[i].name, -1);
if (child != NULL)
iicbus_set_addr(child, slaves[i].addr);
}
}
开发者ID:2trill2spill,项目名称:freebsd,代码行数:28,代码来源:chromebook_platform.c
示例4: iic_identify
static void
iic_identify(driver_t *driver, device_t parent)
{
if (device_find_child(parent, "iic", -1) == NULL)
BUS_ADD_CHILD(parent, 0, "iic", -1);
}
开发者ID:cyrilmagsuci,项目名称:freebsd,代码行数:7,代码来源:iic.c
示例5: ichwd_identify
/*
* Look for an ICH LPC interface bridge. If one is found, register an
* ichwd device. There can be only one.
*/
static void
ichwd_identify(driver_t *driver, device_t parent)
{
struct ichwd_device *id_p;
device_t ich = NULL;
device_t dev;
uint32_t rcba;
int rc;
ich = ichwd_find_ich_lpc_bridge(&id_p);
if (ich == NULL)
return;
/* good, add child to bus */
if ((dev = device_find_child(parent, driver->name, 0)) == NULL)
dev = BUS_ADD_CHILD(parent, 0, driver->name, 0);
if (dev == NULL)
return;
device_set_desc_copy(dev, id_p->desc);
if (id_p->version >= 6) {
/* get RCBA (root complex base address) */
rcba = pci_read_config(ich, ICH_RCBA, 4);
rc = bus_set_resource(ich, SYS_RES_MEMORY, 0,
(rcba & 0xffffc000) + ICH_GCS_OFFSET, ICH_GCS_SIZE);
if (rc)
ichwd_verbose_printf(dev,
"Can not set memory resource for RCBA\n");
}
}
开发者ID:JabirTech,项目名称:Source,代码行数:36,代码来源:ichwd.c
示例6: disable_dss
static void disable_dss(void)
{
struct device *dev;
struct platform_device *plat_dev;
struct device_driver *drv;
struct platform_driver *plat_drv;
pm_message_t pt;
dev = device_find_child(&platform_bus, "omapdss", find_my_dev);
if (!dev)
{
printk("Could not find omapdss device\n");
return;
}
drv = dev->driver;
if (!drv)
{
printk("Could not find omapdss driver\n");
return;
}
plat_drv = to_platform_driver(drv);
plat_dev = to_platform_device(dev);
if (!plat_drv->suspend)
{
printk("Could not find suspend in omapdss driver\n");
return;
}
pt.event = 0;
plat_drv->suspend(plat_dev, pt);
}
开发者ID:czechop,项目名称:2ndboot,代码行数:32,代码来源:hboot.c
示例7: dfs_identify
static void
dfs_identify(driver_t *driver, device_t parent)
{
uint16_t vers;
vers = mfpvr() >> 16;
/* Check for an MPC 7447A or 7448 CPU */
switch (vers) {
case MPC7447A:
case MPC7448:
break;
default:
return;
}
/* Make sure we're not being doubly invoked. */
if (device_find_child(parent, "dfs", -1) != NULL)
return;
/*
* We attach a child for every CPU since settings need to
* be performed on every CPU in the SMP case.
*/
if (BUS_ADD_CHILD(parent, 10, "dfs", -1) == NULL)
device_printf(parent, "add dfs child failed\n");
}
开发者ID:edgar-pek,项目名称:PerspicuOS,代码行数:26,代码来源:dfs.c
示例8: acpi_perf_identify
static void
acpi_perf_identify(driver_t *driver, device_t parent)
{
ACPI_HANDLE handle;
device_t dev;
/* Make sure we're not being doubly invoked. */
if (device_find_child(parent, "acpi_perf", -1) != NULL)
return;
/* Get the handle for the Processor object and check for perf states. */
handle = acpi_get_handle(parent);
if (handle == NULL)
return;
if (ACPI_FAILURE(AcpiEvaluateObject(handle, "_PSS", NULL, NULL)))
return;
/*
* Add a child to every CPU that has the right methods. In future
* versions of the ACPI spec, CPUs can have different settings.
* We probe this child now so that other devices that depend
* on it (i.e., for info about supported states) will see it.
*/
if ((dev = BUS_ADD_CHILD(parent, 0, "acpi_perf", -1)) != NULL)
device_probe_and_attach(dev);
else
device_printf(parent, "add acpi_perf child failed\n");
}
开发者ID:MattDooner,项目名称:freebsd-west,代码行数:28,代码来源:acpi_perf.c
示例9: uart_suspend_port
int uart_suspend_port(struct uart_driver *drv, struct uart_port *uport)
{
struct uart_state *state = drv->state + uport->line;
struct tty_port *port = &state->port;
struct device *tty_dev;
struct uart_match match = {uport, drv};
mutex_lock(&port->mutex);
tty_dev = device_find_child(uport->dev, &match, serial_match_port);
if (device_may_wakeup(tty_dev)) {
if (!enable_irq_wake(uport->irq))
uport->irq_wake = 1;
put_device(tty_dev);
mutex_unlock(&port->mutex);
return 0;
}
if (console_suspend_enabled || !uart_console(uport))
uport->suspended = 1;
if (port->flags & ASYNC_INITIALIZED) {
const struct uart_ops *ops = uport->ops;
int tries;
if (console_suspend_enabled || !uart_console(uport)) {
set_bit(ASYNCB_SUSPENDED, &port->flags);
clear_bit(ASYNCB_INITIALIZED, &port->flags);
spin_lock_irq(&uport->lock);
ops->stop_tx(uport);
ops->set_mctrl(uport, 0);
ops->stop_rx(uport);
spin_unlock_irq(&uport->lock);
}
for (tries = 3; !ops->tx_empty(uport) && tries; tries--)
msleep(10);
if (!tries)
printk(KERN_ERR "%s%s%s%d: Unable to drain "
"transmitter\n",
uport->dev ? dev_name(uport->dev) : "",
uport->dev ? ": " : "",
drv->dev_name,
drv->tty_driver->name_base + uport->line);
if (console_suspend_enabled || !uart_console(uport))
ops->shutdown(uport);
}
if (console_suspend_enabled && uart_console(uport))
console_stop(uport->cons);
if (console_suspend_enabled || !uart_console(uport))
uart_change_pm(state, 3);
mutex_unlock(&port->mutex);
return 0;
}
开发者ID:JonnyXDA,项目名称:DarkSense-M7,代码行数:59,代码来源:serial_core.c
示例10: spigen_identify
static void
spigen_identify(driver_t *driver, device_t parent)
{
if (device_find_child(parent, "spigen", -1) != NULL)
return;
if (BUS_ADD_CHILD(parent, 0, "spigen", -1) == NULL)
device_printf(parent, "add child failed\n");
}
开发者ID:bsd-hacker,项目名称:freebsd,代码行数:8,代码来源:spigen.c
示例11: canbus_identify
static void
canbus_identify(driver_t *drv, device_t parent)
{
if (device_find_child(parent, "canbus", 0) == NULL) {
if (BUS_ADD_CHILD(parent, 33, "canbus", 0) == NULL)
device_printf(parent, "canbus cannot attach\n");
}
}
开发者ID:JabirTech,项目名称:Source,代码行数:8,代码来源:canbus.c
示例12: ipmi_smbus_identify
static void
ipmi_smbus_identify(driver_t *driver, device_t parent)
{
struct ipmi_get_info info;
if (ipmi_smbios_identify(&info) && info.iface_type == SSIF_MODE &&
device_find_child(parent, "ipmi", -1) == NULL)
BUS_ADD_CHILD(parent, 0, "ipmi", -1);
}
开发者ID:FreeBSDFoundation,项目名称:freebsd,代码行数:9,代码来源:ipmi_smbus.c
示例13: tegra124_coretemp_identify
static void
tegra124_coretemp_identify(driver_t *driver, device_t parent)
{
if (device_find_child(parent, "tegra124_coretemp", -1) != NULL)
return;
if (BUS_ADD_CHILD(parent, 0, "tegra124_coretemp", -1) == NULL)
device_printf(parent, "add child failed\n");
}
开发者ID:2asoft,项目名称:freebsd,代码行数:9,代码来源:tegra124_coretemp.c
示例14: rdrand_identify
static void
rdrand_identify(driver_t *drv, device_t parent)
{
/* NB: order 10 is so we get attached after h/w devices */
if (device_find_child(parent, "rdrand", -1) == NULL &&
BUS_ADD_CHILD(parent, parent, 10, "rdrand", -1) == 0)
panic("rdrand: could not attach");
}
开发者ID:AhmadTux,项目名称:DragonFlyBSD,代码行数:9,代码来源:rdrand.c
示例15: km_identify
static void
km_identify(driver_t *driver, struct device *parent)
{
if (km_probe(parent) == ENXIO)
return;
if (device_find_child(parent, driver->name, -1) != NULL)
return;
device_add_child(parent, driver->name, -1);
}
开发者ID:AhmadTux,项目名称:DragonFlyBSD,代码行数:9,代码来源:km.c
示例16: ps3pic_identify
static void
ps3pic_identify(driver_t *driver, device_t parent)
{
if (strcmp(installed_platform(), "ps3") != 0)
return;
if (device_find_child(parent, "ps3pic", -1) == NULL)
BUS_ADD_CHILD(parent, 0, "ps3pic", 0);
}
开发者ID:edgar-pek,项目名称:PerspicuOS,代码行数:9,代码来源:ps3pic.c
示例17: fdtbus_identify
static void
fdtbus_identify(driver_t *driver, device_t parent)
{
debugf("%s(driver=%p, parent=%p)\n", __func__, driver, parent);
if (device_find_child(parent, "fdtbus", -1) == NULL)
BUS_ADD_CHILD(parent, 0, "fdtbus", -1);
}
开发者ID:ChaosJohn,项目名称:freebsd,代码行数:9,代码来源:fdtbus.c
示例18: vpo_identify
static void
vpo_identify(driver_t *driver, device_t parent)
{
device_t dev;
dev = device_find_child(parent, "vpo", -1);
if (!dev)
BUS_ADD_CHILD(parent, 0, "vpo", -1);
}
开发者ID:dcui,项目名称:FreeBSD-9.3_kernel,代码行数:10,代码来源:vpo.c
示例19: bcm2835_cpufreq_identify
static void
bcm2835_cpufreq_identify(driver_t *driver, device_t parent)
{
DPRINTF("driver=%p, parent=%p\n", driver, parent);
if (device_find_child(parent, "bcm2835_cpufreq", -1) != NULL)
return;
if (BUS_ADD_CHILD(parent, 0, "bcm2835_cpufreq", -1) == NULL)
device_printf(parent, "add child failed\n");
}
开发者ID:fengsi,项目名称:freebsd,代码行数:10,代码来源:bcm2835_cpufreq.c
示例20: mic_scan_devices
static void mic_scan_devices(struct mic_driver *mdrv, bool remove)
{
s8 type;
unsigned int i;
struct mic_device_desc __iomem *d;
struct mic_device_ctrl __iomem *dc;
struct device *dev;
int ret;
for (i = sizeof(struct mic_bootparam); i < MIC_DP_SIZE;
i += mic_total_desc_size(d)) {
d = mdrv->dp + i;
dc = (void __iomem *)d + mic_aligned_desc_size(d);
/*
* This read barrier is paired with the corresponding write
* barrier on the host which is inserted before adding or
* removing a virtio device descriptor, by updating the type.
*/
rmb();
type = ioread8(&d->type);
/* end of list */
if (type == 0)
break;
if (type == -1)
continue;
/* device already exists */
dev = device_find_child(mdrv->dev, (void __force *)d,
mic_match_desc);
if (dev) {
if (remove)
iowrite8(MIC_VIRTIO_PARAM_DEV_REMOVE,
&dc->config_change);
put_device(dev);
mic_handle_config_change(d, i, mdrv);
ret = mic_remove_device(d, i, mdrv);
if (!ret && !remove)
iowrite8(-1, &d->type);
if (remove) {
iowrite8(0, &dc->config_change);
iowrite8(0, &dc->guest_ack);
}
continue;
}
/* new device */
dev_dbg(mdrv->dev, "%s %d Adding new virtio device %p\n",
__func__, __LINE__, d);
if (!remove)
mic_add_device(d, i, mdrv);
}
}
开发者ID:7799,项目名称:linux,代码行数:54,代码来源:mic_virtio.c
注:本文中的device_find_child函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论