Commit dc3099f2 authored by Patrick Mochel's avatar Patrick Mochel

driver model: Remove device_sem

This was only used to add/remove device from parent's list of children, 
which we can easily replace with a write lock on the device subsys's rwsem.
parent 8c4043ac
extern struct semaphore device_sem;
extern int bus_add_device(struct device * dev); extern int bus_add_device(struct device * dev);
extern void bus_remove_device(struct device * dev); extern void bus_remove_device(struct device * dev);
......
...@@ -21,9 +21,6 @@ ...@@ -21,9 +21,6 @@
int (*platform_notify)(struct device * dev) = NULL; int (*platform_notify)(struct device * dev) = NULL;
int (*platform_notify_remove)(struct device * dev) = NULL; int (*platform_notify_remove)(struct device * dev) = NULL;
DECLARE_MUTEX(device_sem);
/* /*
* sysfs bindings for devices. * sysfs bindings for devices.
*/ */
...@@ -222,11 +219,11 @@ int device_add(struct device *dev) ...@@ -222,11 +219,11 @@ int device_add(struct device *dev)
goto register_done; goto register_done;
/* now take care of our own registration */ /* now take care of our own registration */
if (parent) {
down(&device_sem); down_write(&devices_subsys.rwsem);
if (parent)
list_add_tail(&dev->node,&parent->children); list_add_tail(&dev->node,&parent->children);
up(&device_sem); up_write(&devices_subsys.rwsem);
}
bus_add_device(dev); bus_add_device(dev);
...@@ -304,11 +301,10 @@ void device_del(struct device * dev) ...@@ -304,11 +301,10 @@ void device_del(struct device * dev)
{ {
struct device * parent = dev->parent; struct device * parent = dev->parent;
if (parent) { down_write(&devices_subsys.rwsem);
down(&device_sem); if (parent)
list_del_init(&dev->node); list_del_init(&dev->node);
up(&device_sem); up_write(&devices_subsys.rwsem);
}
/* Notify the platform of the removal, in case they /* Notify the platform of the removal, in case they
* need to do anything... * need to do anything...
......
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