diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2007-05-09 05:33:18 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-09 15:30:48 -0400 |
commit | a3d25c275d383975504dc53c25b691df59bd3c48 (patch) | |
tree | 161a2ae12a20a630c2f639e144872db2b92eb098 /include/linux/pm.h | |
parent | d60846c4d16f9518b098b905af2b87cb6bf6dc42 (diff) |
PM: Separate hibernation code from suspend code
[ With Johannes Berg <johannes@sipsolutions.net> ]
Separate the hibernation (aka suspend to disk code) from the other suspend
code. In particular:
* Remove the definitions related to hibernation from include/linux/pm.h
* Introduce struct hibernation_ops and a new hibernate() function to hibernate
the system, defined in include/linux/suspend.h
* Separate suspend code in kernel/power/main.c from hibernation-related code
in kernel/power/disk.c and kernel/power/user.c (with the help of
hibernation_ops)
* Switch ACPI (the only user of pm_ops.pm_disk_mode) to hibernation_ops
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Cc: Greg KH <greg@kroah.com>
Cc: Pavel Machek <pavel@ucw.cz>
Cc: Nigel Cunningham <nigel@nigel.suspend2.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/pm.h')
-rw-r--r-- | include/linux/pm.h | 31 |
1 files changed, 1 insertions, 30 deletions
diff --git a/include/linux/pm.h b/include/linux/pm.h index 6e8fa3049e5d..87545e0f0b58 100644 --- a/include/linux/pm.h +++ b/include/linux/pm.h | |||
@@ -107,26 +107,11 @@ typedef int __bitwise suspend_state_t; | |||
107 | #define PM_SUSPEND_ON ((__force suspend_state_t) 0) | 107 | #define PM_SUSPEND_ON ((__force suspend_state_t) 0) |
108 | #define PM_SUSPEND_STANDBY ((__force suspend_state_t) 1) | 108 | #define PM_SUSPEND_STANDBY ((__force suspend_state_t) 1) |
109 | #define PM_SUSPEND_MEM ((__force suspend_state_t) 3) | 109 | #define PM_SUSPEND_MEM ((__force suspend_state_t) 3) |
110 | #define PM_SUSPEND_DISK ((__force suspend_state_t) 4) | 110 | #define PM_SUSPEND_MAX ((__force suspend_state_t) 4) |
111 | #define PM_SUSPEND_MAX ((__force suspend_state_t) 5) | ||
112 | |||
113 | typedef int __bitwise suspend_disk_method_t; | ||
114 | |||
115 | /* invalid must be 0 so struct pm_ops initialisers can leave it out */ | ||
116 | #define PM_DISK_INVALID ((__force suspend_disk_method_t) 0) | ||
117 | #define PM_DISK_PLATFORM ((__force suspend_disk_method_t) 1) | ||
118 | #define PM_DISK_SHUTDOWN ((__force suspend_disk_method_t) 2) | ||
119 | #define PM_DISK_REBOOT ((__force suspend_disk_method_t) 3) | ||
120 | #define PM_DISK_TEST ((__force suspend_disk_method_t) 4) | ||
121 | #define PM_DISK_TESTPROC ((__force suspend_disk_method_t) 5) | ||
122 | #define PM_DISK_MAX ((__force suspend_disk_method_t) 6) | ||
123 | 111 | ||
124 | /** | 112 | /** |
125 | * struct pm_ops - Callbacks for managing platform dependent suspend states. | 113 | * struct pm_ops - Callbacks for managing platform dependent suspend states. |
126 | * @valid: Callback to determine whether the given state can be entered. | 114 | * @valid: Callback to determine whether the given state can be entered. |
127 | * If %CONFIG_SOFTWARE_SUSPEND is set then %PM_SUSPEND_DISK is | ||
128 | * always valid and never passed to this call. If not assigned, | ||
129 | * no suspend states are valid. | ||
130 | * Valid states are advertised in /sys/power/state but can still | 115 | * Valid states are advertised in /sys/power/state but can still |
131 | * be rejected by prepare or enter if the conditions aren't right. | 116 | * be rejected by prepare or enter if the conditions aren't right. |
132 | * There is a %pm_valid_only_mem function available that can be assigned | 117 | * There is a %pm_valid_only_mem function available that can be assigned |
@@ -140,24 +125,12 @@ typedef int __bitwise suspend_disk_method_t; | |||
140 | * | 125 | * |
141 | * @finish: Called when the system has left the given state and all devices | 126 | * @finish: Called when the system has left the given state and all devices |
142 | * are resumed. The return value is ignored. | 127 | * are resumed. The return value is ignored. |
143 | * | ||
144 | * @pm_disk_mode: The generic code always allows one of the shutdown methods | ||
145 | * %PM_DISK_SHUTDOWN, %PM_DISK_REBOOT, %PM_DISK_TEST and | ||
146 | * %PM_DISK_TESTPROC. If this variable is set, the mode it is set | ||
147 | * to is allowed in addition to those modes and is also made default. | ||
148 | * When this mode is sent selected, the @prepare call will be called | ||
149 | * before suspending to disk (if present), the @enter call should be | ||
150 | * present and will be called after all state has been saved and the | ||
151 | * machine is ready to be powered off; the @finish callback is called | ||
152 | * after state has been restored. All these calls are called with | ||
153 | * %PM_SUSPEND_DISK as the state. | ||
154 | */ | 128 | */ |
155 | struct pm_ops { | 129 | struct pm_ops { |
156 | int (*valid)(suspend_state_t state); | 130 | int (*valid)(suspend_state_t state); |
157 | int (*prepare)(suspend_state_t state); | 131 | int (*prepare)(suspend_state_t state); |
158 | int (*enter)(suspend_state_t state); | 132 | int (*enter)(suspend_state_t state); |
159 | int (*finish)(suspend_state_t state); | 133 | int (*finish)(suspend_state_t state); |
160 | suspend_disk_method_t pm_disk_mode; | ||
161 | }; | 134 | }; |
162 | 135 | ||
163 | /** | 136 | /** |
@@ -276,8 +249,6 @@ extern void device_power_up(void); | |||
276 | extern void device_resume(void); | 249 | extern void device_resume(void); |
277 | 250 | ||
278 | #ifdef CONFIG_PM | 251 | #ifdef CONFIG_PM |
279 | extern suspend_disk_method_t pm_disk_mode; | ||
280 | |||
281 | extern int device_suspend(pm_message_t state); | 252 | extern int device_suspend(pm_message_t state); |
282 | extern int device_prepare_suspend(pm_message_t state); | 253 | extern int device_prepare_suspend(pm_message_t state); |
283 | 254 | ||