aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/power/disk.c9
-rw-r--r--kernel/power/main.c4
-rw-r--r--kernel/sys.c25
3 files changed, 13 insertions, 25 deletions
diff --git a/kernel/power/disk.c b/kernel/power/disk.c
index f2b3b0ea512a..0b43847dc980 100644
--- a/kernel/power/disk.c
+++ b/kernel/power/disk.c
@@ -53,7 +53,7 @@ static void power_down(suspend_disk_method_t mode)
53 53
54 switch(mode) { 54 switch(mode) {
55 case PM_DISK_PLATFORM: 55 case PM_DISK_PLATFORM:
56 kernel_power_off_prepare(); 56 kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
57 error = pm_ops->enter(PM_SUSPEND_DISK); 57 error = pm_ops->enter(PM_SUSPEND_DISK);
58 break; 58 break;
59 case PM_DISK_SHUTDOWN: 59 case PM_DISK_SHUTDOWN:
@@ -95,13 +95,6 @@ static int prepare_processes(void)
95 goto thaw; 95 goto thaw;
96 } 96 }
97 97
98 if (pm_disk_mode == PM_DISK_PLATFORM) {
99 if (pm_ops && pm_ops->prepare) {
100 if ((error = pm_ops->prepare(PM_SUSPEND_DISK)))
101 goto thaw;
102 }
103 }
104
105 /* Free memory before shutting down devices. */ 98 /* Free memory before shutting down devices. */
106 if (!(error = swsusp_shrink_memory())) 99 if (!(error = swsusp_shrink_memory()))
107 return 0; 100 return 0;
diff --git a/kernel/power/main.c b/kernel/power/main.c
index d253f3ae2fa5..9cb235cba4a9 100644
--- a/kernel/power/main.c
+++ b/kernel/power/main.c
@@ -133,10 +133,10 @@ static int suspend_enter(suspend_state_t state)
133static void suspend_finish(suspend_state_t state) 133static void suspend_finish(suspend_state_t state)
134{ 134{
135 device_resume(); 135 device_resume();
136 if (pm_ops && pm_ops->finish)
137 pm_ops->finish(state);
138 thaw_processes(); 136 thaw_processes();
139 enable_nonboot_cpus(); 137 enable_nonboot_cpus();
138 if (pm_ops && pm_ops->finish)
139 pm_ops->finish(state);
140 pm_restore_console(); 140 pm_restore_console();
141} 141}
142 142
diff --git a/kernel/sys.c b/kernel/sys.c
index d09cac23fdfd..0929c698affc 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -440,23 +440,25 @@ void kernel_kexec(void)
440} 440}
441EXPORT_SYMBOL_GPL(kernel_kexec); 441EXPORT_SYMBOL_GPL(kernel_kexec);
442 442
443void kernel_shutdown_prepare(enum system_states state)
444{
445 notifier_call_chain(&reboot_notifier_list,
446 (state == SYSTEM_HALT)?SYS_HALT:SYS_POWER_OFF, NULL);
447 system_state = state;
448 device_shutdown();
449}
443/** 450/**
444 * kernel_halt - halt the system 451 * kernel_halt - halt the system
445 * 452 *
446 * Shutdown everything and perform a clean system halt. 453 * Shutdown everything and perform a clean system halt.
447 */ 454 */
448void kernel_halt_prepare(void)
449{
450 notifier_call_chain(&reboot_notifier_list, SYS_HALT, NULL);
451 system_state = SYSTEM_HALT;
452 device_shutdown();
453}
454void kernel_halt(void) 455void kernel_halt(void)
455{ 456{
456 kernel_halt_prepare(); 457 kernel_shutdown_prepare(SYSTEM_HALT);
457 printk(KERN_EMERG "System halted.\n"); 458 printk(KERN_EMERG "System halted.\n");
458 machine_halt(); 459 machine_halt();
459} 460}
461
460EXPORT_SYMBOL_GPL(kernel_halt); 462EXPORT_SYMBOL_GPL(kernel_halt);
461 463
462/** 464/**
@@ -464,20 +466,13 @@ EXPORT_SYMBOL_GPL(kernel_halt);
464 * 466 *
465 * Shutdown everything and perform a clean system power_off. 467 * Shutdown everything and perform a clean system power_off.
466 */ 468 */
467void kernel_power_off_prepare(void)
468{
469 notifier_call_chain(&reboot_notifier_list, SYS_POWER_OFF, NULL);
470 system_state = SYSTEM_POWER_OFF;
471 device_shutdown();
472}
473void kernel_power_off(void) 469void kernel_power_off(void)
474{ 470{
475 kernel_power_off_prepare(); 471 kernel_shutdown_prepare(SYSTEM_POWER_OFF);
476 printk(KERN_EMERG "Power down.\n"); 472 printk(KERN_EMERG "Power down.\n");
477 machine_power_off(); 473 machine_power_off();
478} 474}
479EXPORT_SYMBOL_GPL(kernel_power_off); 475EXPORT_SYMBOL_GPL(kernel_power_off);
480
481/* 476/*
482 * Reboot system call: for obvious reasons only root may call it, 477 * Reboot system call: for obvious reasons only root may call it,
483 * and even root needs to set up some magic numbers in the registers 478 * and even root needs to set up some magic numbers in the registers