[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>
This commit is contained in:
committed by
Linus Torvalds
parent
3eb1b3a407
commit
a6d7098060
@@ -25,7 +25,7 @@
|
||||
/*This is just an arbitrary number */
|
||||
#define FREE_PAGE_NUMBER (100)
|
||||
|
||||
DECLARE_MUTEX(pm_sem);
|
||||
DEFINE_MUTEX(pm_mutex);
|
||||
|
||||
struct pm_ops *pm_ops;
|
||||
suspend_disk_method_t pm_disk_mode = PM_DISK_SHUTDOWN;
|
||||
@@ -37,9 +37,9 @@ suspend_disk_method_t pm_disk_mode = PM_DISK_SHUTDOWN;
|
||||
|
||||
void pm_set_ops(struct pm_ops * ops)
|
||||
{
|
||||
down(&pm_sem);
|
||||
mutex_lock(&pm_mutex);
|
||||
pm_ops = ops;
|
||||
up(&pm_sem);
|
||||
mutex_unlock(&pm_mutex);
|
||||
}
|
||||
|
||||
|
||||
@@ -183,7 +183,7 @@ static int enter_state(suspend_state_t state)
|
||||
|
||||
if (!valid_state(state))
|
||||
return -ENODEV;
|
||||
if (down_trylock(&pm_sem))
|
||||
if (!mutex_trylock(&pm_mutex))
|
||||
return -EBUSY;
|
||||
|
||||
if (state == PM_SUSPEND_DISK) {
|
||||
@@ -201,7 +201,7 @@ static int enter_state(suspend_state_t state)
|
||||
pr_debug("PM: Finishing wakeup.\n");
|
||||
suspend_finish(state);
|
||||
Unlock:
|
||||
up(&pm_sem);
|
||||
mutex_unlock(&pm_mutex);
|
||||
return error;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user