[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
@@ -79,10 +79,10 @@ static int snapshot_release(struct inode *inode, struct file *filp)
|
||||
free_all_swap_pages(data->swap, data->bitmap);
|
||||
free_bitmap(data->bitmap);
|
||||
if (data->frozen) {
|
||||
down(&pm_sem);
|
||||
mutex_lock(&pm_mutex);
|
||||
thaw_processes();
|
||||
enable_nonboot_cpus();
|
||||
up(&pm_sem);
|
||||
mutex_unlock(&pm_mutex);
|
||||
}
|
||||
atomic_inc(&device_available);
|
||||
return 0;
|
||||
@@ -144,7 +144,7 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp,
|
||||
case SNAPSHOT_FREEZE:
|
||||
if (data->frozen)
|
||||
break;
|
||||
down(&pm_sem);
|
||||
mutex_lock(&pm_mutex);
|
||||
error = disable_nonboot_cpus();
|
||||
if (!error) {
|
||||
error = freeze_processes();
|
||||
@@ -154,7 +154,7 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp,
|
||||
error = -EBUSY;
|
||||
}
|
||||
}
|
||||
up(&pm_sem);
|
||||
mutex_unlock(&pm_mutex);
|
||||
if (!error)
|
||||
data->frozen = 1;
|
||||
break;
|
||||
@@ -162,10 +162,10 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp,
|
||||
case SNAPSHOT_UNFREEZE:
|
||||
if (!data->frozen)
|
||||
break;
|
||||
down(&pm_sem);
|
||||
mutex_lock(&pm_mutex);
|
||||
thaw_processes();
|
||||
enable_nonboot_cpus();
|
||||
up(&pm_sem);
|
||||
mutex_unlock(&pm_mutex);
|
||||
data->frozen = 0;
|
||||
break;
|
||||
|
||||
@@ -174,7 +174,7 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp,
|
||||
error = -EPERM;
|
||||
break;
|
||||
}
|
||||
down(&pm_sem);
|
||||
mutex_lock(&pm_mutex);
|
||||
/* Free memory before shutting down devices. */
|
||||
error = swsusp_shrink_memory();
|
||||
if (!error) {
|
||||
@@ -187,7 +187,7 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp,
|
||||
}
|
||||
resume_console();
|
||||
}
|
||||
up(&pm_sem);
|
||||
mutex_unlock(&pm_mutex);
|
||||
if (!error)
|
||||
error = put_user(in_suspend, (unsigned int __user *)arg);
|
||||
if (!error)
|
||||
@@ -201,7 +201,7 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp,
|
||||
error = -EPERM;
|
||||
break;
|
||||
}
|
||||
down(&pm_sem);
|
||||
mutex_lock(&pm_mutex);
|
||||
pm_prepare_console();
|
||||
suspend_console();
|
||||
error = device_suspend(PMSG_PRETHAW);
|
||||
@@ -211,7 +211,7 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp,
|
||||
}
|
||||
resume_console();
|
||||
pm_restore_console();
|
||||
up(&pm_sem);
|
||||
mutex_unlock(&pm_mutex);
|
||||
break;
|
||||
|
||||
case SNAPSHOT_FREE:
|
||||
@@ -286,7 +286,7 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp,
|
||||
break;
|
||||
}
|
||||
|
||||
if (down_trylock(&pm_sem)) {
|
||||
if (!mutex_trylock(&pm_mutex)) {
|
||||
error = -EBUSY;
|
||||
break;
|
||||
}
|
||||
@@ -314,7 +314,7 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp,
|
||||
pm_ops->finish(PM_SUSPEND_MEM);
|
||||
|
||||
OutS3:
|
||||
up(&pm_sem);
|
||||
mutex_unlock(&pm_mutex);
|
||||
break;
|
||||
|
||||
case SNAPSHOT_PMOPS:
|
||||
|
Reference in New Issue
Block a user