aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLionel Debroux <lionel_debroux@yahoo.fr>2010-11-09 15:48:49 -0500
committerJiri Kosina <jkosina@suse.cz>2010-11-16 08:13:58 -0500
commit073ef1f6e508688392580e4f35dcad9aabd1e100 (patch)
tree2b82dc274ab415524c9c3ab7b8f2cc2d66654b2e
parentc996d8b9a8f37bd1b4dd7823abc42780b20998f8 (diff)
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 b4144e4f6e3b448d322095ca08af393682a69e33. Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r--drivers/acpi/sleep.c4
-rw-r--r--include/linux/suspend.h4
-rw-r--r--kernel/power/hibernate.c4
3 files changed, 6 insertions, 6 deletions
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
index 721d93b3ceee..5149c9bf7015 100644
--- a/drivers/acpi/sleep.c
+++ b/drivers/acpi/sleep.c
@@ -498,7 +498,7 @@ static void acpi_pm_thaw(void)
498 acpi_enable_all_runtime_gpes(); 498 acpi_enable_all_runtime_gpes();
499} 499}
500 500
501static struct platform_hibernation_ops acpi_hibernation_ops = { 501static const struct platform_hibernation_ops acpi_hibernation_ops = {
502 .begin = acpi_hibernation_begin, 502 .begin = acpi_hibernation_begin,
503 .end = acpi_pm_end, 503 .end = acpi_pm_end,
504 .pre_snapshot = acpi_pm_prepare, 504 .pre_snapshot = acpi_pm_prepare,
@@ -541,7 +541,7 @@ static int acpi_hibernation_begin_old(void)
541 * The following callbacks are used if the pre-ACPI 2.0 suspend ordering has 541 * The following callbacks are used if the pre-ACPI 2.0 suspend ordering has
542 * been requested. 542 * been requested.
543 */ 543 */
544static struct platform_hibernation_ops acpi_hibernation_ops_old = { 544static const struct platform_hibernation_ops acpi_hibernation_ops_old = {
545 .begin = acpi_hibernation_begin_old, 545 .begin = acpi_hibernation_begin_old,
546 .end = acpi_pm_end, 546 .end = acpi_pm_end,
547 .pre_snapshot = acpi_pm_pre_suspend, 547 .pre_snapshot = acpi_pm_pre_suspend,
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index 26697514c5ec..40ead943fd6a 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -245,7 +245,7 @@ extern void swsusp_set_page_free(struct page *);
245extern void swsusp_unset_page_free(struct page *); 245extern void swsusp_unset_page_free(struct page *);
246extern unsigned long get_safe_page(gfp_t gfp_mask); 246extern unsigned long get_safe_page(gfp_t gfp_mask);
247 247
248extern void hibernation_set_ops(struct platform_hibernation_ops *ops); 248extern void hibernation_set_ops(const struct platform_hibernation_ops *ops);
249extern int hibernate(void); 249extern int hibernate(void);
250extern bool system_entering_hibernation(void); 250extern bool system_entering_hibernation(void);
251#else /* CONFIG_HIBERNATION */ 251#else /* CONFIG_HIBERNATION */
@@ -253,7 +253,7 @@ static inline int swsusp_page_is_forbidden(struct page *p) { return 0; }
253static inline void swsusp_set_page_free(struct page *p) {} 253static inline void swsusp_set_page_free(struct page *p) {}
254static inline void swsusp_unset_page_free(struct page *p) {} 254static inline void swsusp_unset_page_free(struct page *p) {}
255 255
256static inline void hibernation_set_ops(struct platform_hibernation_ops *ops) {} 256static inline void hibernation_set_ops(const struct platform_hibernation_ops *ops) {}
257static inline int hibernate(void) { return -ENOSYS; } 257static inline int hibernate(void) { return -ENOSYS; }
258static inline bool system_entering_hibernation(void) { return false; } 258static inline bool system_entering_hibernation(void) { return false; }
259#endif /* CONFIG_HIBERNATION */ 259#endif /* CONFIG_HIBERNATION */
diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
index 657272e91d0a..491b81a27111 100644
--- a/kernel/power/hibernate.c
+++ b/kernel/power/hibernate.c
@@ -51,14 +51,14 @@ enum {
51 51
52static int hibernation_mode = HIBERNATION_SHUTDOWN; 52static int hibernation_mode = HIBERNATION_SHUTDOWN;
53 53
54static struct platform_hibernation_ops *hibernation_ops; 54static const struct platform_hibernation_ops *hibernation_ops;
55 55
56/** 56/**
57 * hibernation_set_ops - set the global hibernate operations 57 * hibernation_set_ops - set the global hibernate operations
58 * @ops: the hibernation operations to use in subsequent hibernation transitions 58 * @ops: the hibernation operations to use in subsequent hibernation transitions
59 */ 59 */
60 60
61void hibernation_set_ops(struct platform_hibernation_ops *ops) 61void hibernation_set_ops(const struct platform_hibernation_ops *ops)
62{ 62{
63 if (ops && !(ops->begin && ops->end && ops->pre_snapshot 63 if (ops && !(ops->begin && ops->end && ops->pre_snapshot
64 && ops->prepare && ops->finish && ops->enter && ops->pre_restore 64 && ops->prepare && ops->finish && ops->enter && ops->pre_restore