Skip to contentSkip to conversation

ARM: make of_device_ids const

PATCH Superseded Uwe Kleine-König 3 participants 5 messages Feb 18, 2015 – Feb 20, 2015 1 message not in the archive

Subsystems (14)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: make of_device_ids const

of_device_ids (i.e. compatible strings and the respective data) are not supposed to change at runtime. All functions working with of_device_ids provided by <linux/of.h> work with const of_device_ids. So mark the non-const structs in arch/arm as const, too.

While at it also add some __initconst annotations.

---
 arch/arm/kernel/perf_event_cpu.c     | 2 +-
 arch/arm/mach-at91/at91rm9200_time.c | 2 +-
 arch/arm/mach-at91/pm.c              | 4 ++--
 arch/arm/mach-davinci/da8xx-dt.c     | 2 +-
 arch/arm/mach-exynos/suspend.c       | 2 +-
 arch/arm/mach-imx/mmdc.c             | 2 +-
 arch/arm/mach-keystone/pm_domain.c   | 2 +-
 arch/arm/mach-mmp/time.c             | 2 +-
 arch/arm/mach-mvebu/coherency.c      | 2 +-
 arch/arm/mach-mvebu/pmsu.c           | 2 +-
 arch/arm/mach-omap2/omap4-common.c   | 2 +-
 arch/arm/mach-omap2/prm3xxx.c        | 2 +-
 arch/arm/mach-omap2/prm44xx.c        | 2 +-
 arch/arm/mach-prima2/platsmp.c       | 2 +-
 arch/arm/mach-ux500/pm_domains.c     | 2 +-
 15 files changed, 16 insertions(+), 16 deletions(-)
arch/arm/kernel/perf_event_cpu.c +1 -1
index dd9acc95ebc0..61b53c46edfa 100644
@@ -231,7 +231,7 @@ static void cpu_pmu_destroy(struct arm_pmu *cpu_pmu)
 /*
  * PMU platform driver and devicetree bindings.
  */
