[PATCH 1/6] Hibernation: Introduce new system state for the last phase of hibernation

From: Rafael J. Wysocki
Date: Mon Sep 29 2008 - 18:16:48 EST


From: Rafael J. Wysocki <rjw@xxxxxxx>

Hibernation: Introduce new system state for the last phase of hibernation

Replace unused SYSTEM_SUSPEND_DISK with a new system_state value
SYSTEM_HIBERNATE_ENTER that can be used by device drivers to check if
the system is in the last phase of hibernation.

In particular, some SATA drivers are going to use it for blacklisting
systems in which the disks should not be spun down during the last
phase of hibernation (the BIOS will do that anyway).

Signed-off-by: Rafael J. Wysocki <rjw@xxxxxxx>
---
include/linux/kernel.h | 2 +-
kernel/power/disk.c | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)

Index: linux-2.6/kernel/power/disk.c
===================================================================
--- linux-2.6.orig/kernel/power/disk.c
+++ linux-2.6/kernel/power/disk.c
@@ -416,6 +416,7 @@ int hibernation_platform_enter(void)
if (error)
goto Close;

+ system_state = SYSTEM_HIBERNATE_ENTER;
suspend_console();
ftrace_save = __ftrace_enabled_save();
error = device_suspend(PMSG_HIBERNATE);
@@ -451,6 +452,7 @@ int hibernation_platform_enter(void)
Finish:
hibernation_ops->finish();
Resume_devices:
+ system_state = SYSTEM_RUNNING;
device_resume(PMSG_RESTORE);
__ftrace_enabled_restore(ftrace_save);
resume_console();
Index: linux-2.6/include/linux/kernel.h
===================================================================
--- linux-2.6.orig/include/linux/kernel.h
+++ linux-2.6/include/linux/kernel.h
@@ -247,7 +247,7 @@ extern enum system_states {
SYSTEM_HALT,
SYSTEM_POWER_OFF,
SYSTEM_RESTART,
- SYSTEM_SUSPEND_DISK,
+ SYSTEM_HIBERNATE_ENTER,
} system_state;

#define TAINT_PROPRIETARY_MODULE (1<<0)

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/