aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/power/user.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/power/user.c')
-rw-r--r--kernel/power/user.c38
1 files changed, 5 insertions, 33 deletions
diff --git a/kernel/power/user.c b/kernel/power/user.c
index 7f19afe01b48..bd0723a7df3f 100644
--- a/kernel/power/user.c
+++ b/kernel/power/user.c
@@ -255,47 +255,19 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp,
255 break; 255 break;
256 256
257 case SNAPSHOT_S2RAM: 257 case SNAPSHOT_S2RAM:
258 if (!pm_ops) {
259 error = -ENOSYS;
260 break;
261 }
262
263 if (!data->frozen) { 258 if (!data->frozen) {
264 error = -EPERM; 259 error = -EPERM;
265 break; 260 break;
266 } 261 }
267
268 if (!mutex_trylock(&pm_mutex)) { 262 if (!mutex_trylock(&pm_mutex)) {
269 error = -EBUSY; 263 error = -EBUSY;
270 break; 264 break;
271 } 265 }
272 266 /*
273 if (pm_ops->prepare) { 267 * Tasks are frozen and the notifiers have been called with
274 error = pm_ops->prepare(PM_SUSPEND_MEM); 268 * PM_HIBERNATION_PREPARE
275 if (error) 269 */
276 goto OutS3; 270 error = suspend_devices_and_enter(PM_SUSPEND_MEM);
277 }
278
279 /* Put devices to sleep */
280 suspend_console();
281 error = device_suspend(PMSG_SUSPEND);
282 if (error) {
283 printk(KERN_ERR "Failed to suspend some devices.\n");
284 } else {
285 error = disable_nonboot_cpus();
286 if (!error) {
287 /* Enter S3, system is already frozen */
288 suspend_enter(PM_SUSPEND_MEM);
289 enable_nonboot_cpus();
290 }
291 /* Wake up devices */
292 device_resume();
293 }
294 resume_console();
295 if (pm_ops->finish)
296 pm_ops->finish(PM_SUSPEND_MEM);
297
298 OutS3:
299 mutex_unlock(&pm_mutex); 271 mutex_unlock(&pm_mutex);
300 break; 272 break;
301 273