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/suspend.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/suspend.h')
-rw-r--r-- | include/linux/suspend.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/include/linux/suspend.h b/include/linux/suspend.h index 9d2aa1a12aa0..d74da9122b60 100644 --- a/include/linux/suspend.h +++ b/include/linux/suspend.h | |||
@@ -32,6 +32,24 @@ static inline int pm_prepare_console(void) { return 0; } | |||
32 | static inline void pm_restore_console(void) {} | 32 | static inline void pm_restore_console(void) {} |
33 | #endif | 33 | #endif |
34 | 34 | ||
35 | /** | ||
36 | * struct hibernation_ops - hibernation platform support | ||
37 | * | ||
38 | * The methods in this structure allow a platform to override the default | ||
39 | * mechanism of shutting down the machine during a hibernation transition. | ||
40 | * | ||
41 | * All three methods must be assigned. | ||
42 | * | ||
43 | * @prepare: prepare system for hibernation | ||
44 | * @enter: shut down system after state has been saved to disk | ||
45 | * @finish: finish/clean up after state has been reloaded | ||
46 | */ | ||
47 | struct hibernation_ops { | ||
48 | int (*prepare)(void); | ||
49 | int (*enter)(void); | ||
50 | void (*finish)(void); | ||
51 | }; | ||
52 | |||
35 | #if defined(CONFIG_PM) && defined(CONFIG_SOFTWARE_SUSPEND) | 53 | #if defined(CONFIG_PM) && defined(CONFIG_SOFTWARE_SUSPEND) |
36 | /* kernel/power/snapshot.c */ | 54 | /* kernel/power/snapshot.c */ |
37 | extern void __init register_nosave_region(unsigned long, unsigned long); | 55 | extern void __init register_nosave_region(unsigned long, unsigned long); |
@@ -39,11 +57,17 @@ extern int swsusp_page_is_forbidden(struct page *); | |||
39 | extern void swsusp_set_page_free(struct page *); | 57 | extern void swsusp_set_page_free(struct page *); |
40 | extern void swsusp_unset_page_free(struct page *); | 58 | extern void swsusp_unset_page_free(struct page *); |
41 | extern unsigned long get_safe_page(gfp_t gfp_mask); | 59 | extern unsigned long get_safe_page(gfp_t gfp_mask); |
60 | |||
61 | extern void hibernation_set_ops(struct hibernation_ops *ops); | ||
62 | extern int hibernate(void); | ||
42 | #else | 63 | #else |
43 | static inline void register_nosave_region(unsigned long b, unsigned long e) {} | 64 | static inline void register_nosave_region(unsigned long b, unsigned long e) {} |
44 | static inline int swsusp_page_is_forbidden(struct page *p) { return 0; } | 65 | static inline int swsusp_page_is_forbidden(struct page *p) { return 0; } |
45 | static inline void swsusp_set_page_free(struct page *p) {} | 66 | static inline void swsusp_set_page_free(struct page *p) {} |
46 | static inline void swsusp_unset_page_free(struct page *p) {} | 67 | static inline void swsusp_unset_page_free(struct page *p) {} |
68 | |||
69 | static inline void hibernation_set_ops(struct hibernation_ops *ops) {} | ||
70 | static inline int hibernate(void) { return -ENOSYS; } | ||
47 | #endif /* defined(CONFIG_PM) && defined(CONFIG_SOFTWARE_SUSPEND) */ | 71 | #endif /* defined(CONFIG_PM) && defined(CONFIG_SOFTWARE_SUSPEND) */ |
48 | 72 | ||
49 | void save_processor_state(void); | 73 | void save_processor_state(void); |