aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/power/main.c
diff options
context:
space:
mode:
authorMatthias Kaehlcke <matthias.kaehlcke@gmail.com>2007-05-23 17:19:41 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2007-07-11 19:09:01 -0400
commit11048dcf333c414f237bb713c422e68f67b115a3 (patch)
tree3a42905f9b946e5614568568c4ee1f8f54f54e86 /drivers/base/power/main.c
parent9f3f776bd9e3d52f0204db1df0914b50d6a2372e (diff)
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.c14
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 @@
20 */ 20 */
21 21
22#include <linux/device.h> 22#include <linux/device.h>
23#include <linux/mutex.h>
24
23#include "power.h" 25#include "power.h"
24 26
25LIST_HEAD(dpm_active); 27LIST_HEAD(dpm_active);
26LIST_HEAD(dpm_off); 28LIST_HEAD(dpm_off);
27LIST_HEAD(dpm_off_irq); 29LIST_HEAD(dpm_off_irq);
28 30
29DECLARE_MUTEX(dpm_sem); 31DEFINE_MUTEX(dpm_mtx);
30DECLARE_MUTEX(dpm_list_sem); 32DEFINE_MUTEX(dpm_list_mtx);
31 33
32int (*platform_enable_wakeup)(struct device *dev, int is_on); 34int (*platform_enable_wakeup)(struct device *dev, int is_on);
33 35
@@ -59,12 +61,12 @@ int device_pm_add(struct device * dev)
59 pr_debug("PM: Adding info for %s:%s\n", 61 pr_debug("PM: Adding info for %s:%s\n",
60 dev->bus ? dev->bus->name : "No Bus", 62 dev->bus ? dev->bus->name : "No Bus",
61 kobject_name(&dev->kobj)); 63 kobject_name(&dev->kobj));
62 down(&dpm_list_sem); 64 mutex_lock(&dpm_list_mtx);
63 list_add_tail(&dev->power.entry, &dpm_active); 65 list_add_tail(&dev->power.entry, &dpm_active);
64 device_pm_set_parent(dev, dev->parent); 66 device_pm_set_parent(dev, dev->parent);
65 if ((error = dpm_sysfs_add(dev))) 67 if ((error = dpm_sysfs_add(dev)))
66 list_del(&dev->power.entry); 68 list_del(&dev->power.entry);
67 up(&dpm_list_sem); 69 mutex_unlock(&dpm_list_mtx);
68 return error; 70 return error;
69} 71}
70 72
@@ -73,11 +75,11 @@ void device_pm_remove(struct device * dev)
73 pr_debug("PM: Removing info for %s:%s\n", 75 pr_debug("PM: Removing info for %s:%s\n",
74 dev->bus ? dev->bus->name : "No Bus", 76 dev->bus ? dev->bus->name : "No Bus",
75 kobject_name(&dev->kobj)); 77 kobject_name(&dev->kobj));
76 down(&dpm_list_sem); 78 mutex_lock(&dpm_list_mtx);
77 dpm_sysfs_remove(dev); 79 dpm_sysfs_remove(dev);
78 put_device(dev->power.pm_parent); 80 put_device(dev->power.pm_parent);
79 list_del_init(&dev->power.entry); 81 list_del_init(&dev->power.entry);
80 up(&dpm_list_sem); 82 mutex_unlock(&dpm_list_mtx);
81} 83}
82 84
83 85