diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2007-07-29 17:27:18 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-29 19:45:38 -0400 |
commit | 296699de6bdc717189a331ab6bbe90e05c94db06 (patch) | |
tree | 53c847ecc8cce11952502921844052e44ca60d5e /include/linux/pm.h | |
parent | b0cb1a19d05b8ea8611a9ef48a17fe417f1832e6 (diff) |
Introduce CONFIG_SUSPEND for suspend-to-Ram and standby
Introduce CONFIG_SUSPEND representing the ability to enter system sleep
states, such as the ACPI S3 state, and allow the user to choose SUSPEND
and HIBERNATION independently of each other.
Make HOTPLUG_CPU be selected automatically if SUSPEND or HIBERNATION has
been chosen and the kernel is intended for SMP systems.
Also, introduce CONFIG_PM_SLEEP which is automatically selected if
CONFIG_SUSPEND or CONFIG_HIBERNATION is set and use it to select the
code needed for both suspend and hibernation.
The top-level power management headers and the ACPI code related to
suspend and hibernation are modified to use the new definitions (the
changes in drivers/acpi/sleep/main.c are, mostly, moving code to reduce
the number of ifdefs).
There are many other files in which CONFIG_PM can be replaced with
CONFIG_PM_SLEEP or even with CONFIG_SUSPEND, but they can be updated in
the future.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/pm.h')
-rw-r--r-- | include/linux/pm.h | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/include/linux/pm.h b/include/linux/pm.h index ad3cc2eb0d34..e52f6f83c061 100644 --- a/include/linux/pm.h +++ b/include/linux/pm.h | |||
@@ -165,6 +165,7 @@ struct pm_ops { | |||
165 | int (*finish)(suspend_state_t state); | 165 | int (*finish)(suspend_state_t state); |
166 | }; | 166 | }; |
167 | 167 | ||
168 | #ifdef CONFIG_SUSPEND | ||
168 | extern struct pm_ops *pm_ops; | 169 | extern struct pm_ops *pm_ops; |
169 | 170 | ||
170 | /** | 171 | /** |
@@ -193,6 +194,12 @@ extern void arch_suspend_disable_irqs(void); | |||
193 | extern void arch_suspend_enable_irqs(void); | 194 | extern void arch_suspend_enable_irqs(void); |
194 | 195 | ||
195 | extern int pm_suspend(suspend_state_t state); | 196 | extern int pm_suspend(suspend_state_t state); |
197 | #else /* !CONFIG_SUSPEND */ | ||
198 | #define suspend_valid_only_mem NULL | ||
199 | |||
200 | static inline void pm_set_ops(struct pm_ops *pm_ops) {} | ||
201 | static inline int pm_suspend(suspend_state_t state) { return -ENOSYS; } | ||
202 | #endif /* !CONFIG_SUSPEND */ | ||
196 | 203 | ||
197 | /* | 204 | /* |
198 | * Device power management | 205 | * Device power management |
@@ -266,7 +273,7 @@ typedef struct pm_message { | |||
266 | struct dev_pm_info { | 273 | struct dev_pm_info { |
267 | pm_message_t power_state; | 274 | pm_message_t power_state; |
268 | unsigned can_wakeup:1; | 275 | unsigned can_wakeup:1; |
269 | #ifdef CONFIG_PM | 276 | #ifdef CONFIG_PM_SLEEP |
270 | unsigned should_wakeup:1; | 277 | unsigned should_wakeup:1; |
271 | struct list_head entry; | 278 | struct list_head entry; |
272 | #endif | 279 | #endif |
@@ -276,7 +283,7 @@ extern int device_power_down(pm_message_t state); | |||
276 | extern void device_power_up(void); | 283 | extern void device_power_up(void); |
277 | extern void device_resume(void); | 284 | extern void device_resume(void); |
278 | 285 | ||
279 | #ifdef CONFIG_PM | 286 | #ifdef CONFIG_PM_SLEEP |
280 | extern int device_suspend(pm_message_t state); | 287 | extern int device_suspend(pm_message_t state); |
281 | extern int device_prepare_suspend(pm_message_t state); | 288 | extern int device_prepare_suspend(pm_message_t state); |
282 | 289 | ||
@@ -306,7 +313,7 @@ static inline int call_platform_enable_wakeup(struct device *dev, int is_on) | |||
306 | return 0; | 313 | return 0; |
307 | } | 314 | } |
308 | 315 | ||
309 | #else /* !CONFIG_PM */ | 316 | #else /* !CONFIG_PM_SLEEP */ |
310 | 317 | ||
311 | static inline int device_suspend(pm_message_t state) | 318 | static inline int device_suspend(pm_message_t state) |
312 | { | 319 | { |
@@ -323,7 +330,7 @@ static inline int call_platform_enable_wakeup(struct device *dev, int is_on) | |||
323 | return 0; | 330 | return 0; |
324 | } | 331 | } |
325 | 332 | ||
326 | #endif | 333 | #endif /* !CONFIG_PM_SLEEP */ |
327 | 334 | ||
328 | /* changes to device_may_wakeup take effect on the next pm state change. | 335 | /* changes to device_may_wakeup take effect on the next pm state change. |
329 | * by default, devices should wakeup if they can. | 336 | * by default, devices should wakeup if they can. |