本文整理汇总了C++中bus_find_device函数的典型用法代码示例。如果您正苦于以下问题:C++ bus_find_device函数的具体用法?C++ bus_find_device怎么用?C++ bus_find_device使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bus_find_device函数的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: acpi_pnp_find_device
static int __init acpi_pnp_find_device(struct device *dev, acpi_handle * handle)
{
struct device *adev;
struct acpi_device *acpi;
adev = bus_find_device(&acpi_bus_type, NULL,
to_pnp_dev(dev), acpi_pnp_match);
if (!adev)
return -ENODEV;
acpi = to_acpi_device(adev);
*handle = acpi->handle;
put_device(adev);
return 0;
}
开发者ID:PennPanda,项目名称:linux-repo,代码行数:15,代码来源:core.c
示例2: bus_find_device
/**
* usb_find_interface - find usb_interface pointer for driver and device
* @drv: the driver whose current configuration is considered
* @minor: the minor number of the desired device
*
* This walks the bus device list and returns a pointer to the interface
* with the matching minor and driver. Note, this only works for devices
* that share the USB major number.
*
* Return: A pointer to the interface with the matching major and @minor.
*/
struct usb_interface *usb_find_interface(struct usb_driver *drv, int minor)
{
struct find_interface_arg argb;
struct device *dev;
argb.minor = minor;
argb.drv = &drv->drvwrap.driver;
dev = bus_find_device(&usb_bus_type, NULL, &argb, __find_interface);
/* Drop reference count from bus_find_device */
put_device(dev);
return dev ? to_usb_interface(dev) : NULL;
}
开发者ID:guribe94,项目名称:linux,代码行数:26,代码来源:usb.c
示例3: wifi_ctrlfunc_unregister_drv
void wifi_ctrlfunc_unregister_drv(void)
{
#if defined(BCMPCIE) && defined(CONFIG_WIFI_CONTROL_FUNC)
DHD_ERROR(("unregister wifi platform drivers\n"));
platform_driver_unregister(&wifi_platform_dev_driver);
#else
struct device *dev1, *dev2;
dev1 = bus_find_device(&platform_bus_type, NULL, WIFI_PLAT_NAME, wifi_platdev_match);
dev2 = bus_find_device(&platform_bus_type, NULL, WIFI_PLAT_NAME2, wifi_platdev_match);
if (!dts_enabled)
if (dev1 == NULL && dev2 == NULL)
return;
DHD_ERROR(("unregister wifi platform drivers\n"));
if (dev1)
platform_driver_unregister(&wifi_platform_dev_driver);
if (dev2)
platform_driver_unregister(&wifi_platform_dev_driver_legacy);
if (dts_enabled) {
wifi_adapter_info_t *adapter;
adapter = &dhd_wifi_platdata->adapters[0];
if (is_power_on) {
wifi_platform_set_power(adapter, FALSE, WIFI_TURNOFF_DELAY);
wifi_platform_bus_enumerate(adapter, FALSE);
}
}
#endif
kfree(dhd_wifi_platdata->adapters);
dhd_wifi_platdata->adapters = NULL;
dhd_wifi_platdata->num_adapters = 0;
kfree(dhd_wifi_platdata);
dhd_wifi_platdata = NULL;
}
开发者ID:AOSPERIA,项目名称:android_kernel_sony,代码行数:36,代码来源:dhd_linux_platdev.c
示例4: ibmebus_remove_devices_by_id
static void ibmebus_remove_devices_by_id(struct of_device_id *idt)
{
struct device *dev;
while (strlen(idt->name) > 0) {
while ((dev = bus_find_device(&ibmebus_bus_type, NULL,
(void*)idt->name,
ibmebus_match_helper))) {
ibmebus_unregister_device(dev);
}
idt++;
}
return;
}
开发者ID:420GrayFox,项目名称:dsl-n55u-bender,代码行数:16,代码来源:ibmebus.c
示例5: find_i2c_adapter_num
static int __init find_i2c_adapter_num(enum i2c_adapter_type type)
{
struct device *dev = NULL;
struct i2c_adapter *adapter;
const char *name = i2c_adapter_names[type];
/* find the adapter by name */
dev = bus_find_device(&i2c_bus_type, NULL, (void *)name,
__find_i2c_adap);
if (!dev) {
pr_err("%s: i2c adapter %s not found on system.\n", __func__,
name);
return -ENODEV;
}
adapter = to_i2c_adapter(dev);
return adapter->nr;
}
开发者ID:03199618,项目名称:linux,代码行数:16,代码来源:chromeos_laptop.c
示例6: cpsw_phy_sel
void cpsw_phy_sel(struct device *dev, phy_interface_t phy_mode, int slave)
{
struct device_node *node;
struct cpsw_phy_sel_priv *priv;
node = of_get_child_by_name(dev->of_node, "cpsw-phy-sel");
if (!node) {
dev_err(dev, "Phy mode driver DT not found\n");
return;
}
dev = bus_find_device(&platform_bus_type, NULL, node, match);
priv = dev_get_drvdata(dev);
priv->cpsw_phy_sel(priv, phy_mode, slave);
}
开发者ID:acton393,项目名称:linux,代码行数:16,代码来源:cpsw-phy-sel.c
示例7: bus_find_device
/* must call put_device() when done with returned i2c_adapter device */
struct i2c_adapter *of_find_i2c_adapter_by_node(struct device_node *node)
{
struct device *dev;
struct i2c_adapter *adapter;
dev = bus_find_device(&i2c_bus_type, NULL, node,
of_dev_or_parent_node_match);
if (!dev)
return NULL;
adapter = i2c_verify_adapter(dev);
if (!adapter)
put_device(dev);
return adapter;
}
开发者ID:Anjali05,项目名称:linux,代码行数:17,代码来源:i2c-core-of.c
示例8: driver_unbind
static ssize_t driver_unbind(struct device_driver *drv,
const char *buf, size_t count)
{
struct bus_type *bus = get_bus(drv->bus);
struct device *dev;
int err = -ENODEV;
dev = bus_find_device(bus, NULL, (void *)buf, driver_helper);
if (dev && dev->driver == drv) {
device_release_driver(dev);
err = count;
}
put_device(dev);
put_bus(bus);
return err;
}
开发者ID:BackupTheBerlios,项目名称:tew632-brp-svn,代码行数:16,代码来源:bus.c
示例9: bus_find_device
struct phy_device *phy_attach(struct net_device *dev,
const char *phy_id, u32 flags)
{
struct bus_type *bus = &mdio_bus_type;
struct phy_device *phydev;
struct device *d;
/* Search the list of PHY devices on the mdio bus for the
* PHY with the requested name */
d = bus_find_device(bus, NULL, (void *)phy_id, phy_compare_id);
if (d) {
phydev = to_phy_device(d);
} else {
printk(KERN_ERR "%s not found\n", phy_id);
return ERR_PTR(-ENODEV);
}
/* Assume that if there is no driver, that it doesn't
* exist, and we should use the genphy driver. */
if (NULL == d->driver) {
int err;
down_write(&d->bus->subsys.rwsem);
d->driver = &genphy_driver.driver;
err = d->driver->probe(d);
if (err < 0)
return ERR_PTR(err);
device_bind_driver(d);
up_write(&d->bus->subsys.rwsem);
}
if (phydev->attached_dev) {
printk(KERN_ERR "%s: %s already attached\n",
dev->name, phy_id);
return ERR_PTR(-EBUSY);
}
phydev->attached_dev = dev;
phydev->dev_flags = flags;
return phydev;
}
开发者ID:FatSunHYS,项目名称:OSCourseDesign,代码行数:46,代码来源:phy_device.c
示例10: driver_bind
/*
* Manually attach a device to a driver.
* Note: the driver must want to bind to the device,
* it is not possible to override the driver's id table.
*/
static ssize_t driver_bind(struct device_driver *drv,
const char *buf, size_t count)
{
struct bus_type *bus = get_bus(drv->bus);
struct device *dev;
int err = -ENODEV;
dev = bus_find_device(bus, NULL, (void *)buf, driver_helper);
if (dev && dev->driver == NULL) {
down(&dev->sem);
err = driver_probe_device(drv, dev);
up(&dev->sem);
}
put_device(dev);
put_bus(bus);
return err;
}
开发者ID:BackupTheBerlios,项目名称:tew632-brp-svn,代码行数:22,代码来源:bus.c
示例11: vc4_match_add_drivers
static void vc4_match_add_drivers(struct device *dev,
struct component_match **match,
struct platform_driver *const *drivers,
int count)
{
int i;
for (i = 0; i < count; i++) {
struct device_driver *drv = &drivers[i]->driver;
struct device *p = NULL, *d;
while ((d = bus_find_device(&platform_bus_type, p, drv,
(void *)platform_bus_type.match))) {
put_device(p);
component_match_add(dev, match, compare_dev, d);
p = d;
}
put_device(p);
}
}
开发者ID:lumag,项目名称:linux,代码行数:20,代码来源:vc4_drv.c
示例12: driver_unbind
static ssize_t driver_unbind(struct device_driver *drv,
const char *buf, size_t count)
{
struct bus_type *bus = bus_get(drv->bus);
struct device *dev;
int err = -ENODEV;
dev = bus_find_device(bus, NULL, (void *)buf, driver_helper);
if (dev && dev->driver == drv) {
if (dev->parent) /* Needed for USB */
down(&dev->parent->sem);
device_release_driver(dev);
if (dev->parent)
up(&dev->parent->sem);
err = count;
}
put_device(dev);
bus_put(bus);
return err;
}
开发者ID:PennPanda,项目名称:linux-repo,代码行数:20,代码来源:bus.c
示例13: match
/* ref count of the found device is incremented. ref count
* of from-device is decremented. */
struct omap_dss_device *omap_dss_get_next_device(struct omap_dss_device *from)
{
struct device *dev;
struct device *dev_start = NULL;
struct omap_dss_device *dssdev = NULL;
int match(struct device *dev, void *data)
{
return 1;
}
if (from)
dev_start = &from->dev;
dev = bus_find_device(dss_get_bus(), dev_start, NULL, match);
if (dev)
dssdev = to_dss_device(dev);
if (from)
put_device(&from->dev);
return dssdev;
}
开发者ID:b7acc,项目名称:kernel_omap_bowser-common,代码行数:23,代码来源:display.c
示例14: dhd_wifi_platform_register_drv
int dhd_wifi_platform_register_drv(void)
{
int err = 0;
#ifndef CUSTOMER_HW
struct device *dev;
/* register Broadcom wifi platform data driver if multi-chip is enabled,
* otherwise use Android style wifi platform data (aka wifi control function)
* if it exists
*
* to support multi-chip DHD, Broadcom wifi platform data device must
* be added in kernel early boot (e.g. board config file).
*/
if (cfg_multichip) {
dev = bus_find_device(&platform_bus_type, NULL, WIFI_PLAT_EXT, wifi_platdev_match);
if (dev == NULL) {
DHD_ERROR(("bcmdhd wifi platform data device not found!!\n"));
return -ENXIO;
}
err = platform_driver_register(&dhd_wifi_platform_dev_driver);
} else
#endif
{
err = wifi_ctrlfunc_register_drv();
/* no wifi ctrl func either, load bus directly and ignore this error */
if (err) {
if (err == -ENXIO) {
/* wifi ctrl function does not exist */
err = dhd_wifi_platform_load();
} else {
/* unregister driver due to initialization failure */
wifi_ctrlfunc_unregister_drv();
}
}
}
return err;
}
开发者ID:akuster,项目名称:linux-meson,代码行数:39,代码来源:dhd_linux_platdev.c
示例15: bus_find_device
static struct i2c_client *i2c_find_client_by_name(char *name)
{
struct device *dev = bus_find_device(&i2c_bus_type, NULL,
name, match_name);
return dev ? to_i2c_client(dev) : NULL;
}
开发者ID:sky8336,项目名称:mn201307,代码行数:6,代码来源:platform_mt9m114.c
示例16: wifi_ctrlfunc_register_drv
static int wifi_ctrlfunc_register_drv(void)
{
int err = 0;
struct device *dev1, *dev2 = NULL;
wifi_adapter_info_t *adapter;
#ifdef CONFIG_ACPI
dev1 = bus_find_device(&platform_bus_type, NULL, bcm_acpi_id, wifi_acpi_match);
if (!dev1)
#endif /* CONFIG_ACPI */
dev1 = bus_find_device(&platform_bus_type, NULL, WIFI_PLAT_NAME, wifi_platdev_match);
dev2 = bus_find_device(&platform_bus_type, NULL, WIFI_PLAT_NAME2, wifi_platdev_match);
if (!dts_enabled) {
if (dev1 == NULL && dev2 == NULL) {
DHD_ERROR(("no wifi platform data, skip\n"));
return -ENXIO;
}
}
/* multi-chip support not enabled, build one adapter information for
* DHD (either SDIO, USB or PCIe)
*/
adapter = kzalloc(sizeof(wifi_adapter_info_t), GFP_KERNEL);
adapter->name = "DHD generic adapter";
adapter->bus_type = -1;
adapter->bus_num = -1;
adapter->slot_num = -1;
adapter->irq_num = -1;
is_power_on = FALSE;
wifi_plat_dev_probe_ret = 0;
dhd_wifi_platdata = kzalloc(sizeof(bcmdhd_wifi_platdata_t), GFP_KERNEL);
dhd_wifi_platdata->num_adapters = 1;
dhd_wifi_platdata->adapters = adapter;
mutex_init(&dhd_wifi_platdata->load_lock);
if (dev1) {
err = platform_driver_register(&wifi_platform_dev_driver);
if (err) {
DHD_ERROR(("%s: failed to register wifi ctrl func driver\n",
__FUNCTION__));
return err;
}
}
if (dev2) {
err = platform_driver_register(&wifi_platform_dev_driver_legacy);
if (err) {
DHD_ERROR(("%s: failed to register wifi ctrl func legacy driver\n",
__FUNCTION__));
return err;
}
}
if (dts_enabled) {
struct resource *resource;
adapter->wifi_plat_data = (void *)&dhd_wlan_control;
resource = &dhd_wlan_resources;
adapter->irq_num = resource->start;
adapter->intr_flags = resource->flags & IRQF_TRIGGER_MASK;
wifi_plat_dev_probe_ret = dhd_wifi_platform_load();
}
/* return probe function's return value if registeration succeeded */
return wifi_plat_dev_probe_ret;
}
开发者ID:TeamElevate,项目名称:edison,代码行数:65,代码来源:dhd_linux_platdev.c
注:本文中的bus_find_device函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论