Commit 073ef1f6 authored by Lionel Debroux's avatar Lionel Debroux Committed by Jiri Kosina

hibernation: constify platform_hibernation_ops

Patch against mainline.

Changes since v1: added one hunk; no longer adding "const" qualifier to
pointers in platform_hibernation_ops after seeing
b4144e4f.
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent c996d8b9
...@@ -498,7 +498,7 @@ static void acpi_pm_thaw(void) ...@@ -498,7 +498,7 @@ static void acpi_pm_thaw(void)
acpi_enable_all_runtime_gpes(); acpi_enable_all_runtime_gpes();
} }
static struct platform_hibernation_ops acpi_hibernation_ops = { static const struct platform_hibernation_ops acpi_hibernation_ops = {
.begin = acpi_hibernation_begin, .begin = acpi_hibernation_begin,
.end = acpi_pm_end, .end = acpi_pm_end,
.pre_snapshot = acpi_pm_prepare, .pre_snapshot = acpi_pm_prepare,
...@@ -541,7 +541,7 @@ static int acpi_hibernation_begin_old(void) ...@@ -541,7 +541,7 @@ static int acpi_hibernation_begin_old(void)
* The following callbacks are used if the pre-ACPI 2.0 suspend ordering has * The following callbacks are used if the pre-ACPI 2.0 suspend ordering has
* been requested. * been requested.
*/ */
static struct platform_hibernation_ops acpi_hibernation_ops_old = { static const struct platform_hibernation_ops acpi_hibernation_ops_old = {
.begin = acpi_hibernation_begin_old, .begin = acpi_hibernation_begin_old,
.end = acpi_pm_end, .end = acpi_pm_end,
.pre_snapshot = acpi_pm_pre_suspend, .pre_snapshot = acpi_pm_pre_suspend,
......
...@@ -245,7 +245,7 @@ extern void swsusp_set_page_free(struct page *); ...@@ -245,7 +245,7 @@ extern void swsusp_set_page_free(struct page *);
extern void swsusp_unset_page_free(struct page *); extern void swsusp_unset_page_free(struct page *);
extern unsigned long get_safe_page(gfp_t gfp_mask); extern unsigned long get_safe_page(gfp_t gfp_mask);
extern void hibernation_set_ops(struct platform_hibernation_ops *ops); extern void hibernation_set_ops(const struct platform_hibernation_ops *ops);
extern int hibernate(void); extern int hibernate(void);
extern bool system_entering_hibernation(void); extern bool system_entering_hibernation(void);
#else /* CONFIG_HIBERNATION */ #else /* CONFIG_HIBERNATION */
...@@ -253,7 +253,7 @@ static inline int swsusp_page_is_forbidden(struct page *p) { return 0; } ...@@ -253,7 +253,7 @@ static inline int swsusp_page_is_forbidden(struct page *p) { return 0; }
static inline void swsusp_set_page_free(struct page *p) {} static inline void swsusp_set_page_free(struct page *p) {}
static inline void swsusp_unset_page_free(struct page *p) {} static inline void swsusp_unset_page_free(struct page *p) {}
static inline void hibernation_set_ops(struct platform_hibernation_ops *ops) {} static inline void hibernation_set_ops(const struct platform_hibernation_ops *ops) {}
static inline int hibernate(void) { return -ENOSYS; } static inline int hibernate(void) { return -ENOSYS; }
static inline bool system_entering_hibernation(void) { return false; } static inline bool system_entering_hibernation(void) { return false; }
#endif /* CONFIG_HIBERNATION */ #endif /* CONFIG_HIBERNATION */
......
...@@ -51,14 +51,14 @@ enum { ...@@ -51,14 +51,14 @@ enum {
static int hibernation_mode = HIBERNATION_SHUTDOWN; static int hibernation_mode = HIBERNATION_SHUTDOWN;
static struct platform_hibernation_ops *hibernation_ops; static const struct platform_hibernation_ops *hibernation_ops;
/** /**
* hibernation_set_ops - set the global hibernate operations * hibernation_set_ops - set the global hibernate operations
* @ops: the hibernation operations to use in subsequent hibernation transitions * @ops: the hibernation operations to use in subsequent hibernation transitions
*/ */
void hibernation_set_ops(struct platform_hibernation_ops *ops) void hibernation_set_ops(const struct platform_hibernation_ops *ops)
{ {
if (ops && !(ops->begin && ops->end && ops->pre_snapshot if (ops && !(ops->begin && ops->end && ops->pre_snapshot
&& ops->prepare && ops->finish && ops->enter && ops->pre_restore && ops->prepare && ops->finish && ops->enter && ops->pre_restore
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment