当前位置: 首页>>代码示例>>C++>>正文


C++ device_attach函数代码示例

本文整理汇总了C++中device_attach函数的典型用法代码示例。如果您正苦于以下问题:C++ device_attach函数的具体用法?C++ device_attach怎么用?C++ device_attach使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了device_attach函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: vtpci_probe_and_attach_child

static void
vtpci_probe_and_attach_child(struct vtpci_softc *sc)
{
	device_t dev, child;

	dev = sc->vtpci_dev;
	child = sc->vtpci_child_dev;

	if (child == NULL)
		return;

	if (device_get_state(child) != DS_NOTPRESENT)
		return;

	if (device_probe(child) != 0)
		return;

	vtpci_set_status(dev, VIRTIO_CONFIG_STATUS_DRIVER);
	if (device_attach(child) != 0) {
		vtpci_set_status(dev, VIRTIO_CONFIG_STATUS_FAILED);
		vtpci_reset(sc);
		vtpci_release_child_resources(sc);
		/* Reset status for future attempt. */
		vtpci_set_status(dev, VIRTIO_CONFIG_STATUS_ACK);
	} else {
		vtpci_set_status(dev, VIRTIO_CONFIG_STATUS_DRIVER_OK);
		VIRTIO_ATTACH_COMPLETED(child);
	}
}
开发者ID:2asoft,项目名称:freebsd,代码行数:29,代码来源:virtio_pci.c

示例2: rebind_store

static ssize_t rebind_store(struct device_driver *dev, const char *buf,
				 size_t count)
{
	int ret;
	int len;
	struct bus_id_priv *bid;

	/* buf length should be less that BUSID_SIZE */
	len = strnlen(buf, BUSID_SIZE);

	if (!(len < BUSID_SIZE))
		return -EINVAL;

	bid = get_busid_priv(buf);
	if (!bid)
		return -ENODEV;

	ret = device_attach(&bid->udev->dev);
	if (ret < 0) {
		dev_err(&bid->udev->dev, "rebind failed\n");
		return ret;
	}

	return count;
}
开发者ID:ReneNyffenegger,项目名称:linux,代码行数:25,代码来源:stub_main.c

示例3: bus_attach_device

/**
 *	bus_attach_device - add device to bus
 *	@dev:	device tried to attach to a driver
 *
 *	- Try to attach to driver.
 */
void bus_attach_device(struct device * dev)
{
	struct bus_type * bus = dev->bus;

	if (bus) {
		device_attach(dev);
		klist_add_tail(&dev->knode_bus, &bus->klist_devices);
	}
}
开发者ID:xf739645524,项目名称:kernel-rhel5,代码行数:15,代码来源:bus.c

示例4: umc_bus_rescan_helper

static int umc_bus_rescan_helper(struct device *dev, void *data)
{
	int ret = 0;

	if (!dev->driver)
		ret = device_attach(dev);

	return ret;
}
开发者ID:MiniBlu,项目名称:cm11_kernel_htc_msm8974a3ul,代码行数:9,代码来源:umc-bus.c

示例5: gameport_find_driver

static void gameport_find_driver(struct gameport *gameport)
{
    int error;

    error = device_attach(&gameport->dev);
    if (error < 0)
        printk(KERN_WARNING
            "gameport: device_attach() failed for %s (%s), error: %d\n",
            gameport->phys, gameport->name, error);
}
开发者ID:274914765,项目名称:C,代码行数:10,代码来源:gameport.c

示例6: serio_find_driver

static void serio_find_driver(struct serio *serio)
{
    int error;

    error = device_attach(&serio->dev);
    if (error < 0)
        dev_warn(&serio->dev,
                 "device_attach() failed for %s (%s), error: %d\n",
                 serio->phys, serio->name, error);
}
开发者ID:jbaldus,项目名称:Acer-A100-JellyBean-Custom-Kernel,代码行数:10,代码来源:serio.c

示例7: ide_replace_subdriver

static int ide_replace_subdriver(ide_drive_t *drive, const char *driver)
{
	struct device *dev = &drive->gendev;
	int ret = 1;

	down_write(&dev->bus->subsys.rwsem);
	device_release_driver(dev);
	/* FIXME: device can still be in use by previous driver */
	strlcpy(drive->driver_req, driver, sizeof(drive->driver_req));
	device_attach(dev);
	drive->driver_req[0] = 0;
	if (dev->driver == NULL)
		device_attach(dev);
	if (dev->driver && !strcmp(dev->driver->name, driver))
		ret = 0;
	up_write(&dev->bus->subsys.rwsem);

	return ret;
}
开发者ID:Pating,项目名称:linux.old,代码行数:19,代码来源:ide-proc.c

示例8: serio_find_driver

