• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ device_attach函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: bus_probe_device

/**
 * bus_probe_device - probe drivers for a new device
 * @dev: device to probe
 *
 * - Automatically probe for a driver if the bus allows it.
 */
void bus_probe_device(struct device *dev)
{
    struct bus_type *bus = dev->bus;
    struct subsys_interface *sif;
    int ret;

    if (!bus)
        return;

    if (bus->p->drivers_autoprobe) {
        ret = device_attach(dev);
        WARN_ON(ret < 0);
    }

    mutex_lock(&bus->p->mutex);
    list_for_each_entry(sif, &bus->p->interfaces, node)
    if (sif->add_dev)
        sif->add_dev(dev, sif);
    mutex_unlock(&bus->p->mutex);
}
开发者ID:electrikjesus,项目名称:kernel_intel-uefi,代码行数:26,代码来源:bus.c


示例17: cvm_oct_common_init

/**
 * Per network device initialization
 *
 * @param dev    Device to initialize
 * @return Zero on success
 */
int cvm_oct_common_init(struct ifnet *ifp)
{
	char mac[6] = {
		octeon_bootinfo->mac_addr_base[0],
		octeon_bootinfo->mac_addr_base[1],
		octeon_bootinfo->mac_addr_base[2],
		octeon_bootinfo->mac_addr_base[3],
		octeon_bootinfo->mac_addr_base[4],
		octeon_bootinfo->mac_addr_base[5] };
	cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc;

	mac[5] += cvm_oct_mac_addr_offset++;

	ifp->if_mtu = ETHERMTU;

	cvm_oct_mdio_setup_device(ifp);

	cvm_oct_common_set_mac_address(ifp, mac);
	cvm_oct_common_change_mtu(ifp, ifp->if_mtu);

	/*
	 * Do any last-minute board-specific initialization.
	 */
	switch (cvmx_sysinfo_get()->board_type) {
#if defined(OCTEON_VENDOR_LANNER)
	case CVMX_BOARD_TYPE_CUST_LANNER_MR320:
	case CVMX_BOARD_TYPE_CUST_LANNER_MR321X:
		if (priv->phy_id == 16)
			cvm_oct_mv88e61xx_setup_device(ifp);
		break;
#endif
	default:
		break;
	}

	device_attach(priv->dev);

	return 0;
}
开发者ID:dcui,项目名称:FreeBSD-9.3_kernel,代码行数:45,代码来源:ethernet-common.c


示例18: check_plugged_state_change

/**
 * check_plugged_state_change - Check change in an MC object's plugged state
 *
 * @mc_dev: pointer to the fsl-mc device for a given MC object
 * @obj_desc: pointer to the MC object's descriptor in the MC
 *
 * If the plugged state has changed from unplugged to plugged, the fsl-mc
 * device is bound to the corresponding device driver.
 * If the plugged state has changed from plugged to unplugged, the fsl-mc
 * device is unbound from the corresponding device driver.
 */
static void check_plugged_state_change(struct fsl_mc_device *mc_dev,
				       struct dprc_obj_desc *obj_desc)
{
	int error;
	u32 plugged_flag_at_mc =
			obj_desc->state & DPRC_OBJ_STATE_PLUGGED;

	if (plugged_flag_at_mc !=
	    (mc_dev->obj_desc.state & DPRC_OBJ_STATE_PLUGGED)) {
		if (plugged_flag_at_mc) {
			mc_dev->obj_desc.state |= DPRC_OBJ_STATE_PLUGGED;
			error = device_attach(&mc_dev->dev);
			if (error < 0) {
				dev_err(&mc_dev->dev,
					"device_attach() failed: %d\n",
					error);
			}
		} else {
			mc_dev->obj_desc.state &= ~DPRC_OBJ_STATE_PLUGGED;
			device_release_driver(&mc_dev->dev);
		}
	}
}
开发者ID:acton393,项目名称:linux,代码行数:34,代码来源:dprc-driver.c


示例19: bus_probe_device

void bus_probe_device(struct device *dev)

#endif									
{


	struct bus_type *bus = dev->bus;
	int ret;
	


	if (bus && bus->p->drivers_autoprobe) {
		ret = device_attach(dev);
		WARN_ON(ret < 0);
	}

#ifdef CONFIG_MACH_LGE_MMC_REFRESH		
	if(ret == 0xbcbc)
		return ret;
	else return 0;
#endif									

	
}
开发者ID:c-ong,项目名称:LGP925_Kernel,代码行数:24,代码来源:bus.c


示例20: acpi_processor_add

static int acpi_processor_add(struct acpi_device *device,
					const struct acpi_device_id *id)
{
	struct acpi_processor *pr;
	struct device *dev;
	int result = 0;

	pr = kzalloc(sizeof(struct acpi_processor), GFP_KERNEL);
	if (!pr)
		return -ENOMEM;

	if (!zalloc_cpumask_var(&pr->throttling.shared_cpu_map, GFP_KERNEL)) {
		result = -ENOMEM;
		goto err_free_pr;
	}

	pr->handle = device->handle;
	strcpy(acpi_device_name(device), ACPI_PROCESSOR_DEVICE_NAME);
	strcpy(acpi_device_class(device), ACPI_PROCESSOR_CLASS);
	device->driver_data = pr;

	result = acpi_processor_get_info(device);
	if (result) /* Processor is not physically present or unavailable */
		return 0;

#ifdef CONFIG_SMP
	if (pr->id >= setup_max_cpus && pr->id != 0)
		return 0;
#endif

	BUG_ON(pr->id >= nr_cpu_ids);

	/*
	 * Buggy BIOS check.
	 * ACPI id of processors can be reported wrongly by the BIOS.
	 * Don't trust it blindly
	 */
	if (per_cpu(processor_device_array, pr->id) != NULL &&
	    per_cpu(processor_device_array, pr->id) != device) {
		dev_warn(&device->dev,
			"BIOS reported wrong ACPI id %d for the processor\n",
			pr->id);
		/* Give up, but do not abort the namespace scan. */
		goto err;
	}
	/*
	 * processor_device_array is not cleared on errors to allow buggy BIOS
	 * checks.
	 */
	per_cpu(processor_device_array, pr->id) = device;
	per_cpu(processors, pr->id) = pr;

	dev = get_cpu_device(pr->id);
	if (!dev) {
		result = -ENODEV;
		goto err;
	}

	result = acpi_bind_one(dev, pr->handle);
	if (result)
		goto err;

	pr->dev = dev;
	dev->offline = pr->flags.need_hotplug_init;

	/* Trigger the processor driver's .probe() if present. */
	if (device_attach(dev) >= 0)
		return 1;

	dev_err(dev, "Processor driver could not be attached\n");
	acpi_unbind_one(dev);

 err:
	free_cpumask_var(pr->throttling.shared_cpu_map);
	device->driver_data = NULL;
	per_cpu(processors, pr->id) = NULL;
 err_free_pr:
	kfree(pr);
	return result;
}
开发者ID:AnadoluPanteri,项目名称:kernel-plus-harmattan,代码行数:80,代码来源:acpi_processor.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ device_create函数代码示例发布时间:2022-05-30
下一篇:
C++ device_add_child_ordered函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap