Commit 2f55ac072f5344519348c0c94b3d2f4cca46847b
Committed by
Jiri Kosina
1 parent
acc2472ed3
Exists in
master
and in
4 other branches
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
- arch/arm/mach-davinci/pm.c
- arch/arm/mach-imx/pm-imx27.c
- arch/arm/mach-lpc32xx/pm.c
- arch/arm/mach-omap1/pm.c
- arch/arm/mach-omap2/pm24xx.c
- arch/arm/mach-omap2/pm34xx.c
- arch/arm/mach-omap2/pm44xx.c
- arch/arm/mach-pnx4008/pm.c
- arch/arm/mach-pxa/pm.c
- arch/arm/mach-pxa/sharpsl_pm.c
- arch/arm/mach-sa1100/pm.c
- arch/arm/plat-samsung/pm.c
- arch/avr32/mach-at32ap/pm.c
- arch/blackfin/mach-common/pm.c
- arch/mips/alchemy/devboards/pm.c
- arch/mips/jz4740/pm.c
- arch/mips/loongson/common/pm.c
- arch/powerpc/platforms/52xx/lite5200_pm.c
- arch/powerpc/platforms/52xx/mpc52xx_pm.c
- arch/powerpc/platforms/83xx/suspend.c
- arch/powerpc/platforms/pseries/suspend.c
- arch/powerpc/sysdev/fsl_pmc.c
- arch/sh/boards/mach-hp6xx/pm.c
- arch/sh/kernel/cpu/shmobile/pm.c
- drivers/acpi/sleep.c
- drivers/macintosh/via-pmu.c
- include/linux/suspend.h
- kernel/power/suspend.c
arch/arm/mach-at91/pm.c
arch/arm/mach-davinci/pm.c
arch/arm/mach-imx/pm-imx27.c
arch/arm/mach-lpc32xx/pm.c
arch/arm/mach-omap1/pm.c
arch/arm/mach-omap2/pm24xx.c
arch/arm/mach-omap2/pm34xx.c
arch/arm/mach-omap2/pm44xx.c
arch/arm/mach-pnx4008/pm.c
arch/arm/mach-pxa/pm.c
arch/arm/mach-pxa/sharpsl_pm.c
arch/arm/mach-sa1100/pm.c
arch/arm/plat-samsung/pm.c
arch/avr32/mach-at32ap/pm.c
arch/blackfin/mach-common/pm.c
arch/mips/alchemy/devboards/pm.c
arch/mips/jz4740/pm.c
arch/mips/loongson/common/pm.c
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
arch/sh/boards/mach-hp6xx/pm.c
arch/sh/kernel/cpu/shmobile/pm.c
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; |