Esempio n. 1
0
void pcan_usb_deinit(void)
{
	DPRINTK(KERN_DEBUG "%s: %s()\n", DEVICE_NAME, __FUNCTION__);

	if (pcan_drv.usbdrv.probe == pcan_usb_plugin)
	{
		/* Added this since it is the last chance for URB submitting */
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,18)
		int err = driver_for_each_device(&pcan_drv.usbdrv.drvwrap.driver, 
		                                 NULL, NULL, pcan_usb_do_cleanup);
#else
		int err = driver_for_each_device(&pcan_drv.usbdrv.driver, 
		                                 NULL, NULL, pcan_usb_do_cleanup);
#endif

		/* driver_for_each_device() is declared with "must_check" attribute */
		/* so check err here, knowing that drv is not NULL (1st arg) and that */
		/* pcan_usb_do_cleanup() always return 0... */
		if (err) err = 0;

		// then it was registered
		// unregister usb parts, makes a plugout of registered devices
		usb_deregister(&pcan_drv.usbdrv);
	}
}
Esempio n. 2
0
/**
 * fimc_md_register_platform_entities - register FIMC and CSIS media entities
 */
static int fimc_md_register_platform_entities(struct fimc_md *fmd)
{
	struct s5p_platform_fimc *pdata = fmd->pdev->dev.platform_data;
	struct device_driver *driver;
	int ret, i;

	driver = driver_find(FIMC_MODULE_NAME, &platform_bus_type);
	if (!driver) {
		v4l2_warn(&fmd->v4l2_dev,
			 "%s driver not found, deffering probe\n",
			 FIMC_MODULE_NAME);
		return -EPROBE_DEFER;
	}

	ret = driver_for_each_device(driver, NULL, fmd,
				     fimc_register_callback);
	if (ret)
		return ret;

	driver = driver_find(FIMC_LITE_DRV_NAME, &platform_bus_type);
	if (driver && try_module_get(driver->owner)) {
		ret = driver_for_each_device(driver, NULL, fmd,
					     flite_register_callback);
		if (ret)
			return ret;
		module_put(driver->owner);
	}
	fmd->fimc_is_subdev=fimc_is_get_subdev();
	/*
	 * Check if there is any sensor on the MIPI-CSI2 bus and
	 * if not skip the s5p-csis module loading.
	 */
	if (pdata == NULL)
		return 0;
	for (i = 0; i < pdata->num_clients; i++) {
		if (pdata->isp_info[i].bus_type == FIMC_MIPI_CSI2) {
			ret = 1;
			break;
		}
	}
	if (!ret)
		return 0;

	driver = driver_find(CSIS_DRIVER_NAME, &platform_bus_type);
	if (!driver || !try_module_get(driver->owner)) {
		v4l2_warn(&fmd->v4l2_dev,
			 "%s driver not found, deffering probe\n",
			 CSIS_DRIVER_NAME);
		return -EPROBE_DEFER;
	}

	return driver_for_each_device(driver, NULL, fmd,
				      csis_register_callback);
}
Esempio n. 3
0
static void netvsc_drv_exit(void)
{
	struct netvsc_driver *netvsc_drv_obj = &g_netvsc_drv.drv_obj;
	struct driver_context *drv_ctx = &g_netvsc_drv.drv_ctx;
	struct device *current_dev;
	int ret;

	while (1) {
		current_dev = NULL;

		/* Get the device */
		ret = driver_for_each_device(&drv_ctx->driver, NULL,
					     &current_dev, netvsc_drv_exit_cb);
		if (ret)
			DPRINT_WARN(NETVSC_DRV,
				    "driver_for_each_device returned %d", ret);

		if (current_dev == NULL)
			break;

		/* Initiate removal from the top-down */
		DPRINT_INFO(NETVSC_DRV, "unregistering device (%p)...",
			    current_dev);

		device_unregister(current_dev);
	}

	if (netvsc_drv_obj->base.OnCleanup)
		netvsc_drv_obj->base.OnCleanup(&netvsc_drv_obj->base);

	vmbus_child_driver_unregister(drv_ctx);

	return;
}
/**
 * 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 driver device list and returns a pointer to the interface 
 * with the matching minor.  Note, this only works for devices that share the
 * USB major number.
 */
struct usb_interface *usb_find_interface(struct usb_driver *drv, int minor)
{
	struct find_interface_arg argb;

	argb.minor = minor;
	argb.interface = NULL;
	driver_for_each_device(&drv->driver, NULL, &argb, __find_interface);
	return argb.interface;
}
Esempio n. 5
0
void brcmf_usb_exit(void)
{
	struct device_driver *drv = &brcmf_usbdrvr.drvwrap.driver;
	int ret;

	brcmf_dbg(USB, "Enter\n");
	ret = driver_for_each_device(drv, NULL, NULL,
				     brcmf_usb_reset_device);
	usb_deregister(&brcmf_usbdrvr);
}
/**
 * fimc_md_register_platform_entities - register FIMC and CSIS media entities
 */
static int fimc_md_register_platform_entities(struct fimc_md *fmd)
{
	struct device_driver *driver;
	int ret;

	driver = driver_find(FIMC_MODULE_NAME, &platform_bus_type);
	if (!driver)
		return -ENODEV;
	ret = driver_for_each_device(driver, NULL, fmd,
				     fimc_register_callback);
	if (ret)
		return ret;

	driver = driver_find(CSIS_DRIVER_NAME, &platform_bus_type);
	if (driver)
		ret = driver_for_each_device(driver, NULL, fmd,
					     csis_register_callback);
	return ret;
}
Esempio n. 7
0
/**
 * 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 driver device list and returns a pointer to the interface
 * with the matching minor.  Note, this only works for devices that share the
 * USB major number.
 */
