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/user.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/user.c')
-rw-r--r-- | kernel/power/user.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/kernel/power/user.c b/kernel/power/user.c index 26c66941c001..905dc269c3fc 100644 --- a/kernel/power/user.c +++ b/kernel/power/user.c | |||
@@ -79,10 +79,10 @@ static int snapshot_release(struct inode *inode, struct file *filp) | |||
79 | free_all_swap_pages(data->swap, data->bitmap); | 79 | free_all_swap_pages(data->swap, data->bitmap); |
80 | free_bitmap(data->bitmap); | 80 | free_bitmap(data->bitmap); |
81 | if (data->frozen) { | 81 | if (data->frozen) { |
82 | down(&pm_sem); | 82 | mutex_lock(&pm_mutex); |
83 | thaw_processes(); | 83 | thaw_processes(); |
84 | enable_nonboot_cpus(); | 84 | enable_nonboot_cpus(); |
85 | up(&pm_sem); | 85 | mutex_unlock(&pm_mutex); |
86 | } | 86 | } |
87 | atomic_inc(&device_available); | 87 | atomic_inc(&device_available); |
88 | return 0; | 88 | return 0; |
@@ -144,7 +144,7 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp, | |||
144 | case SNAPSHOT_FREEZE: | 144 | case SNAPSHOT_FREEZE: |
145 | if (data->frozen) | 145 | if (data->frozen) |
146 | break; | 146 | break; |
147 | down(&pm_sem); | 147 | mutex_lock(&pm_mutex); |
148 | error = disable_nonboot_cpus(); | 148 | error = disable_nonboot_cpus(); |
149 | if (!error) { | 149 | if (!error) { |
150 | error = freeze_processes(); | 150 | error = freeze_processes(); |
@@ -154,7 +154,7 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp, | |||
154 | error = -EBUSY; | 154 | error = -EBUSY; |
155 | } | 155 | } |
156 | } | 156 | } |
157 | up(&pm_sem); | 157 | mutex_unlock(&pm_mutex); |
158 | if (!error) | 158 | if (!error) |
159 | data->frozen = 1; | 159 | data->frozen = 1; |
160 | break; | 160 | break; |
@@ -162,10 +162,10 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp, | |||
162 | case SNAPSHOT_UNFREEZE: | 162 | case SNAPSHOT_UNFREEZE: |
163 | if (!data->frozen) | 163 | if (!data->frozen) |
164 | break; | 164 | break; |
165 | down(&pm_sem); | 165 | mutex_lock(&pm_mutex); |
166 | thaw_processes(); | 166 | thaw_processes(); |
167 | enable_nonboot_cpus(); | 167 | enable_nonboot_cpus(); |
168 | up(&pm_sem); | 168 | mutex_unlock(&pm_mutex); |
169 | data->frozen = 0; | 169 | data->frozen = 0; |
170 | break; | 170 | break; |
171 | 171 | ||
@@ -174,7 +174,7 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp, | |||
174 | error = -EPERM; | 174 | error = -EPERM; |
175 | break; | 175 | break; |
176 | } | 176 | } |
177 | down(&pm_sem); | 177 | mutex_lock(&pm_mutex); |
178 | /* Free memory before shutting down devices. */ | 178 | /* Free memory before shutting down devices. */ |
179 | error = swsusp_shrink_memory(); | 179 | error = swsusp_shrink_memory(); |
180 | if (!error) { | 180 | if (!error) { |
@@ -187,7 +187,7 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp, | |||
187 | } | 187 | } |
188 | resume_console(); | 188 | resume_console(); |
189 | } | 189 | } |
190 | up(&pm_sem); | 190 | mutex_unlock(&pm_mutex); |
191 | if (!error) | 191 | if (!error) |
192 | error = put_user(in_suspend, (unsigned int __user *)arg); | 192 | error = put_user(in_suspend, (unsigned int __user *)arg); |
193 | if (!error) | 193 | if (!error) |
@@ -201,7 +201,7 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp, | |||
201 | error = -EPERM; | 201 | error = -EPERM; |
202 | break; | 202 | break; |
203 | } | 203 | } |
204 | down(&pm_sem); | 204 | mutex_lock(&pm_mutex); |
205 | pm_prepare_console(); | 205 | pm_prepare_console(); |
206 | suspend_console(); | 206 | suspend_console(); |
207 | error = device_suspend(PMSG_PRETHAW); | 207 | error = device_suspend(PMSG_PRETHAW); |
@@ -211,7 +211,7 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp, | |||
211 | } | 211 | } |
212 | resume_console(); | 212 | resume_console(); |
213 | pm_restore_console(); | 213 | pm_restore_console(); |
214 | up(&pm_sem); | 214 | mutex_unlock(&pm_mutex); |
215 | break; | 215 | break; |
216 | 216 | ||
217 | case SNAPSHOT_FREE: | 217 | case SNAPSHOT_FREE: |
@@ -286,7 +286,7 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp, | |||
286 | break; | 286 | break; |
287 | } | 287 | } |
288 | 288 | ||
289 | if (down_trylock(&pm_sem)) { | 289 | if (!mutex_trylock(&pm_mutex)) { |
290 | error = -EBUSY; | 290 | error = -EBUSY; |
291 | break; | 291 | break; |
292 | } | 292 | } |
@@ -314,7 +314,7 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp, | |||
314 | pm_ops->finish(PM_SUSPEND_MEM); | 314 | pm_ops->finish(PM_SUSPEND_MEM); |
315 | 315 | ||
316 | OutS3: | 316 | OutS3: |
317 | up(&pm_sem); | 317 | mutex_unlock(&pm_mutex); |
318 | break; | 318 | break; |
319 | 319 | ||
320 | case SNAPSHOT_PMOPS: | 320 | case SNAPSHOT_PMOPS: |