Skip to content

Commit f5ef2ab

Browse files
author
Linus Torvalds
committed
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>
1 parent 755948c commit f5ef2ab

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

‎drivers/base/driver.c‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,14 @@ int driver_register(struct device_driver * drv)
183183
void driver_unregister(struct device_driver * drv)
184184
{
185185
bus_remove_driver(drv);
186-
wait_for_completion(&drv->unloaded);
186+
/*
187+
* If the driver is a module, we are probably in
188+
* the module unload path, and we want to wait
189+
* for everything to unload before we can actually
190+
* finish the unload.
191+
*/
192+
if (drv->owner)
193+
wait_for_completion(&drv->unloaded);
187194
}
188195

189196
/**

0 commit comments

Comments
 (0)