Commit 2f55ac072f5344519348c0c94b3d2f4cca46847b

Authored by Lionel Debroux
Committed by Jiri Kosina
1 parent acc2472ed3

suspend: constify platform_suspend_ops

While at it, fix two checkpatch errors.
Several non-const struct instances constified by this patch were added after
the introduction of platform_suspend_ops in checkpatch.pl's list of "should
be const" structs (79404849e90a41ea2109bd0e2f7c7164b0c4ce73).

Patch against mainline.
Inspired by hunks of the grsecurity patch, updated for newer kernels.

Signed-off-by: Lionel Debroux <lionel_debroux@yahoo.fr>
Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>

Showing 29 changed files with 32 additions and 32 deletions Side-by-side Diff

arch/arm/mach-at91/pm.c
... ... @@ -301,7 +301,7 @@
301 301 }
302 302  
303 303  
304   -static struct platform_suspend_ops at91_pm_ops ={
  304 +static const struct platform_suspend_ops at91_pm_ops = {
305 305 .valid = at91_pm_valid_state,
306 306 .begin = at91_pm_begin,
307 307 .enter = at91_pm_enter,
arch/arm/mach-davinci/pm.c
... ... @@ -110,7 +110,7 @@
110 110 return ret;
111 111 }
112 112  
113   -static struct platform_suspend_ops davinci_pm_ops = {
  113 +static const struct platform_suspend_ops davinci_pm_ops = {
114 114 .enter = davinci_pm_enter,
115 115 .valid = suspend_valid_only_mem,
116 116 };
arch/arm/mach-imx/pm-imx27.c
... ... @@ -32,7 +32,7 @@
32 32 return 0;
33 33 }
34 34  
35   -static struct platform_suspend_ops mx27_suspend_ops = {
  35 +static const struct platform_suspend_ops mx27_suspend_ops = {
36 36 .enter = mx27_suspend_enter,
37 37 .valid = suspend_valid_only_mem,
38 38 };
arch/arm/mach-lpc32xx/pm.c
... ... @@ -123,7 +123,7 @@
123 123 return 0;
124 124 }
125 125  
126   -static struct platform_suspend_ops lpc32xx_pm_ops = {
  126 +static const struct platform_suspend_ops lpc32xx_pm_ops = {
127 127 .valid = suspend_valid_only_mem,
128 128 .enter = lpc32xx_pm_enter,
129 129 };
arch/arm/mach-omap1/pm.c
... ... @@ -647,7 +647,7 @@
647 647  
648 648  
649 649  
650   -static struct platform_suspend_ops omap_pm_ops ={
  650 +static const struct platform_suspend_ops omap_pm_ops = {
651 651 .prepare = omap_pm_prepare,
652 652 .enter = omap_pm_enter,
653 653 .finish = omap_pm_finish,
arch/arm/mach-omap2/pm24xx.c
... ... @@ -326,7 +326,7 @@
326 326 enable_hlt();
327 327 }
328 328  
329   -static struct platform_suspend_ops omap_pm_ops = {
  329 +static const struct platform_suspend_ops omap_pm_ops = {
330 330 .prepare = omap2_pm_prepare,
331 331 .enter = omap2_pm_enter,
332 332 .finish = omap2_pm_finish,
arch/arm/mach-omap2/pm34xx.c
... ... @@ -594,7 +594,7 @@
594 594 return;
595 595 }
596 596  
597   -static struct platform_suspend_ops omap_pm_ops = {
  597 +static const struct platform_suspend_ops omap_pm_ops = {
598 598 .begin = omap3_pm_begin,
599 599 .end = omap3_pm_end,
600 600 .prepare = omap3_pm_prepare,
arch/arm/mach-omap2/pm44xx.c
... ... @@ -75,7 +75,7 @@
75 75 return;
76 76 }
77 77  
78   -static struct platform_suspend_ops omap_pm_ops = {
  78 +static const struct platform_suspend_ops omap_pm_ops = {
79 79 .begin = omap4_pm_begin,
80 80 .end = omap4_pm_end,
81 81 .prepare = omap4_pm_prepare,
arch/arm/mach-pnx4008/pm.c
... ... @@ -119,7 +119,7 @@
119 119 (state == PM_SUSPEND_MEM);
120 120 }
121 121  
122   -static struct platform_suspend_ops pnx4008_pm_ops = {
  122 +static const struct platform_suspend_ops pnx4008_pm_ops = {
123 123 .enter = pnx4008_pm_enter,
124 124 .valid = pnx4008_pm_valid,
125 125 };
arch/arm/mach-pxa/pm.c
... ... @@ -96,7 +96,7 @@
96 96 pxa_cpu_pm_fns->finish();
97 97 }
98 98  
99   -static struct platform_suspend_ops pxa_pm_ops = {
  99 +static const struct platform_suspend_ops pxa_pm_ops = {
100 100 .valid = pxa_pm_valid,
101 101 .enter = pxa_pm_enter,
102 102 .prepare = pxa_pm_prepare,
arch/arm/mach-pxa/sharpsl_pm.c
... ... @@ -868,7 +868,7 @@
868 868 }
869 869  
870 870 #ifdef CONFIG_PM
871   -static struct platform_suspend_ops sharpsl_pm_ops = {
  871 +static const struct platform_suspend_ops sharpsl_pm_ops = {
872 872 .prepare = pxa_pm_prepare,
873 873 .finish = pxa_pm_finish,
874 874 .enter = corgi_pxa_pm_enter,
arch/arm/mach-sa1100/pm.c
... ... @@ -120,7 +120,7 @@
120 120 return virt_to_phys(sp);
121 121 }
122 122  
123   -static struct platform_suspend_ops sa11x0_pm_ops = {
  123 +static const struct platform_suspend_ops sa11x0_pm_ops = {
124 124 .enter = sa11x0_pm_enter,
125 125 .valid = suspend_valid_only_mem,
126 126 };
arch/arm/plat-samsung/pm.c
... ... @@ -355,7 +355,7 @@
355 355 s3c_pm_check_cleanup();
356 356 }
357 357  
358   -static struct platform_suspend_ops s3c_pm_ops = {
  358 +static const struct platform_suspend_ops s3c_pm_ops = {
359 359 .enter = s3c_pm_enter,
360 360 .prepare = s3c_pm_prepare,
361 361 .finish = s3c_pm_finish,
arch/avr32/mach-at32ap/pm.c
... ... @@ -176,7 +176,7 @@
176 176 return 0;
177 177 }
178 178  
179   -static struct platform_suspend_ops avr32_pm_ops = {
  179 +static const struct platform_suspend_ops avr32_pm_ops = {
180 180 .valid = avr32_pm_valid_state,
181 181 .enter = avr32_pm_enter,
182 182 };
arch/blackfin/mach-common/pm.c
... ... @@ -233,7 +233,7 @@
233 233 return 0;
234 234 }
235 235  
236   -struct platform_suspend_ops bfin_pm_ops = {
  236 +static const struct platform_suspend_ops bfin_pm_ops = {
237 237 .enter = bfin_pm_enter,
238 238 .valid = bfin_pm_valid,
239 239 };
arch/mips/alchemy/devboards/pm.c
... ... @@ -110,7 +110,7 @@
110 110  
111 111 }
112 112  
113   -static struct platform_suspend_ops db1x_pm_ops = {
  113 +static const struct platform_suspend_ops db1x_pm_ops = {
114 114 .valid = suspend_valid_only_mem,
115 115 .begin = db1x_pm_begin,
116 116 .enter = db1x_pm_enter,
arch/mips/jz4740/pm.c
... ... @@ -42,7 +42,7 @@
42 42 return 0;
43 43 }
44 44  
45   -static struct platform_suspend_ops jz4740_pm_ops = {
  45 +static const struct platform_suspend_ops jz4740_pm_ops = {
46 46 .valid = suspend_valid_only_mem,
47 47 .enter = jz4740_pm_enter,
48 48 };
arch/mips/loongson/common/pm.c
... ... @@ -147,7 +147,7 @@
147 147 }
148 148 }
149 149  
150   -static struct platform_suspend_ops loongson_pm_ops = {
  150 +static const struct platform_suspend_ops loongson_pm_ops = {
151 151 .valid = loongson_pm_valid_state,
152 152 .enter = loongson_pm_enter,
153 153 };
arch/powerpc/platforms/52xx/lite5200_pm.c
... ... @@ -232,7 +232,7 @@
232 232 lite5200_pm_target_state = PM_SUSPEND_ON;
233 233 }
234 234  
235   -static struct platform_suspend_ops lite5200_pm_ops = {
  235 +static const struct platform_suspend_ops lite5200_pm_ops = {
236 236 .valid = lite5200_pm_valid,
237 237 .begin = lite5200_pm_begin,
238 238 .prepare = lite5200_pm_prepare,
arch/powerpc/platforms/52xx/mpc52xx_pm.c
... ... @@ -186,7 +186,7 @@
186 186 iounmap(mbar);
187 187 }
188 188  
189   -static struct platform_suspend_ops mpc52xx_pm_ops = {
  189 +static const struct platform_suspend_ops mpc52xx_pm_ops = {
190 190 .valid = mpc52xx_pm_valid,
191 191 .prepare = mpc52xx_pm_prepare,
192 192 .enter = mpc52xx_pm_enter,
arch/powerpc/platforms/83xx/suspend.c
... ... @@ -311,7 +311,7 @@
311 311 return ret;
312 312 }
313 313  
314   -static struct platform_suspend_ops mpc83xx_suspend_ops = {
  314 +static const struct platform_suspend_ops mpc83xx_suspend_ops = {
315 315 .valid = mpc83xx_suspend_valid,
316 316 .begin = mpc83xx_suspend_begin,
317 317 .enter = mpc83xx_suspend_enter,
arch/powerpc/platforms/pseries/suspend.c
... ... @@ -153,7 +153,7 @@
153 153 .name = "power",
154 154 };
155 155  
156   -static struct platform_suspend_ops pseries_suspend_ops = {
  156 +static const struct platform_suspend_ops pseries_suspend_ops = {
157 157 .valid = suspend_valid_only_mem,
158 158 .begin = pseries_suspend_begin,
159 159 .prepare_late = pseries_prepare_late,
arch/powerpc/sysdev/fsl_pmc.c
... ... @@ -53,7 +53,7 @@
53 53 return 1;
54 54 }
55 55  
56   -static struct platform_suspend_ops pmc_suspend_ops = {
  56 +static const struct platform_suspend_ops pmc_suspend_ops = {
57 57 .valid = pmc_suspend_valid,
58 58 .enter = pmc_suspend_enter,
59 59 };
arch/sh/boards/mach-hp6xx/pm.c
... ... @@ -143,7 +143,7 @@
143 143 return 0;
144 144 }
145 145  
146   -static struct platform_suspend_ops hp6x0_pm_ops = {
  146 +static const struct platform_suspend_ops hp6x0_pm_ops = {
147 147 .enter = hp6x0_pm_enter,
148 148 .valid = suspend_valid_only_mem,
149 149 };
arch/sh/kernel/cpu/shmobile/pm.c
... ... @@ -141,7 +141,7 @@
141 141 return 0;
142 142 }
143 143  
144   -static struct platform_suspend_ops sh_pm_ops = {
  144 +static const struct platform_suspend_ops sh_pm_ops = {
145 145 .enter = sh_pm_enter,
146 146 .valid = suspend_valid_only_mem,
147 147 };
drivers/acpi/sleep.c
... ... @@ -319,7 +319,7 @@
319 319 }
320 320 }
321 321  
322   -static struct platform_suspend_ops acpi_suspend_ops = {
  322 +static const struct platform_suspend_ops acpi_suspend_ops = {
323 323 .valid = acpi_suspend_state_valid,
324 324 .begin = acpi_suspend_begin,
325 325 .prepare_late = acpi_pm_prepare,
... ... @@ -347,7 +347,7 @@
347 347 * The following callbacks are used if the pre-ACPI 2.0 suspend ordering has
348 348 * been requested.
349 349 */
350   -static struct platform_suspend_ops acpi_suspend_ops_old = {
  350 +static const struct platform_suspend_ops acpi_suspend_ops_old = {
351 351 .valid = acpi_suspend_state_valid,
352 352 .begin = acpi_suspend_begin_old,
353 353 .prepare_late = acpi_pm_pre_suspend,
drivers/macintosh/via-pmu.c
... ... @@ -2257,7 +2257,7 @@
2257 2257 && (pmac_call_feature(PMAC_FTR_SLEEP_STATE, NULL, 0, -1) >= 0);
2258 2258 }
2259 2259  
2260   -static struct platform_suspend_ops pmu_pm_ops = {
  2260 +static const struct platform_suspend_ops pmu_pm_ops = {
2261 2261 .enter = powerbook_sleep,
2262 2262 .valid = pmu_sleep_valid,
2263 2263 };
include/linux/suspend.h
... ... @@ -122,7 +122,7 @@
122 122 * suspend_set_ops - set platform dependent suspend operations
123 123 * @ops: The new suspend operations to set.
124 124 */
125   -extern void suspend_set_ops(struct platform_suspend_ops *ops);
  125 +extern void suspend_set_ops(const struct platform_suspend_ops *ops);
126 126 extern int suspend_valid_only_mem(suspend_state_t state);
127 127  
128 128 /**
... ... @@ -147,7 +147,7 @@
147 147 #else /* !CONFIG_SUSPEND */
148 148 #define suspend_valid_only_mem NULL
149 149  
150   -static inline void suspend_set_ops(struct platform_suspend_ops *ops) {}
  150 +static inline void suspend_set_ops(const struct platform_suspend_ops *ops) {}
151 151 static inline int pm_suspend(suspend_state_t state) { return -ENOSYS; }
152 152 #endif /* !CONFIG_SUSPEND */
153 153  
kernel/power/suspend.c
... ... @@ -30,13 +30,13 @@
30 30 [PM_SUSPEND_MEM] = "mem",
31 31 };
32 32  
33   -static struct platform_suspend_ops *suspend_ops;
  33 +static const struct platform_suspend_ops *suspend_ops;
34 34  
35 35 /**
36 36 * suspend_set_ops - Set the global suspend method table.
37 37 * @ops: Pointer to ops structure.
38 38 */
39   -void suspend_set_ops(struct platform_suspend_ops *ops)
  39 +void suspend_set_ops(const struct platform_suspend_ops *ops)
40 40 {
41 41 mutex_lock(&pm_mutex);
42 42 suspend_ops = ops;