-static struct of_device_id cpu_pmu_of_device_ids[] = {
+static const struct of_device_id cpu_pmu_of_device_ids[] = {
 	{.compatible = "arm,cortex-a17-pmu",	.data = armv7_a17_pmu_init},
 	{.compatible = "arm,cortex-a15-pmu",	.data = armv7_a15_pmu_init},
 	{.compatible = "arm,cortex-a12-pmu",	.data = armv7_a12_pmu_init},
arch/arm/mach-at91/at91rm9200_time.c +1 -1
index 51761f8927b7..b00d09555f2b 100644
@@ -183,7 +183,7 @@ static struct clock_event_device clkevt = {
 void __iomem *at91_st_base;
 EXPORT_SYMBOL_GPL(at91_st_base);
 
-static struct of_device_id at91rm9200_st_timer_ids[] = {
+static const struct of_device_id at91rm9200_st_timer_ids[] = {
 	{ .compatible = "atmel,at91rm9200-st" },
 	{ /* sentinel */ }
 };
arch/arm/mach-at91/pm.c +2 -2
index af8d8afc2e12..5e34fb143309 100644
@@ -226,7 +226,7 @@ void at91_pm_set_standby(void (*at91_standby)(void))
 	}
 }
 
-static struct of_device_id ramc_ids[] = {
+static const struct of_device_id ramc_ids[] __initconst = {
 	{ .compatible = "atmel,at91rm9200-sdramc", .data = at91rm9200_standby },
 	{ .compatible = "atmel,at91sam9260-sdramc", .data = at91sam9_sdram_standby },
 	{ .compatible = "atmel,at91sam9g45-ddramc", .data = at91_ddr_standby },
@@ -234,7 +234,7 @@ static struct of_device_id ramc_ids[] = {
 	{ /*sentinel*/ }
 };
 
-static void at91_dt_ramc(void)
+static __init void at91_dt_ramc(void)
 {
 	struct device_node *np;
 	const struct of_device_id *of_id;
arch/arm/mach-davinci/da8xx-dt.c +1 -1
index f703d82f08a8..438f68547f4c 100644
@@ -20,7 +20,7 @@
 
 #define DA8XX_NUM_UARTS	3
 
-static struct of_device_id da8xx_irq_match[] __initdata = {
+static const struct of_device_id da8xx_irq_match[] __initconst = {
 	{ .compatible = "ti,cp-intc", .data = cp_intc_of_init, },
 	{ }
 };
arch/arm/mach-exynos/suspend.c +1 -1
index 666ec3e5b03f..52e2b1a2fddb 100644
@@ -587,7 +587,7 @@ static struct exynos_pm_data exynos5420_pm_data = {
 	.cpu_suspend	= exynos5420_cpu_suspend,
 };
 
-static struct of_device_id exynos_pmu_of_device_ids[] = {
+static const struct of_device_id exynos_pmu_of_device_ids[] __initconst = {
 	{
 		.compatible = "samsung,exynos3250-pmu",
 		.data = &exynos3250_pm_data,
arch/arm/mach-imx/mmdc.c +1 -1
index a377f95033ae..0411f0664c15 100644
@@ -68,7 +68,7 @@ int imx_mmdc_get_ddr_type(void)
 	return ddr_type;
 }
 
-static struct of_device_id imx_mmdc_dt_ids[] = {
+static const struct of_device_id imx_mmdc_dt_ids[] = {
 	{ .compatible = "fsl,imx6q-mmdc", },
 	{ /* sentinel */ }
 };
arch/arm/mach-keystone/pm_domain.c +1 -1
index ef6041e7e675..41bebfd296dc 100644
@@ -61,7 +61,7 @@ static struct pm_clk_notifier_block platform_domain_notifier = {
 	.pm_domain = &keystone_pm_domain,
 };
 
-static struct of_device_id of_keystone_table[] = {
+static const struct of_device_id of_keystone_table[] = {
 	{.compatible = "ti,keystone"},
 	{ /* end of list */ },
 };
arch/arm/mach-mmp/time.c +1 -1
index 2756351dbb35..10bfa03e58d4 100644
@@ -213,7 +213,7 @@ void __init timer_init(int irq)
 }
 
 #ifdef CONFIG_OF
-static struct of_device_id mmp_timer_dt_ids[] = {
+static const struct of_device_id mmp_timer_dt_ids[] = {
 	{ .compatible = "mrvl,mmp-timer", },
 	{}
 };
arch/arm/mach-mvebu/coherency.c +1 -1
index b5895f040caa..e46e9ea1e187 100644
@@ -51,7 +51,7 @@ enum {
 	COHERENCY_FABRIC_TYPE_ARMADA_380,
 };
 
-static struct of_device_id of_coherency_table[] = {
+static const struct of_device_id of_coherency_table[] = {
 	{.compatible = "marvell,coherency-fabric",
 	 .data = (void *) COHERENCY_FABRIC_TYPE_ARMADA_370_XP },
 	{.compatible = "marvell,armada-375-coherency-fabric",
arch/arm/mach-mvebu/pmsu.c +1 -1
index d8ab605a44fa..8b9f5e202ccf 100644
@@ -104,7 +104,7 @@ static void __iomem *pmsu_mp_base;
 
 static void *mvebu_cpu_resume;
 
-static struct of_device_id of_pmsu_table[] = {
+static const struct of_device_id of_pmsu_table[] = {
 	{ .compatible = "marvell,armada-370-pmsu", },
 	{ .compatible = "marvell,armada-370-xp-pmsu", },
 	{ .compatible = "marvell,armada-380-pmsu", },
arch/arm/mach-omap2/omap4-common.c +1 -1
index 2418bdf28ca2..cee0fe1ee6ff 100644
@@ -242,7 +242,7 @@ static int __init omap4_sar_ram_init(void)
 }
 omap_early_initcall(omap4_sar_ram_init);
 
-static struct of_device_id gic_match[] = {
+static const struct of_device_id gic_match[] = {
 	{ .compatible = "arm,cortex-a9-gic", },
 	{ .compatible = "arm,cortex-a15-gic", },
 	{ },
arch/arm/mach-omap2/prm3xxx.c +1 -1
index c5e00c6714b1..5713bbdf83bc 100644
@@ -674,7 +674,7 @@ int __init omap3xxx_prm_init(void)
 	return prm_register(&omap3xxx_prm_ll_data);
 }
 
-static struct of_device_id omap3_prm_dt_match_table[] = {
+static const struct of_device_id omap3_prm_dt_match_table[] = {
 	{ .compatible = "ti,omap3-prm" },
 	{ }
 };
arch/arm/mach-omap2/prm44xx.c +1 -1
index 408c64efb807..a08a617a6c11 100644
@@ -712,7 +712,7 @@ int __init omap44xx_prm_init(void)
 	return prm_register(&omap44xx_prm_ll_data);
 }
 
-static struct of_device_id omap_prm_dt_match_table[] = {
+static const struct of_device_id omap_prm_dt_match_table[] = {
 	{ .compatible = "ti,omap4-prm" },
 	{ .compatible = "ti,omap5-prm" },
 	{ .compatible = "ti,dra7-prm" },
arch/arm/mach-prima2/platsmp.c +1 -1
index fc2b03c81e5f..e46c91094dde 100644
@@ -40,7 +40,7 @@ static void sirfsoc_secondary_init(unsigned int cpu)
 	spin_unlock(&boot_lock);
 }
 
-static struct of_device_id clk_ids[]  = {
+static const struct of_device_id clk_ids[]  = {
 	{ .compatible = "sirf,atlas7-clkc" },
 	{},
 };
arch/arm/mach-ux500/pm_domains.c +1 -1
index 0d4b5b46f15b..4d71c90f801c 100644
@@ -49,7 +49,7 @@ static struct generic_pm_domain *ux500_pm_domains[NR_DOMAINS] = {
 	[DOMAIN_VAPE] = &ux500_pm_domain_vape,
 };
 
-static struct of_device_id ux500_pm_domain_matches[] = {
+static const struct of_device_id ux500_pm_domain_matches[] __initconst = {
 	{ .compatible = "stericsson,ux500-pm-domains", },
 	{ },
 };
Signature · 1 line
2.1.4
#1 lore raw

PATCH 1/1 ARM: make of_device_ids const

Quoted 9 lines · On Wednesday 18 February 2015 21:19:56 Uwe Kleine-K?nig wrote:

of_device_ids (i.e. compatible strings and the respective data) are not supposed to change at runtime. All functions working with of_device_ids provided by <linux/of.h> work with const of_device_ids. So mark the non-const structs in arch/arm as const, too.

While at it also add some __initconst annotations.

Applied to fixes branch, thanks!

Arnd

#2 lore raw

PATCH 1/1 ARM: make of_device_ids const

Quoted 6 lines · Arnd Bergmann
Quoted 5 lines · On Wednesday 18 February 2015 21:19:56 Uwe Kleine-K?nig wrote:

of_device_ids (i.e. compatible strings and the respective data) are not supposed to change at runtime. All functions working with of_device_ids provided by <linux/of.h> work with const of_device_ids. So mark the non-const structs in arch/arm as const, too.

Quoted 8 lines
Quoted 4 lines

While at it also add some __initconst annotations.

Applied to fixes branch, thanks!

Arnd

There are many places in driver also where this need to be fixed.I have submitted couple of patches listed below and waiting for the response.

serial:imx make of_device_id array const
pinctrl: freescale: make of_device_id array const

Regards
Sanjeev Sharma

Quoted 5 lines

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#3 lore raw

PATCH 1/1 ARM: make of_device_ids const

Quoted 14 lines · On Thursday 19 February 2015 10:44:49 sanjeev sharma wrote:
Quoted 13 lines · Arnd Bergmann
Quoted 9 lines · On Wednesday 18 February 2015 21:19:56 Uwe Kleine-K?nig wrote:

of_device_ids (i.e. compatible strings and the respective data) are not supposed to change at runtime. All functions working with of_device_ids provided by <linux/of.h> work with const of_device_ids. So mark the non-const structs in arch/arm as const, too.

While at it also add some __initconst annotations.

Applied to fixes branch, thanks!

Quoted 8 lines
Quoted 1 line

Arnd

There are many places in driver also where this need to be fixed.I have submitted couple of patches listed below and waiting for the response.

serial:imx make of_device_id array const
pinctrl: freescale: make of_device_id array const

I'd suggest you send them again after the merge window. Maintainers often miss patches coming in, or have a long backlog of patches to look at.

Greg is usually very good at applying patches for the serial drivers very quickly, but if he hasn't applied the patch within a week, it's probably not on his radar any more.

For the pinctrl patches, I see that Linus Walleij picked up a couple of them, and if he missed this one that was probably an oversight, so just send him a ping or send the patch again with [PATCH RESEND] in the subject.

Arnd

A message that is not in the archive (sent off-list or not yet received): CAGUYZuSQuDcGxcG8JQ8kP34_U=ReQ-cYSPimQHNxMiaCNZzEZA@mail.gmail.com

#5 lore raw

PATCH 1/1 ARM: make of_device_ids const

Quoted 3 lines · On Friday 20 February 2015 11:20:49 sanjeev sharma wrote:

Thanks,

Do you know probable date when widow would be open so that I can resend all.

Next week

Quoted 1 line

Greg: can you take this up https://lkml.org/lkml/2015/2/3/149

He won't, just send a new mail with the same patch.

Arnd