diff options
author | Matthias Kaehlcke <matthias.kaehlcke@gmail.com> | 2007-05-24 01:19:41 +0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-07-12 03:09:01 +0400 |
commit | 11048dcf333c414f237bb713c422e68f67b115a3 (patch) | |
tree | 3a42905f9b946e5614568568c4ee1f8f54f54e86 /drivers/base/power/main.c | |
parent | 9f3f776bd9e3d52f0204db1df0914b50d6a2372e (diff) | |
download | linux-11048dcf333c414f237bb713c422e68f67b115a3.tar.xz |
Power Management: use mutexes instead of semaphores
The Power Management code uses semaphores as mutexes. Use the mutex API
instead of the (binary) semaphores.
Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/base/power/main.c')
-rw-r--r-- | drivers/base/power/main.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index 05dc8764e765..7b3cc3c15b9d 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c @@ -20,14 +20,16 @@ */ #include <linux/device.h> +#include <linux/mutex.h> + #include "power.h" LIST_HEAD(dpm_active); LIST_HEAD(dpm_off); LIST_HEAD(dpm_off_irq); -DECLARE_MUTEX(dpm_sem); -DECLARE_MUTEX(dpm_list_sem); +DEFINE_MUTEX(dpm_mtx); +DEFINE_MUTEX(dpm_list_mtx); int (*platform_enable_wakeup)(struct device *dev, int is_on); @@ -59,12 +61,12 @@ int device_pm_add(struct device * dev) pr_debug("PM: Adding info for %s:%s\n", dev->bus ? dev->bus->name : "No Bus", kobject_name(&dev->kobj)); - down(&dpm_list_sem); + mutex_lock(&dpm_list_mtx); list_add_tail(&dev->power.entry, &dpm_active); device_pm_set_parent(dev, dev->parent); if ((error = dpm_sysfs_add(dev))) list_del(&dev->power.entry); - up(&dpm_list_sem); + mutex_unlock(&dpm_list_mtx); return error; } @@ -73,11 +75,11 @@ void device_pm_remove(struct device * dev) pr_debug("PM: Removing info for %s:%s\n", dev->bus ? dev->bus->name : "No Bus", kobject_name(&dev->kobj)); - down(&dpm_list_sem); + mutex_lock(&dpm_list_mtx); dpm_sysfs_remove(dev); put_device(dev->power.pm_parent); list_del_init(&dev->power.entry); - up(&dpm_list_sem); + mutex_unlock(&dpm_list_mtx); } |