Skip to content

Commit

Permalink
driver core: do not wait unnecessarily in driver_unregister()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Linus Torvalds committed Apr 1, 2007
1 parent 755948c commit f5ef2ab
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion drivers/base/driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down

0 comments on commit f5ef2ab

Please sign in to comment.