aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-04-01 10:54:13 -0700
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-04-01 10:54:13 -0700
commitf5ef2abcbeb5b0be23f7cc610a024b2406e3d8e6 (patch)
treef0ded5f4a61f4db25794d097725e1d37d872c80c
parent755948cfca16c71b16e8ff4a9d4dd31b1c0bf923 (diff)
driver core: do not wait unnecessarily in driver_unregister()
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>
-rw-r--r--drivers/base/driver.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/base/driver.c b/drivers/base/driver.c
index 1214cbd17d8..082bfded385 100644
--- a/drivers/base/driver.c
+++ b/drivers/base/driver.c
@@ -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);
}
/**