static void serio_find_driver(struct serio *serio)
{
	int error;

	error = device_attach(&serio->dev);
	if (error < 0)
		printk(KERN_WARNING
			"serio: device_attach() failed for %s (%s), error: %d\n",
			serio->phys, serio->name, error);
}
开发者ID:AdrianHuang,项目名称:uclinux-robutest,代码行数:10,代码来源:serio.c

示例9: gameport_find_driver

static void gameport_find_driver(struct gameport *gameport)
{
	int error;

	error = device_attach(&gameport->dev);
	if (error < 0)
		dev_warn(&gameport->dev,
			 "device_attach() failed for %s (%s), error: %d\n",
			 gameport->phys, gameport->name, error);
}
开发者ID:1111saeid,项目名称:jb_kernel_3.0.16_htc_golfu,代码行数:10,代码来源:gameport.c

示例10: bus_rescan_devices_helper

/* Helper for bus_rescan_devices's iter */
static int bus_rescan_devices_helper(struct device *dev, void *data)
{
	if (!dev->driver) {
		if (dev->parent)	/* Needed for USB */
			down(&dev->parent->sem);
		device_attach(dev);
		if (dev->parent)
			up(&dev->parent->sem);
	}
	return 0;
}
开发者ID:xf739645524,项目名称:kernel-rhel5,代码行数:12,代码来源:bus.c

示例11: bus_attach_device

/**
 * bus_attach_device - add device to bus
 * @dev: device tried to attach to a driver
 *
 * - Add device to bus's list of devices.
 * - Try to attach to driver.
 */
void bus_attach_device(struct device *dev)
{
	struct bus_type *bus = dev->bus;
	int ret = 0;

	if (bus) {
		if (bus->p->drivers_autoprobe)
			ret = device_attach(dev);
		WARN_ON(ret < 0);
		if (ret >= 0)
			klist_add_tail(&dev->knode_bus, &bus->p->klist_devices);
	}
}
开发者ID:johnny,项目名称:CobraDroidBeta,代码行数:20,代码来源:bus.c

示例12: umc_bus_post_reset_helper

static int umc_bus_post_reset_helper(struct device *dev, void *data)
{
	int ret = 0;

	if (dev->driver) {
		struct umc_dev *umc = to_umc_dev(dev);
		struct umc_driver *umc_drv = to_umc_driver(dev->driver);

		if (umc_drv->post_reset)
			ret = umc_drv->post_reset(umc);
	} else
		ret = device_attach(dev);

	return ret;
}
开发者ID:MiniBlu,项目名称:cm11_kernel_htc_msm8974a3ul,代码行数:15,代码来源:umc-bus.c

示例13: __mcb_bus_add_devices

static int __mcb_bus_add_devices(struct device *dev, void *data)
{
    struct mcb_device *mdev = to_mcb_device(dev);
    int retval;

    if (mdev->is_added)
        return 0;

    retval = device_attach(dev);
    if (retval < 0)
        dev_err(dev, "Error adding device (%d)\n", retval);

    mdev->is_added = true;

    return 0;
}
开发者ID:kunulee,项目名称:failsafe_heapo_source,代码行数:16,代码来源:mcb-core.c

示例14: bus_attach_device

/**
 *	bus_attach_device - add device to bus
 *	@dev:	device tried to attach to a driver
 *
 *	- Add device to bus's list of devices.
 *	- Try to attach to driver.
 */
int bus_attach_device(struct device * dev)
{
	struct bus_type *bus = dev->bus;
	int ret = 0;

	if (bus) {
		dev->is_registered = 1;
		ret = device_attach(dev);
		if (ret >= 0) {
			klist_add_tail(&dev->knode_bus, &bus->klist_devices);
			ret = 0;
		} else
			dev->is_registered = 0;
	}
	return ret;
}
开发者ID:B-Rich,项目名称:linux_drivers,代码行数:23,代码来源:bus.c

示例15: bus_add_device

/**
 *	bus_add_device - add device to bus
 *	@dev:	device being added
 *
 *	- Add the device to its bus's list of devices.
 *	- Try to attach to driver.
 *	- Create link to device's physical location.
 */
int bus_add_device(struct device * dev)
{
	struct bus_type * bus = get_bus(dev->bus);
	int error = 0;

	if (bus) {
		pr_debug("bus %s: add device %s\n", bus->name, dev->bus_id);
		device_attach(dev);
		klist_add_tail(&dev->knode_bus, &bus->klist_devices);
		error = device_add_attrs(bus, dev);
		if (!error) {
			sysfs_create_link(&bus->devices.kobj, &dev->kobj, dev->bus_id);
			sysfs_create_link(&dev->kobj, &dev->bus->subsys.kset.kobj, "bus");
		}
	}
	return error;
}
开发者ID:BackupTheBerlios,项目名称:tew632-brp-svn,代码行数:25,代码来源:bus.c


注:本文中的device_attach函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。