Commit 59fb29c6 authored by Patrick Mochel's avatar Patrick Mochel Committed by Patrick Mochel

device detach locking, one more time: get driver and reset it in struct device...

device detach locking, one more time: get driver and reset it in struct device before calling remove()
parent 63c32d4d
......@@ -98,19 +98,22 @@ static int device_attach(struct device * dev)
static void device_detach(struct device * dev)
{
if (dev->driver) {
write_lock(&dev->driver->lock);
list_del_init(&dev->driver_list);
write_unlock(&dev->driver->lock);
/* detach from driver */
if (dev->driver->remove)
dev->driver->remove(dev);
put_driver(dev->driver);
struct device_driver * drv;
if (dev->driver) {
lock_device(dev);
drv = dev->driver;
dev->driver = NULL;
unlock_device(dev);
write_lock(&drv->lock);
list_del_init(&dev->driver_list);
write_unlock(&drv->lock);
/* detach from driver */
if (drv->remove)
drv->remove(dev);
put_driver(drv);
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment