aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorAlexey Starikovskiy <alexey.y.starikovskiy@intel.com>2005-12-01 04:29:00 -0500
committerLen Brown <len.brown@intel.com>2005-12-15 13:28:14 -0500
commit729b4d4ce1982c52040bbf22d6711cdf8db07ad8 (patch)
tree1ae8b12dcbcd17c364f2df28db8ab3db9c8b89a2 /kernel
parent7116317dc9148d783846299fc80a7d377baa6dca (diff)
[ACPI] fix reboot upon suspend-to-disk
http://bugzilla.kernel.org/show_bug.cgi?id=4320 Signed-off-by: Alexey Starikovskiy <alexey.y.starikovskiy@intel.com> Acked-by: Pavel Machek <pavel@suse.cz> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/power/disk.c9
-rw-r--r--kernel/sys.c25
2 files changed, 11 insertions, 23 deletions
diff --git a/kernel/power/disk.c b/kernel/power/disk.c
index 027322a564f4..f2cd279d07c7 100644
--- a/kernel/power/disk.c
+++ b/kernel/power/disk.c
@@ -52,7 +52,7 @@ static void power_down(suspend_disk_method_t mode)
52 52
53 switch(mode) { 53 switch(mode) {
54 case PM_DISK_PLATFORM: 54 case PM_DISK_PLATFORM:
55 kernel_power_off_prepare(); 55 kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
56 error = pm_ops->enter(PM_SUSPEND_DISK); 56 error = pm_ops->enter(PM_SUSPEND_DISK);
57 break; 57 break;
58 case PM_DISK_SHUTDOWN: 58 case PM_DISK_SHUTDOWN:
@@ -119,13 +119,6 @@ static int prepare_processes(void)
119 goto thaw; 119 goto thaw;
120 } 120 }
121 121
122 if (pm_disk_mode == PM_DISK_PLATFORM) {
123 if (pm_ops && pm_ops->prepare) {
124 if ((error = pm_ops->prepare(PM_SUSPEND_DISK)))
125 goto thaw;
126 }
127 }
128
129 /* Free memory before shutting down devices. */ 122 /* Free memory before shutting down devices. */
130 free_some_memory(); 123 free_some_memory();
131 return 0; 124 return 0;
diff --git a/kernel/sys.c b/kernel/sys.c
index eecf84526afe..c3b1874661fa 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -427,23 +427,25 @@ void kernel_kexec(void)
427} 427}
428EXPORT_SYMBOL_GPL(kernel_kexec); 428EXPORT_SYMBOL_GPL(kernel_kexec);
429 429
430void kernel_shutdown_prepare(enum system_states state)
431{
432 notifier_call_chain(&reboot_notifier_list,
433 (state == SYSTEM_HALT)?SYS_HALT:SYS_POWER_OFF, NULL);
434 system_state = state;
435 device_shutdown();
436}
430/** 437/**
431 * kernel_halt - halt the system 438 * kernel_halt - halt the system
432 * 439 *
433 * Shutdown everything and perform a clean system halt. 440 * Shutdown everything and perform a clean system halt.
434 */ 441 */
435void kernel_halt_prepare(void)
436{
437 notifier_call_chain(&reboot_notifier_list, SYS_HALT, NULL);
438 system_state = SYSTEM_HALT;
439 device_shutdown();
440}
441void kernel_halt(void) 442void kernel_halt(void)
442{ 443{
443 kernel_halt_prepare(); 444 kernel_shutdown_prepare(SYSTEM_HALT);
444 printk(KERN_EMERG "System halted.\n"); 445 printk(KERN_EMERG "System halted.\n");
445 machine_halt(); 446 machine_halt();
446} 447}
448
447EXPORT_SYMBOL_GPL(kernel_halt); 449EXPORT_SYMBOL_GPL(kernel_halt);
448 450
449/** 451/**
@@ -451,20 +453,13 @@ EXPORT_SYMBOL_GPL(kernel_halt);
451 * 453 *
452 * Shutdown everything and perform a clean system power_off. 454 * Shutdown everything and perform a clean system power_off.
453 */ 455 */
454void kernel_power_off_prepare(void)
455{
456 notifier_call_chain(&reboot_notifier_list, SYS_POWER_OFF, NULL);
457 system_state = SYSTEM_POWER_OFF;
458 device_shutdown();
459}
460void kernel_power_off(void) 456void kernel_power_off(void)
461{ 457{
462 kernel_power_off_prepare(); 458 kernel_shutdown_prepare(SYSTEM_POWER_OFF);
463 printk(KERN_EMERG "Power down.\n"); 459 printk(KERN_EMERG "Power down.\n");
464 machine_power_off(); 460 machine_power_off();
465} 461}
466EXPORT_SYMBOL_GPL(kernel_power_off); 462EXPORT_SYMBOL_GPL(kernel_power_off);
467
468/* 463/*
469 * Reboot system call: for obvious reasons only root may call it, 464 * Reboot system call: for obvious reasons only root may call it,
470 * and even root needs to set up some magic numbers in the registers 465 * and even root needs to set up some magic numbers in the registers