aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/power/suspend.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/base/power/suspend.c')
-rw-r--r--drivers/base/power/suspend.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/base/power/suspend.c b/drivers/base/power/suspend.c
index 42d2b86ba765..9d6701cd7f10 100644
--- a/drivers/base/power/suspend.c
+++ b/drivers/base/power/suspend.c
@@ -108,7 +108,7 @@ int suspend_device(struct device * dev, pm_message_t state)
108 108
109/* 109/*
110 * This is called with interrupts off, only a single CPU 110 * This is called with interrupts off, only a single CPU
111 * running. We can't do down() on a semaphore (and we don't 111 * running. We can't acquire a mutex or semaphore (and we don't
112 * need the protection) 112 * need the protection)
113 */ 113 */
114static int suspend_device_late(struct device *dev, pm_message_t state) 114static int suspend_device_late(struct device *dev, pm_message_t state)
@@ -153,18 +153,18 @@ int device_suspend(pm_message_t state)
153 int error = 0; 153 int error = 0;
154 154
155 might_sleep(); 155 might_sleep();
156 down(&dpm_sem); 156 mutex_lock(&dpm_mtx);
157 down(&dpm_list_sem); 157 mutex_lock(&dpm_list_mtx);
158 while (!list_empty(&dpm_active) && error == 0) { 158 while (!list_empty(&dpm_active) && error == 0) {
159 struct list_head * entry = dpm_active.prev; 159 struct list_head * entry = dpm_active.prev;
160 struct device * dev = to_device(entry); 160 struct device * dev = to_device(entry);
161 161
162 get_device(dev); 162 get_device(dev);
163 up(&dpm_list_sem); 163 mutex_unlock(&dpm_list_mtx);
164 164
165 error = suspend_device(dev, state); 165 error = suspend_device(dev, state);
166 166
167 down(&dpm_list_sem); 167 mutex_lock(&dpm_list_mtx);
168 168
169 /* Check if the device got removed */ 169 /* Check if the device got removed */
170 if (!list_empty(&dev->power.entry)) { 170 if (!list_empty(&dev->power.entry)) {
@@ -179,11 +179,11 @@ int device_suspend(pm_message_t state)
179 error == -EAGAIN ? " (please convert to suspend_late)" : ""); 179 error == -EAGAIN ? " (please convert to suspend_late)" : "");
180 put_device(dev); 180 put_device(dev);
181 } 181 }
182 up(&dpm_list_sem); 182 mutex_unlock(&dpm_list_mtx);
183 if (error) 183 if (error)
184 dpm_resume(); 184 dpm_resume();
185 185
186 up(&dpm_sem); 186 mutex_unlock(&dpm_mtx);
187 return error; 187 return error;
188} 188}
189 189