From f5ef2abcbeb5b0be23f7cc610a024b2406e3d8e6 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Sun, 1 Apr 2007 10:54:13 -0700 Subject: [PATCH] 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 Signed-off-by: Linus Torvalds --- drivers/base/driver.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/base/driver.c b/drivers/base/driver.c index 1214cbd17d..082bfded38 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); } /** -- 2.39.5