aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/bus.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/base/bus.c')
-rw-r--r--drivers/base/bus.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index f4fa27315fb4..3cb04bb04c2b 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -390,7 +390,6 @@ void device_release_driver(struct device * dev)
390 sysfs_remove_link(&drv->kobj, kobject_name(&dev->kobj)); 390 sysfs_remove_link(&drv->kobj, kobject_name(&dev->kobj));
391 sysfs_remove_link(&dev->kobj, "driver"); 391 sysfs_remove_link(&dev->kobj, "driver");
392 list_del_init(&dev->driver_list); 392 list_del_init(&dev->driver_list);
393 device_detach_shutdown(dev);
394 if (drv->remove) 393 if (drv->remove)
395 drv->remove(dev); 394 drv->remove(dev);
396 dev->driver = NULL; 395 dev->driver = NULL;
@@ -405,9 +404,8 @@ void device_release_driver(struct device * dev)
405 404
406static void driver_detach(struct device_driver * drv) 405static void driver_detach(struct device_driver * drv)
407{ 406{
408 struct list_head * entry, * next; 407 while (!list_empty(&drv->devices)) {
409 list_for_each_safe(entry, next, &drv->devices) { 408 struct device * dev = container_of(drv->devices.next, struct device, driver_list);
410 struct device * dev = container_of(entry, struct device, driver_list);
411 device_release_driver(dev); 409 device_release_driver(dev);
412 } 410 }
413} 411}