diff options
-rw-r--r-- | arch/arm/kernel/apm.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/arch/arm/kernel/apm.c b/arch/arm/kernel/apm.c index 845af0bc1108..a11fb9a40c04 100644 --- a/arch/arm/kernel/apm.c +++ b/arch/arm/kernel/apm.c | |||
@@ -102,7 +102,7 @@ static DECLARE_WAIT_QUEUE_HEAD(kapmd_wait); | |||
102 | static DEFINE_SPINLOCK(kapmd_queue_lock); | 102 | static DEFINE_SPINLOCK(kapmd_queue_lock); |
103 | static struct apm_queue kapmd_queue; | 103 | static struct apm_queue kapmd_queue; |
104 | 104 | ||
105 | static DECLARE_MUTEX(state_lock); | 105 | static DEFINE_MUTEX(state_lock); |
106 | 106 | ||
107 | static const char driver_version[] = "1.13"; /* no spaces */ | 107 | static const char driver_version[] = "1.13"; /* no spaces */ |
108 | 108 | ||
@@ -176,7 +176,7 @@ static int queue_suspend_event(apm_event_t event, struct apm_user *sender) | |||
176 | struct apm_user *as; | 176 | struct apm_user *as; |
177 | int ret = 1; | 177 | int ret = 1; |
178 | 178 | ||
179 | down(&state_lock); | 179 | mutex_lock(&state_lock); |
180 | down_read(&user_list_lock); | 180 | down_read(&user_list_lock); |
181 | 181 | ||
182 | /* | 182 | /* |
@@ -201,7 +201,7 @@ static int queue_suspend_event(apm_event_t event, struct apm_user *sender) | |||
201 | } | 201 | } |
202 | out: | 202 | out: |
203 | up_read(&user_list_lock); | 203 | up_read(&user_list_lock); |
204 | up(&state_lock); | 204 | mutex_unlock(&state_lock); |
205 | wake_up_interruptible(&apm_waitqueue); | 205 | wake_up_interruptible(&apm_waitqueue); |
206 | return ret; | 206 | return ret; |
207 | } | 207 | } |
@@ -220,7 +220,7 @@ static void apm_suspend(void) | |||
220 | /* | 220 | /* |
221 | * Finally, wake up anyone who is sleeping on the suspend. | 221 | * Finally, wake up anyone who is sleeping on the suspend. |
222 | */ | 222 | */ |
223 | down(&state_lock); | 223 | mutex_lock(&state_lock); |
224 | down_read(&user_list_lock); | 224 | down_read(&user_list_lock); |
225 | list_for_each_entry(as, &apm_user_list, list) { | 225 | list_for_each_entry(as, &apm_user_list, list) { |
226 | if (as->suspend_state == SUSPEND_WAIT || | 226 | if (as->suspend_state == SUSPEND_WAIT || |
@@ -230,7 +230,7 @@ static void apm_suspend(void) | |||
230 | } | 230 | } |
231 | } | 231 | } |
232 | up_read(&user_list_lock); | 232 | up_read(&user_list_lock); |
233 | up(&state_lock); | 233 | mutex_unlock(&state_lock); |
234 | 234 | ||
235 | wake_up(&apm_suspend_waitqueue); | 235 | wake_up(&apm_suspend_waitqueue); |
236 | } | 236 | } |
@@ -256,11 +256,11 @@ static ssize_t apm_read(struct file *fp, char __user *buf, size_t count, loff_t | |||
256 | if (copy_to_user(buf, &event, sizeof(event))) | 256 | if (copy_to_user(buf, &event, sizeof(event))) |
257 | break; | 257 | break; |
258 | 258 | ||
259 | down(&state_lock); | 259 | mutex_lock(&state_lock); |
260 | if (as->suspend_state == SUSPEND_PENDING && | 260 | if (as->suspend_state == SUSPEND_PENDING && |
261 | (event == APM_SYS_SUSPEND || event == APM_USER_SUSPEND)) | 261 | (event == APM_SYS_SUSPEND || event == APM_USER_SUSPEND)) |
262 | as->suspend_state = SUSPEND_READ; | 262 | as->suspend_state = SUSPEND_READ; |
263 | up(&state_lock); | 263 | mutex_unlock(&state_lock); |
264 | 264 | ||
265 | buf += sizeof(event); | 265 | buf += sizeof(event); |
266 | i -= sizeof(event); | 266 | i -= sizeof(event); |
@@ -302,7 +302,7 @@ apm_ioctl(struct inode * inode, struct file *filp, u_int cmd, u_long arg) | |||
302 | 302 | ||
303 | switch (cmd) { | 303 | switch (cmd) { |
304 | case APM_IOC_SUSPEND: | 304 | case APM_IOC_SUSPEND: |
305 | down(&state_lock); | 305 | mutex_lock(&state_lock); |
306 | 306 | ||
307 | as->suspend_result = -EINTR; | 307 | as->suspend_result = -EINTR; |
308 | 308 | ||
@@ -317,7 +317,7 @@ apm_ioctl(struct inode * inode, struct file *filp, u_int cmd, u_long arg) | |||
317 | as->suspend_state = SUSPEND_ACKED; | 317 | as->suspend_state = SUSPEND_ACKED; |
318 | suspends_pending--; | 318 | suspends_pending--; |
319 | pending = suspends_pending == 0; | 319 | pending = suspends_pending == 0; |
320 | up(&state_lock); | 320 | mutex_unlock(&state_lock); |
321 | 321 | ||
322 | /* | 322 | /* |
323 | * If there are no further acknowledges required, | 323 | * If there are no further acknowledges required, |
@@ -341,7 +341,7 @@ apm_ioctl(struct inode * inode, struct file *filp, u_int cmd, u_long arg) | |||
341 | as->suspend_state == SUSPEND_DONE); | 341 | as->suspend_state == SUSPEND_DONE); |
342 | } else { | 342 | } else { |
343 | as->suspend_state = SUSPEND_WAIT; | 343 | as->suspend_state = SUSPEND_WAIT; |
344 | up(&state_lock); | 344 | mutex_unlock(&state_lock); |
345 | 345 | ||
346 | /* | 346 | /* |
347 | * Otherwise it is a request to suspend the system. | 347 | * Otherwise it is a request to suspend the system. |
@@ -379,10 +379,10 @@ apm_ioctl(struct inode * inode, struct file *filp, u_int cmd, u_long arg) | |||
379 | 379 | ||
380 | current->flags = flags; | 380 | current->flags = flags; |
381 | 381 | ||
382 | down(&state_lock); | 382 | mutex_lock(&state_lock); |
383 | err = as->suspend_result; | 383 | err = as->suspend_result; |
384 | as->suspend_state = SUSPEND_NONE; | 384 | as->suspend_state = SUSPEND_NONE; |
385 | up(&state_lock); | 385 | mutex_unlock(&state_lock); |
386 | break; | 386 | break; |
387 | } | 387 | } |
388 | 388 | ||
@@ -406,12 +406,12 @@ static int apm_release(struct inode * inode, struct file * filp) | |||
406 | * need to balance suspends_pending, which means the | 406 | * need to balance suspends_pending, which means the |
407 | * possibility of sleeping. | 407 | * possibility of sleeping. |
408 | */ | 408 | */ |
409 | down(&state_lock); | 409 | mutex_lock(&state_lock); |
410 | if (as->suspend_state != SUSPEND_NONE) { | 410 | if (as->suspend_state != SUSPEND_NONE) { |
411 | suspends_pending -= 1; | 411 | suspends_pending -= 1; |
412 | pending = suspends_pending == 0; | 412 | pending = suspends_pending == 0; |
413 | } | 413 | } |
414 | up(&state_lock); | 414 | mutex_unlock(&state_lock); |
415 | if (pending) | 415 | if (pending) |
416 | apm_suspend(); | 416 | apm_suspend(); |
417 | 417 | ||