diff --exclude='*~' -urN 2.6.9-rc4-mm1-RT-U7/drivers/base/bus.c 2.6.9-rc4-mm1-RT-U7-work/drivers/base/bus.c --- 2.6.9-rc4-mm1-RT-U7/drivers/base/bus.c 2004-10-12 09:41:05.000000000 +0200 +++ 2.6.9-rc4-mm1-RT-U7-work/drivers/base/bus.c 2004-10-20 03:04:29.000000000 +0200 @@ -65,7 +65,7 @@ static void driver_release(struct kobject * kobj) { struct device_driver * drv = to_driver(kobj); - up(&drv->unload_sem); + complete(&drv->unload_done); } static struct kobj_type ktype_driver = { diff --exclude='*~' -urN 2.6.9-rc4-mm1-RT-U7/include/linux/device.h 2.6.9-rc4-mm1-RT-U7-work/include/linux/device.h --- 2.6.9-rc4-mm1-RT-U7/include/linux/device.h 2004-10-12 09:41:58.000000000 +0200 +++ 2.6.9-rc4-mm1-RT-U7-work/include/linux/device.h 2004-10-20 03:05:02.000000000 +0200 @@ -102,7 +102,7 @@ char * name; struct bus_type * bus; - struct semaphore unload_sem; + struct completion unload_done; struct kobject kobj; struct list_head devices; diff --exclude='*~' -urN 2.6.9-rc4-mm1-RT-U7/drivers/base/driver.c 2.6.9-rc4-mm1-RT-U7-work/drivers/base/driver.c --- 2.6.9-rc4-mm1-RT-U7/drivers/base/driver.c 2004-10-12 09:41:05.000000000 +0200 +++ 2.6.9-rc4-mm1-RT-U7-work/drivers/base/driver.c 2004-10-20 03:11:20.000000000 +0200 @@ -79,14 +79,13 @@ * since most of the things we have to do deal with the bus * structures. * - * The one interesting aspect is that we initialize @drv->unload_sem - * to a locked state here. It will be unlocked when the driver - * reference count reaches 0. + * We init the completion strcut here. When the reference + * count reaches zero, complete() is called from bus_release(). */ int driver_register(struct device_driver * drv) { INIT_LIST_HEAD(&drv->devices); - init_MUTEX_LOCKED(&drv->unload_sem); + init_completion(&drv->unload_done); return bus_add_driver(drv); } @@ -97,18 +96,16 @@ * * Again, we pass off most of the work to the bus-level call. * - * Though, once that is done, we attempt to take @drv->unload_sem. - * This will block until the driver refcount reaches 0, and it is - * released. Only modular drivers will call this function, and we + * Though, once that is done, we wait until the driver refcount + * reaches 0, and complete() is called in bus_release(). + * Only modular drivers will call this function, and we * have to guarantee that it won't complete, letting the driver * unload until all references are gone. */ - void driver_unregister(struct device_driver * drv) { bus_remove_driver(drv); - down(&drv->unload_sem); - up(&drv->unload_sem); + wait_for_completion(&drv->unload_done); } /**