aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/power/disk.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/power/disk.c')
-rw-r--r--kernel/power/disk.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/kernel/power/disk.c b/kernel/power/disk.c
index bbd85c60f74..f77d3819ef5 100644
--- a/kernel/power/disk.c
+++ b/kernel/power/disk.c
@@ -14,6 +14,7 @@
14#include <linux/reboot.h> 14#include <linux/reboot.h>
15#include <linux/string.h> 15#include <linux/string.h>
16#include <linux/device.h> 16#include <linux/device.h>
17#include <linux/kmod.h>
17#include <linux/delay.h> 18#include <linux/delay.h>
18#include <linux/fs.h> 19#include <linux/fs.h>
19#include <linux/mount.h> 20#include <linux/mount.h>
@@ -21,7 +22,6 @@
21#include <linux/console.h> 22#include <linux/console.h>
22#include <linux/cpu.h> 23#include <linux/cpu.h>
23#include <linux/freezer.h> 24#include <linux/freezer.h>
24#include <linux/ftrace.h>
25 25
26#include "power.h" 26#include "power.h"
27 27
@@ -256,7 +256,7 @@ static int create_image(int platform_mode)
256 256
257int hibernation_snapshot(int platform_mode) 257int hibernation_snapshot(int platform_mode)
258{ 258{
259 int error, ftrace_save; 259 int error;
260 260
261 /* Free memory before shutting down devices. */ 261 /* Free memory before shutting down devices. */
262 error = swsusp_shrink_memory(); 262 error = swsusp_shrink_memory();
@@ -268,7 +268,6 @@ int hibernation_snapshot(int platform_mode)
268 goto Close; 268 goto Close;
269 269
270 suspend_console(); 270 suspend_console();
271 ftrace_save = __ftrace_enabled_save();
272 error = device_suspend(PMSG_FREEZE); 271 error = device_suspend(PMSG_FREEZE);
273 if (error) 272 if (error)
274 goto Recover_platform; 273 goto Recover_platform;
@@ -298,7 +297,6 @@ int hibernation_snapshot(int platform_mode)
298 Resume_devices: 297 Resume_devices:
299 device_resume(in_suspend ? 298 device_resume(in_suspend ?
300 (error ? PMSG_RECOVER : PMSG_THAW) : PMSG_RESTORE); 299 (error ? PMSG_RECOVER : PMSG_THAW) : PMSG_RESTORE);
301 __ftrace_enabled_restore(ftrace_save);
302 resume_console(); 300 resume_console();
303 Close: 301 Close:
304 platform_end(platform_mode); 302 platform_end(platform_mode);
@@ -369,11 +367,10 @@ static int resume_target_kernel(void)
369 367
370int hibernation_restore(int platform_mode) 368int hibernation_restore(int platform_mode)
371{ 369{
372 int error, ftrace_save; 370 int error;
373 371
374 pm_prepare_console(); 372 pm_prepare_console();
375 suspend_console(); 373 suspend_console();
376 ftrace_save = __ftrace_enabled_save();
377 error = device_suspend(PMSG_QUIESCE); 374 error = device_suspend(PMSG_QUIESCE);
378 if (error) 375 if (error)
379 goto Finish; 376 goto Finish;
@@ -388,7 +385,6 @@ int hibernation_restore(int platform_mode)
388 platform_restore_cleanup(platform_mode); 385 platform_restore_cleanup(platform_mode);
389 device_resume(PMSG_RECOVER); 386 device_resume(PMSG_RECOVER);
390 Finish: 387 Finish:
391 __ftrace_enabled_restore(ftrace_save);
392 resume_console(); 388 resume_console();
393 pm_restore_console(); 389 pm_restore_console();
394 return error; 390 return error;
@@ -401,7 +397,7 @@ int hibernation_restore(int platform_mode)
401 397
402int hibernation_platform_enter(void) 398int hibernation_platform_enter(void)
403{ 399{
404 int error, ftrace_save; 400 int error;
405 401
406 if (!hibernation_ops) 402 if (!hibernation_ops)
407 return -ENOSYS; 403 return -ENOSYS;
@@ -416,7 +412,6 @@ int hibernation_platform_enter(void)
416 goto Close; 412 goto Close;
417 413
418 suspend_console(); 414 suspend_console();
419 ftrace_save = __ftrace_enabled_save();
420 error = device_suspend(PMSG_HIBERNATE); 415 error = device_suspend(PMSG_HIBERNATE);
421 if (error) { 416 if (error) {
422 if (hibernation_ops->recover) 417 if (hibernation_ops->recover)
@@ -451,7 +446,6 @@ int hibernation_platform_enter(void)
451 hibernation_ops->finish(); 446 hibernation_ops->finish();
452 Resume_devices: 447 Resume_devices:
453 device_resume(PMSG_RESTORE); 448 device_resume(PMSG_RESTORE);
454 __ftrace_enabled_restore(ftrace_save);
455 resume_console(); 449 resume_console();
456 Close: 450 Close:
457 hibernation_ops->end(); 451 hibernation_ops->end();
@@ -520,6 +514,10 @@ int hibernate(void)
520 if (error) 514 if (error)
521 goto Exit; 515 goto Exit;
522 516
517 error = usermodehelper_disable();
518 if (error)
519 goto Exit;
520
523 /* Allocate memory management structures */ 521 /* Allocate memory management structures */
524 error = create_basic_memory_bitmaps(); 522 error = create_basic_memory_bitmaps();
525 if (error) 523 if (error)
@@ -558,6 +556,7 @@ int hibernate(void)
558 thaw_processes(); 556 thaw_processes();
559 Finish: 557 Finish:
560 free_basic_memory_bitmaps(); 558 free_basic_memory_bitmaps();
559 usermodehelper_enable();
561 Exit: 560 Exit:
562 pm_notifier_call_chain(PM_POST_HIBERNATION); 561 pm_notifier_call_chain(PM_POST_HIBERNATION);
563 pm_restore_console(); 562 pm_restore_console();
@@ -634,6 +633,10 @@ static int software_resume(void)
634 if (error) 633 if (error)
635 goto Finish; 634 goto Finish;
636 635
636 error = usermodehelper_disable();
637 if (error)
638 goto Finish;
639
637 error = create_basic_memory_bitmaps(); 640 error = create_basic_memory_bitmaps();
638 if (error) 641 if (error)
639 goto Finish; 642 goto Finish;
@@ -641,7 +644,7 @@ static int software_resume(void)
641 pr_debug("PM: Preparing processes for restore.\n"); 644 pr_debug("PM: Preparing processes for restore.\n");
642 error = prepare_processes(); 645 error = prepare_processes();
643 if (error) { 646 if (error) {
644 swsusp_close(); 647 swsusp_close(FMODE_READ);
645 goto Done; 648 goto Done;
646 } 649 }
647 650
@@ -656,6 +659,7 @@ static int software_resume(void)
656 thaw_processes(); 659 thaw_processes();
657 Done: 660 Done:
658 free_basic_memory_bitmaps(); 661 free_basic_memory_bitmaps();
662 usermodehelper_enable();
659 Finish: 663 Finish:
660 pm_notifier_call_chain(PM_POST_RESTORE); 664 pm_notifier_call_chain(PM_POST_RESTORE);
661 pm_restore_console(); 665 pm_restore_console();