Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+8 -1
+8 -1
drivers/base/driver.c
··· 183 183 void driver_unregister(struct device_driver * drv) 184 184 { 185 185 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); 187 194 } 188 195 189 196 /**