struct usb_interface *usb_find_interface(struct usb_driver *drv, int minor)
{
	struct find_interface_arg argb;
	int retval;

	argb.minor = minor;
	argb.interface = NULL;
	/* eat the error, it will be in argb.interface */
	retval = driver_for_each_device(&drv->drvwrap.driver, NULL, &argb,
					__find_interface);
	return argb.interface;
}
static void __exit cx18_alsa_exit(void)
{
	struct device_driver *drv;
	int ret;

	printk(KERN_INFO "cx18-alsa: module unloading...\n");

	drv = driver_find("cx18", &pci_bus_type);
	ret = driver_for_each_device(drv, NULL, NULL, cx18_alsa_exit_callback);

	cx18_ext_init = NULL;
	printk(KERN_INFO "cx18-alsa: module unload complete\n");
}
Esempio n. 9
0
static void __exit ivtv_alsa_exit(void)
{
	struct device_driver *drv;
	int ret;

	pr_info("ivtv-alsa: module unloading...\n");

	drv = driver_find("ivtv", &pci_bus_type);
	ret = driver_for_each_device(drv, NULL, NULL, ivtv_alsa_exit_callback);
	(void)ret;	/* suppress compiler warning */

	ivtv_ext_init = NULL;
	pr_info("ivtv-alsa: module unload complete\n");
}
Esempio n. 10
0
int dell_rbtn_notifier_unregister(struct notifier_block *nb)
{
	int ret;

	ret = atomic_notifier_chain_unregister(&rbtn_chain_head, nb);
	if (ret != 0)
		return ret;

	if (auto_remove_rfkill && !rbtn_chain_head.head)
		ret = driver_for_each_device(&rbtn_driver.drv, NULL,
					     (void *)true, rbtn_switch_dev);

	return ret;
}
Esempio n. 11
0
int dell_rbtn_notifier_register(struct notifier_block *nb)
{
	bool first;
	int count;
	int ret;

	count = 0;
	ret = driver_for_each_device(&rbtn_driver.drv, NULL, &count,
				     rbtn_inc_count);
	if (ret || count == 0)
		return -ENODEV;

	first = !rbtn_chain_head.head;

	ret = atomic_notifier_chain_register(&rbtn_chain_head, nb);
	if (ret != 0)
		return ret;

	if (auto_remove_rfkill && first)
		ret = driver_for_each_device(&rbtn_driver.drv, NULL,
					     (void *)false, rbtn_switch_dev);

	return ret;
}
static int stmp_appuart_notifier(struct notifier_block *self,
			unsigned long phase, void *p)
{
	int r = 0;

	if ((phase == CPUFREQ_POSTCHANGE) ||
	    (phase == CPUFREQ_RESUMECHANGE)) {
			/* get new uartclock and setspeed */
			r = driver_for_each_device(
					&stmp_appuart_driver.driver,
					NULL, p,
					stmp_appuart_updateclk);
	}
	return (r == 0) ? NOTIFY_OK : NOTIFY_DONE;
}
Esempio n. 13
0
static struct exynos_md *flite_get_capture_md(enum mdev_node node)
{
	struct device_driver *drv;
	struct exynos_md *md[MDEV_MAX_NUM] = {NULL,};
	int ret;

	drv = driver_find(MDEV_MODULE_NAME, &platform_bus_type);
	if (!drv)
		return ERR_PTR(-ENODEV);

	ret = driver_for_each_device(drv, NULL, &md[0],
				     flite_get_md_callback);
	put_driver(drv);

	return ret ? NULL : md[node];

}
static struct platform_device *get_mipi_csis_pdev(int id)
{
	const char *module_name = "s5p-mipi-csis";
	struct device_driver *drv;
	struct platform_device *pdev[FLITE_ID_END];
	int ret;

	drv = driver_find(module_name, &platform_bus_type);
	if (!drv) {
		request_module(module_name);
		drv = driver_find(module_name, &platform_bus_type);
	}
	if (!drv)
		return ERR_PTR(-ENODEV);

	ret = driver_for_each_device(drv, NULL, &pdev[0], mipi_csis_callback);

	return ret ? NULL : pdev[id];
}
Esempio n. 15
0
static struct v4l2_subdev *fimc_is_get_subdev()
{                       
        const char *module_name = "exynos4-fimc-is";
        struct device_driver *drv;
        struct v4l2_subdev *sd = NULL; 
        int ret;        
                        
        drv = driver_find(module_name, &platform_bus_type);
	if (!drv) {
		printk("%s driver not found, deffering probe\n",
			 module_name);
		return -EPROBE_DEFER;
	}
	if (drv && try_module_get(drv->owner)) {
	        ret = driver_for_each_device(drv, NULL, &sd,
                                     fimc_is_register_callback);
		if (ret)
			return ret;
		module_put(drv->owner);
	}
	gfmd->fimc[0]->vid_cap.isp_subdev=sd;
        
        return ret ? NULL : sd;
}
Esempio n. 16
0
File: iommu.c Progetto: XMoon/kernel
int foreach_iommu_device(void *data, int (*fn)(struct device *, void *))
{
	return driver_for_each_device(&omap_iommu_driver.driver,
				      NULL, data, fn);
}
Esempio n. 17
0
int omap2_onenand_rephase(void)
{
	return driver_for_each_device(&omap2_onenand_driver.driver, NULL,
				      NULL, __adjust_timing);
}