ARM: make arrays containing machine compatible strings const
Subsystems (12)
PATCH 1/1 ARM: make arrays containing machine compatible strings const
The definition
static const char *axxia_dt_match[] __initconst = {
...defines a changable array of constant strings. That is you must not do:
*axxia_dt_match[0] = 'k';
but
axxia_dt_match[0] = "different string";
is fine. So the annotation __initconst is wrong and yields a compiler error when other really const variables are added with __initconst.
As the struct machine_desc member dt_compat is declared as
const char *const *dt_compat;
making the arrays const is the better alternative over changing all annotations to __initdata.
---
Hello,
this is similar to the fix I sent earlier today which only fixed omap2. Does it make sense to split this patch per platform?
Best regards
Uwe
arch/arm/mach-axxia/axxia.c | 2 +- arch/arm/mach-bcm/brcmstb.c | 2 +- arch/arm/mach-exynos/exynos.c | 2 +- arch/arm/mach-highbank/highbank.c | 2 +- arch/arm/mach-hisi/hisilicon.c | 4 ++-- arch/arm/mach-keystone/keystone.c | 2 +- arch/arm/mach-nspire/nspire.c | 2 +- arch/arm/mach-prima2/common.c | 6 +++--- arch/arm/mach-s5pv210/s5pv210.c | 2 +- arch/arm/mach-shmobile/setup-emev2.c | 2 +- arch/arm/mach-versatile/versatile_dt.c | 2 +- 11 files changed, 14 insertions(+), 14 deletions(-)
arch/arm/mach-axxia/axxia.c +1 -1
@@ -16,7 +16,7 @@#include <linux/init.h> #include <asm/mach/arch.h> -static const char *axxia_dt_match[]__initconst = { +static const char *const axxia_dt_match[]__initconst = {"lsi,axm5516" ,"lsi,axm5516-sim" ,"lsi,axm5516-emu" ,
arch/arm/mach-bcm/brcmstb.c +1 -1
@@ -17,7 +17,7 @@#include <asm/mach-types.h> #include <asm/mach/arch.h> -static const char *brcmstb_match[]__initconst = { +static const char *const brcmstb_match[]__initconst = {"brcm,bcm7445" ,"brcm,brcmstb" ,NULL
arch/arm/mach-exynos/exynos.c +1 -1
@@ -325,7 +325,7 @@ static void __init exynos_dt_machine_init(void)of_platform_populate (NULL , of_default_bus_match_table,NULL ,NULL ); } -static char const *exynos_dt_compat[]__initconst = { +static char const *const exynos_dt_compat[]__initconst = {"samsung,exynos3" ,"samsung,exynos3250" ,"samsung,exynos4" ,
arch/arm/mach-highbank/highbank.c +1 -1
@@ -169,7 +169,7 @@ static void __init highbank_init(void)platform_device_register (&highbank_cpuidle_device); } -static const char *highbank_match[]__initconst = { +static const char *const highbank_match[]__initconst = {"calxeda,highbank" ,"calxeda,ecx-2000" ,NULL ,
arch/arm/mach-hisi/hisilicon.c +2 -2
@@ -45,7 +45,7 @@ static void __init hi3620_map_io(void)iotable_init (hi3620_io_desc,ARRAY_SIZE (hi3620_io_desc)); } -static const char *hi3xxx_compat[]__initconst = { +static const char *const hi3xxx_compat[]__initconst = {"hisilicon,hi3620-hi4511" ,NULL , };
@@ -55,7 +55,7 @@ DT_MACHINE_START(HI3620, "Hisilicon Hi3620 (Flattened Device Tree)") .dt_compat = hi3xxx_compat,MACHINE_END -static const char *hix5hd2_compat[] __initconst = { +static const char *const hix5hd2_compat[] __initconst = {"hisilicon,hix5hd2" ,NULL , };
arch/arm/mach-keystone/keystone.c +1 -1
@@ -103,7 +103,7 @@ static void __init keystone_init_meminfo(void)pr_info ("Switching to high address space at 0x%llx\n" , (u64 )offset); } -static const char *keystone_match[]__initconst = { +static const char *const keystone_match[]__initconst = {"ti,keystone" ,NULL , };
arch/arm/mach-nspire/nspire.c +1 -1
@@ -27,7 +27,7 @@#include "mmio.h" #include "clcd.h" -static const char *nspire_dt_match[]__initconst = { +static const char *const nspire_dt_match[]__initconst = {"ti,nspire" ,"ti,nspire-cx" ,"ti,nspire-tp" ,
arch/arm/mach-prima2/common.c +3 -3
@@ -27,7 +27,7 @@ static __init void sirfsoc_map_io(void) }#ifdef CONFIG_ARCH_ATLAS6 -static const char *atlas6_dt_match[]__initconst = { +static const char *const atlas6_dt_match[]__initconst = {"sirf,atlas6" ,NULL };
@@ -43,7 +43,7 @@ MACHINE_END#endif #ifdef CONFIG_ARCH_PRIMA2 -static const char *prima2_dt_match[]__initconst = { +static const char *const prima2_dt_match[]__initconst = {"sirf,prima2" ,NULL };
@@ -60,7 +60,7 @@ MACHINE_END#endif #ifdef CONFIG_ARCH_MARCO -static const char *marco_dt_match[]__initconst = { +static const char *const marco_dt_match[]__initconst = {"sirf,marco" ,NULL };
arch/arm/mach-s5pv210/s5pv210.c +1 -1
@@ -63,7 +63,7 @@ static void __init s5pv210_dt_init_late(void)s5pv210_pm_init (); } -static char const *s5pv210_dt_compat[]__initconst = { +static char const *const s5pv210_dt_compat[]__initconst = {"samsung,s5pc110" ,"samsung,s5pv210" ,NULL
arch/arm/mach-shmobile/setup-emev2.c +1 -1
@@ -41,7 +41,7 @@ static void __init emev2_map_io(void)iotable_init (emev2_io_desc,ARRAY_SIZE (emev2_io_desc)); } -static const char *emev2_boards_compat_dt[]__initconst = { +static const char *const emev2_boards_compat_dt[]__initconst = {"renesas,emev2" ,NULL , };
arch/arm/mach-versatile/versatile_dt.c +1 -1
@@ -35,7 +35,7 @@ static void __init versatile_dt_init(void) versatile_auxdata_lookup, NULL); } -static const char *versatile_dt_match[]__initconst = { +static const char *const versatile_dt_match[]__initconst = {"arm,versatile-ab" ,"arm,versatile-pb" ,NULL ,
Signature · 1 line
2.1.0
PATCH 1/1 ARM: make arrays containing machine compatible strings const
Quoted 23 lines · Uwe Kleine-K??nig
The definition
static const char *axxia_dt_match[] __initconst = { ...defines a changable array of constant strings. That is you must not do:
*axxia_dt_match[0] = 'k';but
axxia_dt_match[0] = "different string";is fine. So the annotation
__initconstis wrong and yields a compiler error when other really const variables are added with__initconst.As the struct
machine_descmemberdt_compatis declared asconst char *const *dt_compat;making the arrays const is the better alternative over changing all annotations to
__initdata.
Quoted 6 lines
Signed-off-by Uwe Kleine-K??nig <[email protected]>---
Hello,this is similar to the fix I sent earlier today which only fixed omap2. Does it make sense to split this patch per platform?
We should be fine applying it as-is. Applied to next/cleanup.
-Olof
PATCH 1/1 ARM: make arrays containing machine compatible strings const
Quoted 28 lines · Olof Johansson
Quoted 27 lines · Uwe Kleine-K??nig
The definition
static const char *axxia_dt_match[] __initconst = { ...defines a changable array of constant strings. That is you must not do:
*axxia_dt_match[0] = 'k';but
axxia_dt_match[0] = "different string";is fine. So the annotation
__initconstis wrong and yields a compiler error when other really const variables are added with__initconst.As the struct
machine_descmemberdt_compatis declared asconst char *const *dt_compat;making the arrays const is the better alternative over changing all annotations to
__initdata.Signed-off-by Uwe Kleine-K??nig <[email protected]>---
Hello,
Quoted 5 lines
Quoted 2 lines
this is similar to the fix I sent earlier today which only fixed omap2. Does it make sense to split this patch per platform?
We should be fine applying it as-is. Applied to next/cleanup.
...and dropped again. It conflicts with new platform additions. I'll apply and fixup those towards the end of the merge window.
No action needed on your behalf, besides possibly reminding me in case I forget about it.
-Olof