diff options
Diffstat (limited to 'include/linux/suspend.h')
-rw-r--r-- | include/linux/suspend.h | 57 |
1 files changed, 51 insertions, 6 deletions
diff --git a/include/linux/suspend.h b/include/linux/suspend.h index 9c7cb6430666..388cace9751f 100644 --- a/include/linux/suspend.h +++ b/include/linux/suspend.h | |||
@@ -24,7 +24,7 @@ struct pbe { | |||
24 | extern void drain_local_pages(void); | 24 | extern void drain_local_pages(void); |
25 | extern void mark_free_pages(struct zone *zone); | 25 | extern void mark_free_pages(struct zone *zone); |
26 | 26 | ||
27 | #if defined(CONFIG_PM) && defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE) | 27 | #if defined(CONFIG_PM_SLEEP) && defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE) |
28 | extern int pm_prepare_console(void); | 28 | extern int pm_prepare_console(void); |
29 | extern void pm_restore_console(void); | 29 | extern void pm_restore_console(void); |
30 | #else | 30 | #else |
@@ -43,14 +43,18 @@ static inline void pm_restore_console(void) {} | |||
43 | * @prepare: prepare system for hibernation | 43 | * @prepare: prepare system for hibernation |
44 | * @enter: shut down system after state has been saved to disk | 44 | * @enter: shut down system after state has been saved to disk |
45 | * @finish: finish/clean up after state has been reloaded | 45 | * @finish: finish/clean up after state has been reloaded |
46 | * @pre_restore: prepare system for the restoration from a hibernation image | ||
47 | * @restore_cleanup: clean up after a failing image restoration | ||
46 | */ | 48 | */ |
47 | struct hibernation_ops { | 49 | struct hibernation_ops { |
48 | int (*prepare)(void); | 50 | int (*prepare)(void); |
49 | int (*enter)(void); | 51 | int (*enter)(void); |
50 | void (*finish)(void); | 52 | void (*finish)(void); |
53 | int (*pre_restore)(void); | ||
54 | void (*restore_cleanup)(void); | ||
51 | }; | 55 | }; |
52 | 56 | ||
53 | #if defined(CONFIG_PM) && defined(CONFIG_SOFTWARE_SUSPEND) | 57 | #ifdef CONFIG_HIBERNATION |
54 | /* kernel/power/snapshot.c */ | 58 | /* kernel/power/snapshot.c */ |
55 | extern void __register_nosave_region(unsigned long b, unsigned long e, int km); | 59 | extern void __register_nosave_region(unsigned long b, unsigned long e, int km); |
56 | static inline void register_nosave_region(unsigned long b, unsigned long e) | 60 | static inline void register_nosave_region(unsigned long b, unsigned long e) |
@@ -68,21 +72,62 @@ extern unsigned long get_safe_page(gfp_t gfp_mask); | |||
68 | 72 | ||
69 | extern void hibernation_set_ops(struct hibernation_ops *ops); | 73 | extern void hibernation_set_ops(struct hibernation_ops *ops); |
70 | extern int hibernate(void); | 74 | extern int hibernate(void); |
71 | #else | 75 | #else /* CONFIG_HIBERNATION */ |
72 | static inline void register_nosave_region(unsigned long b, unsigned long e) {} | ||
73 | static inline void register_nosave_region_late(unsigned long b, unsigned long e) {} | ||
74 | static inline int swsusp_page_is_forbidden(struct page *p) { return 0; } | 76 | static inline int swsusp_page_is_forbidden(struct page *p) { return 0; } |
75 | static inline void swsusp_set_page_free(struct page *p) {} | 77 | static inline void swsusp_set_page_free(struct page *p) {} |
76 | static inline void swsusp_unset_page_free(struct page *p) {} | 78 | static inline void swsusp_unset_page_free(struct page *p) {} |
77 | 79 | ||
78 | static inline void hibernation_set_ops(struct hibernation_ops *ops) {} | 80 | static inline void hibernation_set_ops(struct hibernation_ops *ops) {} |
79 | static inline int hibernate(void) { return -ENOSYS; } | 81 | static inline int hibernate(void) { return -ENOSYS; } |
80 | #endif /* defined(CONFIG_PM) && defined(CONFIG_SOFTWARE_SUSPEND) */ | 82 | #endif /* CONFIG_HIBERNATION */ |
81 | 83 | ||
84 | #ifdef CONFIG_PM_SLEEP | ||
82 | void save_processor_state(void); | 85 | void save_processor_state(void); |
83 | void restore_processor_state(void); | 86 | void restore_processor_state(void); |
84 | struct saved_context; | 87 | struct saved_context; |
85 | void __save_processor_state(struct saved_context *ctxt); | 88 | void __save_processor_state(struct saved_context *ctxt); |
86 | void __restore_processor_state(struct saved_context *ctxt); | 89 | void __restore_processor_state(struct saved_context *ctxt); |
87 | 90 | ||
91 | /* kernel/power/main.c */ | ||
92 | extern struct blocking_notifier_head pm_chain_head; | ||
93 | |||
94 | static inline int register_pm_notifier(struct notifier_block *nb) | ||
95 | { | ||
96 | return blocking_notifier_chain_register(&pm_chain_head, nb); | ||
97 | } | ||
98 | |||
99 | static inline int unregister_pm_notifier(struct notifier_block *nb) | ||
100 | { | ||
101 | return blocking_notifier_chain_unregister(&pm_chain_head, nb); | ||
102 | } | ||
103 | |||
104 | #define pm_notifier(fn, pri) { \ | ||
105 | static struct notifier_block fn##_nb = \ | ||
106 | { .notifier_call = fn, .priority = pri }; \ | ||
107 | register_pm_notifier(&fn##_nb); \ | ||
108 | } | ||
109 | #else /* !CONFIG_PM_SLEEP */ | ||
110 | |||
111 | static inline int register_pm_notifier(struct notifier_block *nb) | ||
112 | { | ||
113 | return 0; | ||
114 | } | ||
115 | |||
116 | static inline int unregister_pm_notifier(struct notifier_block *nb) | ||
117 | { | ||
118 | return 0; | ||
119 | } | ||
120 | |||
121 | #define pm_notifier(fn, pri) do { (void)(fn); } while (0) | ||
122 | #endif /* !CONFIG_PM_SLEEP */ | ||
123 | |||
124 | #ifndef CONFIG_HIBERNATION | ||
125 | static inline void register_nosave_region(unsigned long b, unsigned long e) | ||
126 | { | ||
127 | } | ||
128 | static inline void register_nosave_region_late(unsigned long b, unsigned long e) | ||
129 | { | ||
130 | } | ||
131 | #endif | ||
132 | |||
88 | #endif /* _LINUX_SWSUSP_H */ | 133 | #endif /* _LINUX_SWSUSP_H */ |