[PATCH v2] powerpc: declare unmodified attribute_group usages const

Michael Ellerman mpe at ellerman.id.au
Sun Mar 6 18:49:33 AEDT 2022


Christophe Leroy <christophe.leroy at csgroup.eu> writes:
> 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);

Hi Rohan,

If you follow the instructions here:

  https://github.com/linuxppc/wiki/wiki/Testing-with-GitHub-Actions

You can get some automatic build tests done before you post, which would
have caught this.

cheers


More information about the Linuxppc-dev mailing list