diff options
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 @@ | |||
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 | ||
25 | LIST_HEAD(dpm_active); | 27 | LIST_HEAD(dpm_active); |
26 | LIST_HEAD(dpm_off); | 28 | LIST_HEAD(dpm_off); |
27 | LIST_HEAD(dpm_off_irq); | 29 | LIST_HEAD(dpm_off_irq); |
28 | 30 | ||
29 | DECLARE_MUTEX(dpm_sem); | 31 | DEFINE_MUTEX(dpm_mtx); |
30 | DECLARE_MUTEX(dpm_list_sem); | 32 | DEFINE_MUTEX(dpm_list_mtx); |
31 | 33 | ||
32 | int (*platform_enable_wakeup)(struct device *dev, int is_on); | 34 | int (*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 | ||