[PATCH v2] powerpc: declare unmodified attribute_group usages const
Christophe Leroy
christophe.leroy at csgroup.eu
Sat Mar 5 00:12:27 AEDT 2022
Le 04/03/2022 à 01:21, Rohan McLure a écrit :
> Inspired by (bd75b4ef4977: Constify static attribute_group structs),
> accepted by linux-next, reported:
> https://patchwork.ozlabs.org/project/linuxppc-dev/patch/20220210202805.7750-4-rikard.falkeborn@gmail.com/
>
> Nearly all singletons of type struct attribute_group are never
> modified, and so
> are candidates for being const. Declare them as const.
>
> Signed-off-by: Rohan McLure <rmclure at linux.ibm.com>
> ---
> arch/powerpc/perf/generic-compat-pmu.c | 4 ++--
> arch/powerpc/perf/hv-24x7.c | 6 +++---
> arch/powerpc/perf/hv-gpci.c | 8 ++++----
> arch/powerpc/perf/imc-pmu.c | 6 +++---
> arch/powerpc/perf/isa207-common.c | 2 +-
> arch/powerpc/perf/power10-pmu.c | 6 +++---
> arch/powerpc/perf/power7-pmu.c | 4 ++--
> arch/powerpc/perf/power8-pmu.c | 4 ++--
> arch/powerpc/perf/power9-pmu.c | 6 +++---
> arch/powerpc/platforms/cell/cbe_thermal.c | 4 ++--
> arch/powerpc/platforms/powernv/opal-core.c | 2 +-
> arch/powerpc/platforms/powernv/opal-dump.c | 2 +-
> arch/powerpc/platforms/powernv/opal-flash.c | 2 +-
> arch/powerpc/platforms/pseries/papr_scm.c | 2 +-
> arch/powerpc/platforms/pseries/power.c | 2 +-
> 15 files changed, 30 insertions(+), 30 deletions(-)
>
/linux/arch/powerpc/platforms/cell/cbe_thermal.c: In function
'thermal_init':
/linux/arch/powerpc/platforms/cell/cbe_thermal.c:370:26: error: passing
argument 1 of 'spu_add_dev_attr_group' discards 'const' qualifier from
pointer target type [-Werror=discarded-qualifiers]
spu_add_dev_attr_group(&spu_attribute_group);
^
In file included from /linux/arch/powerpc/platforms/cell/cbe_thermal.c:40:0:
/linux/arch/powerpc/include/asm/spu.h:252:5: note: expected 'struct
attribute_group *' but argument is of type 'const struct attribute_group *'
int spu_add_dev_attr_group(struct attribute_group *attrs);
^
/linux/arch/powerpc/platforms/cell/cbe_thermal.c:371:26: error: passing
argument 1 of 'cpu_add_dev_attr_group' discards 'const' qualifier from
pointer target type [-Werror=discarded-qualifiers]
cpu_add_dev_attr_group(&ppe_attribute_group);
^
In file included from /linux/arch/powerpc/platforms/cell/cbe_thermal.c:38:0:
/linux/include/linux/cpu.h:47:12: note: expected 'struct attribute_group
*' but argument is of type 'const struct attribute_group *'
extern int cpu_add_dev_attr_group(struct attribute_group *attrs);
^
/linux/arch/powerpc/platforms/cell/cbe_thermal.c: In function
'thermal_exit':
/linux/arch/powerpc/platforms/cell/cbe_thermal.c:380:28: error: passing
argument 1 of 'spu_remove_dev_attr_group' discards 'const' qualifier
from pointer target type [-Werror=discarded-qualifiers]
spu_remove_dev_attr_group(&spu_attribute_group);
^
In file included from /linux/arch/powerpc/platforms/cell/cbe_thermal.c:40:0:
/linux/arch/powerpc/include/asm/spu.h:253:6: note: expected 'struct
attribute_group *' but argument is of type 'const struct attribute_group *'
void spu_remove_dev_attr_group(struct attribute_group *attrs);
^
/linux/arch/powerpc/platforms/cell/cbe_thermal.c:381:28: error: passing
argument 1 of 'cpu_remove_dev_attr_group' discards 'const' qualifier
from pointer target type [-Werror=discarded-qualifiers]
cpu_remove_dev_attr_group(&ppe_attribute_group);
^
In file included from /linux/arch/powerpc/platforms/cell/cbe_thermal.c:38:0:
/linux/include/linux/cpu.h:48:13: note: expected 'struct attribute_group
*' but argument is of type 'const struct attribute_group *'
extern void cpu_remove_dev_attr_group(struct attribute_group *attrs);
^
cc1: all warnings being treated as errors
make[4]: *** [arch/powerpc/platforms/cell/cbe_thermal.o] Error 1
/linux/scripts/Makefile.build:288: recipe for target
'arch/powerpc/platforms/cell/cbe_thermal.o' failed
More information about the Linuxppc-dev
mailing list