aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/suspend.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/suspend.h')
-rw-r--r--include/linux/suspend.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index 1f2f7ba9e709..9c7cb6430666 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -32,6 +32,24 @@ static inline int pm_prepare_console(void) { return 0; }
32static inline void pm_restore_console(void) {} 32static 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 */
47struct 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 */
37extern void __register_nosave_region(unsigned long b, unsigned long e, int km); 55extern void __register_nosave_region(unsigned long b, unsigned long e, int km);
@@ -47,12 +65,18 @@ extern int swsusp_page_is_forbidden(struct page *);
47extern void swsusp_set_page_free(struct page *); 65extern void swsusp_set_page_free(struct page *);
48extern void swsusp_unset_page_free(struct page *); 66extern void swsusp_unset_page_free(struct page *);
49extern unsigned long get_safe_page(gfp_t gfp_mask); 67extern unsigned long get_safe_page(gfp_t gfp_mask);
68
69extern void hibernation_set_ops(struct hibernation_ops *ops);
70extern int hibernate(void);
50#else 71#else
51static inline void register_nosave_region(unsigned long b, unsigned long e) {} 72static inline void register_nosave_region(unsigned long b, unsigned long e) {}
52static inline void register_nosave_region_late(unsigned long b, unsigned long e) {} 73static inline void register_nosave_region_late(unsigned long b, unsigned long e) {}
53static inline int swsusp_page_is_forbidden(struct page *p) { return 0; } 74static inline int swsusp_page_is_forbidden(struct page *p) { return 0; }
54static inline void swsusp_set_page_free(struct page *p) {} 75static inline void swsusp_set_page_free(struct page *p) {}
55static inline void swsusp_unset_page_free(struct page *p) {} 76static inline void swsusp_unset_page_free(struct page *p) {}
77
78static inline void hibernation_set_ops(struct hibernation_ops *ops) {}
79static inline int hibernate(void) { return -ENOSYS; }
56#endif /* defined(CONFIG_PM) && defined(CONFIG_SOFTWARE_SUSPEND) */ 80#endif /* defined(CONFIG_PM) && defined(CONFIG_SOFTWARE_SUSPEND) */
57 81
58void save_processor_state(void); 82void save_processor_state(void);