]> err.no Git - linux-2.6/commitdiff
driver core: do not wait unnecessarily in driver_unregister()
authorLinus Torvalds <torvalds@woody.linux-foundation.org>
Sun, 1 Apr 2007 17:54:13 +0000 (10:54 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Sun, 1 Apr 2007 17:54:13 +0000 (10:54 -0700)
Ingo reported that built-in drivers suffered bootup hangs with certain
driver unregistry sequences, due to sysfs breakage.

Do the minimal fix for v2.6.21: only wait if the driver is a module.

Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/base/driver.c

index 1214cbd17d868bf1613bcf79ee079cabef95ca62..082bfded38544b0fc055861a79112446ae6199c9 100644 (file)
@@ -183,7 +183,14 @@ int driver_register(struct device_driver * drv)
 void driver_unregister(struct device_driver * drv)
 {
        bus_remove_driver(drv);
-       wait_for_completion(&drv->unloaded);
+       /*
+        * If the driver is a module, we are probably in
+        * the module unload path, and we want to wait
+        * for everything to unload before we can actually
+        * finish the unload.
+        */
+       if (drv->owner)
+               wait_for_completion(&drv->unloaded);
 }
 
 /**