diff options
author | Stephen Hemminger <shemminger@osdl.org> | 2006-12-06 23:34:35 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-07 11:39:28 -0500 |
commit | a6d70980602e6f1869ebcdcbfaf55a0a5941583e (patch) | |
tree | b7e9b5f457eb7fe91fbbdbe978a50493da862cf2 /kernel/power/disk.c | |
parent | 3eb1b3a40722cbb46631db373af66d13d1e7ac81 (diff) |
[PATCH] convert pm_sem to a mutex
The power management semaphore is only used as mutex, so convert it.
[akpm@osdl.org: fix rotten bug]
Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
Acked-by: Ingo Molnar <mingo@elte.hu>
Acked-by: Pavel Machek <pavel@ucw.cz>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel/power/disk.c')
-rw-r--r-- | kernel/power/disk.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/kernel/power/disk.c b/kernel/power/disk.c index 53b3b57c0223..08d9e7aac0f8 100644 --- a/kernel/power/disk.c +++ b/kernel/power/disk.c | |||
@@ -213,10 +213,10 @@ static int software_resume(void) | |||
213 | { | 213 | { |
214 | int error; | 214 | int error; |
215 | 215 | ||
216 | down(&pm_sem); | 216 | mutex_lock(&pm_mutex); |
217 | if (!swsusp_resume_device) { | 217 | if (!swsusp_resume_device) { |
218 | if (!strlen(resume_file)) { | 218 | if (!strlen(resume_file)) { |
219 | up(&pm_sem); | 219 | mutex_unlock(&pm_mutex); |
220 | return -ENOENT; | 220 | return -ENOENT; |
221 | } | 221 | } |
222 | swsusp_resume_device = name_to_dev_t(resume_file); | 222 | swsusp_resume_device = name_to_dev_t(resume_file); |
@@ -231,7 +231,7 @@ static int software_resume(void) | |||
231 | * FIXME: If noresume is specified, we need to find the partition | 231 | * FIXME: If noresume is specified, we need to find the partition |
232 | * and reset it back to normal swap space. | 232 | * and reset it back to normal swap space. |
233 | */ | 233 | */ |
234 | up(&pm_sem); | 234 | mutex_unlock(&pm_mutex); |
235 | return 0; | 235 | return 0; |
236 | } | 236 | } |
237 | 237 | ||
@@ -275,7 +275,7 @@ static int software_resume(void) | |||
275 | unprepare_processes(); | 275 | unprepare_processes(); |
276 | Done: | 276 | Done: |
277 | /* For success case, the suspend path will release the lock */ | 277 | /* For success case, the suspend path will release the lock */ |
278 | up(&pm_sem); | 278 | mutex_unlock(&pm_mutex); |
279 | pr_debug("PM: Resume from disk failed.\n"); | 279 | pr_debug("PM: Resume from disk failed.\n"); |
280 | return 0; | 280 | return 0; |
281 | } | 281 | } |
@@ -336,7 +336,7 @@ static ssize_t disk_store(struct subsystem * s, const char * buf, size_t n) | |||
336 | p = memchr(buf, '\n', n); | 336 | p = memchr(buf, '\n', n); |
337 | len = p ? p - buf : n; | 337 | len = p ? p - buf : n; |
338 | 338 | ||
339 | down(&pm_sem); | 339 | mutex_lock(&pm_mutex); |
340 | for (i = PM_DISK_FIRMWARE; i < PM_DISK_MAX; i++) { | 340 | for (i = PM_DISK_FIRMWARE; i < PM_DISK_MAX; i++) { |
341 | if (!strncmp(buf, pm_disk_modes[i], len)) { | 341 | if (!strncmp(buf, pm_disk_modes[i], len)) { |
342 | mode = i; | 342 | mode = i; |
@@ -360,7 +360,7 @@ static ssize_t disk_store(struct subsystem * s, const char * buf, size_t n) | |||
360 | 360 | ||
361 | pr_debug("PM: suspend-to-disk mode set to '%s'\n", | 361 | pr_debug("PM: suspend-to-disk mode set to '%s'\n", |
362 | pm_disk_modes[mode]); | 362 | pm_disk_modes[mode]); |
363 | up(&pm_sem); | 363 | mutex_unlock(&pm_mutex); |
364 | return error ? error : n; | 364 | return error ? error : n; |
365 | } | 365 | } |
366 | 366 | ||
@@ -385,9 +385,9 @@ static ssize_t resume_store(struct subsystem *subsys, const char *buf, size_t n) | |||
385 | if (maj != MAJOR(res) || min != MINOR(res)) | 385 | if (maj != MAJOR(res) || min != MINOR(res)) |
386 | goto out; | 386 | goto out; |
387 | 387 | ||
388 | down(&pm_sem); | 388 | mutex_lock(&pm_mutex); |
389 | swsusp_resume_device = res; | 389 | swsusp_resume_device = res; |
390 | up(&pm_sem); | 390 | mutex_unlock(&pm_mutex); |
391 | printk("Attempting manual resume\n"); | 391 | printk("Attempting manual resume\n"); |
392 | noresume = 0; | 392 | noresume = 0; |
393 | software_resume(); | 393 | software_resume(); |