diff options
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/bus.c | 22 | ||||
-rw-r--r-- | drivers/base/platform.c | 2 |
2 files changed, 23 insertions, 1 deletions
diff --git a/drivers/base/bus.c b/drivers/base/bus.c index c3141565d59..48718b7f4fa 100644 --- a/drivers/base/bus.c +++ b/drivers/base/bus.c @@ -536,6 +536,28 @@ void bus_rescan_devices(struct bus_type * bus) bus_for_each_dev(bus, NULL, NULL, bus_rescan_devices_helper); } +/** + * device_reprobe - remove driver for a device and probe for a new driver + * @dev: the device to reprobe + * + * This function detaches the attached driver (if any) for the given + * device and restarts the driver probing process. It is intended + * to use if probing criteria changed during a devices lifetime and + * driver attachment should change accordingly. + */ +void device_reprobe(struct device *dev) +{ + if (dev->driver) { + if (dev->parent) /* Needed for USB */ + down(&dev->parent->sem); + device_release_driver(dev); + if (dev->parent) + up(&dev->parent->sem); + } + + bus_rescan_devices_helper(dev, NULL); +} +EXPORT_SYMBOL_GPL(device_reprobe); struct bus_type * get_bus(struct bus_type * bus) { diff --git a/drivers/base/platform.c b/drivers/base/platform.c index 89b26832132..83f5c5984d1 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c @@ -326,7 +326,7 @@ EXPORT_SYMBOL_GPL(platform_device_register); * platform_device_unregister - unregister a platform-level device * @pdev: platform device we're unregistering * - * Unregistration is done in 2 steps. Fisrt we release all resources + * Unregistration is done in 2 steps. First we release all resources * and remove it from the subsystem, then we drop reference count by * calling platform_device_put(). */ |