* [PATCH v2 2/9] ARM: shmobile: r8a7790: Constify platform data and resources
@ 2013-08-07 22:56 Laurent Pinchart
2013-08-08 11:11 ` Sergei Shtylyov
2013-08-08 11:22 ` Laurent Pinchart
0 siblings, 2 replies; 3+ messages in thread
From: Laurent Pinchart @ 2013-08-07 22:56 UTC (permalink / raw)
To: linux-sh
Platform data and resources for core devices are kmemdup()ed when the
corresponding devices are registered and can thus be declared as const.
Do so.
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
arch/arm/mach-shmobile/setup-r8a7790.c | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
diff --git a/arch/arm/mach-shmobile/setup-r8a7790.c b/arch/arm/mach-shmobile/setup-r8a7790.c
index d0f5c9f..988266e 100644
--- a/arch/arm/mach-shmobile/setup-r8a7790.c
+++ b/arch/arm/mach-shmobile/setup-r8a7790.c
@@ -31,17 +31,18 @@
#include <mach/r8a7790.h>
#include <asm/mach/arch.h>
-static struct resource pfc_resources[] __initdata = {
+static const struct resource pfc_resources[] __initdata = {
DEFINE_RES_MEM(0xe6060000, 0x250),
};
#define R8A7790_GPIO(idx) \
-static struct resource r8a7790_gpio##idx##_resources[] __initdata = { \
+static const struct resource r8a7790_gpio##idx##_resources[] __initdata = { \
DEFINE_RES_MEM(0xe6050000 + 0x1000 * (idx), 0x50), \
DEFINE_RES_IRQ(gic_spi(4 + (idx))), \
}; \
\
-static struct gpio_rcar_config r8a7790_gpio##idx##_platform_data __initdata = { \
+static const struct gpio_rcar_config \
+r8a7790_gpio##idx##_platform_data __initdata = { \
.gpio_base = 32 * (idx), \
.irq_base = 0, \
.number_of_pins = 32, \
@@ -112,7 +113,7 @@ void __init r8a7790_pinmux_init(void)
enum { SCIFA0, SCIFA1, SCIFB0, SCIFB1, SCIFB2, SCIFA2, SCIF0, SCIF1,
HSCIF0, HSCIF1 };
-static struct plat_sci_port scif[] __initdata = {
+static const struct plat_sci_port scif[] __initdata = {
SCIFA_DATA(SCIFA0, 0xe6c40000, gic_spi(144)), /* SCIFA0 */
SCIFA_DATA(SCIFA1, 0xe6c50000, gic_spi(145)), /* SCIFA1 */
SCIFB_DATA(SCIFB0, 0xe6c20000, gic_spi(148)), /* SCIFB0 */
@@ -131,11 +132,11 @@ static inline void r8a7790_register_scif(int idx)
sizeof(struct plat_sci_port));
}
-static struct renesas_irqc_config irqc0_data __initdata = {
+static const struct renesas_irqc_config irqc0_data __initdata = {
.irq_base = irq_pin(0), /* IRQ0 -> IRQ3 */
};
-static struct resource irqc0_resources[] __initdata = {
+static const struct resource irqc0_resources[] __initdata = {
DEFINE_RES_MEM(0xe61c0000, 0x200), /* IRQC Event Detector Block_0 */
DEFINE_RES_IRQ(gic_spi(0)), /* IRQ0 */
DEFINE_RES_IRQ(gic_spi(1)), /* IRQ1 */
@@ -150,7 +151,7 @@ static struct resource irqc0_resources[] __initdata = {
&irqc##idx##_data, \
sizeof(struct renesas_irqc_config))
-static struct resource thermal_resources[] __initdata = {
+static const struct resource thermal_resources[] __initdata = {
DEFINE_RES_MEM(0xe61f0000, 0x14),
DEFINE_RES_MEM(0xe61f0100, 0x38),
DEFINE_RES_IRQ(gic_spi(69)),
@@ -161,13 +162,13 @@ static struct resource thermal_resources[] __initdata = {
thermal_resources, \
ARRAY_SIZE(thermal_resources))
-static struct sh_timer_config cmt00_platform_data __initdata = {
+static const struct sh_timer_config cmt00_platform_data __initdata = {
.name = "CMT00",
.timer_bit = 0,
.clockevent_rating = 80,
};
-static struct resource cmt00_resources[] __initdata = {
+static const struct resource cmt00_resources[] __initdata = {
DEFINE_RES_MEM(0xffca0510, 0x0c),
DEFINE_RES_MEM(0xffca0500, 0x04),
DEFINE_RES_IRQ(gic_spi(142)), /* CMT0_0 */
@@ -276,7 +277,7 @@ void __init r8a7790_init_delay(void)
#ifdef CONFIG_USE_OF
-static const char *r8a7790_boards_compat_dt[] __initdata = {
+static const char * const r8a7790_boards_compat_dt[] __initdata = {
"renesas,r8a7790",
NULL,
};
--
1.8.1.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2 2/9] ARM: shmobile: r8a7790: Constify platform data and resources
2013-08-07 22:56 [PATCH v2 2/9] ARM: shmobile: r8a7790: Constify platform data and resources Laurent Pinchart
@ 2013-08-08 11:11 ` Sergei Shtylyov
2013-08-08 11:22 ` Laurent Pinchart
1 sibling, 0 replies; 3+ messages in thread
From: Sergei Shtylyov @ 2013-08-08 11:11 UTC (permalink / raw)
To: linux-sh
Hello.
On 08-08-2013 2:56, Laurent Pinchart wrote:
> Platform data and resources for core devices are kmemdup()ed when the
> corresponding devices are registered and can thus be declared as const.
> Do so.
> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
> ---
> arch/arm/mach-shmobile/setup-r8a7790.c | 21 +++++++++++----------
> 1 file changed, 11 insertions(+), 10 deletions(-)
> diff --git a/arch/arm/mach-shmobile/setup-r8a7790.c b/arch/arm/mach-shmobile/setup-r8a7790.c
> index d0f5c9f..988266e 100644
> --- a/arch/arm/mach-shmobile/setup-r8a7790.c
> +++ b/arch/arm/mach-shmobile/setup-r8a7790.c
> @@ -31,17 +31,18 @@
> #include <mach/r8a7790.h>
> #include <asm/mach/arch.h>
>
> -static struct resource pfc_resources[] __initdata = {
> +static const struct resource pfc_resources[] __initdata = {
I think *const* data should be annotated with '__initconst', no?
WBR, Sergei
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2 2/9] ARM: shmobile: r8a7790: Constify platform data and resources
2013-08-07 22:56 [PATCH v2 2/9] ARM: shmobile: r8a7790: Constify platform data and resources Laurent Pinchart
2013-08-08 11:11 ` Sergei Shtylyov
@ 2013-08-08 11:22 ` Laurent Pinchart
1 sibling, 0 replies; 3+ messages in thread
From: Laurent Pinchart @ 2013-08-08 11:22 UTC (permalink / raw)
To: linux-sh
Hi Sergei,
On Thursday 08 August 2013 15:11:39 Sergei Shtylyov wrote:
> On 08-08-2013 2:56, Laurent Pinchart wrote:
> > Platform data and resources for core devices are kmemdup()ed when the
> > corresponding devices are registered and can thus be declared as const.
> > Do so.
> >
> > Signed-off-by: Laurent Pinchart
> > <laurent.pinchart+renesas@ideasonboard.com>
> > ---
> >
> > arch/arm/mach-shmobile/setup-r8a7790.c | 21 +++++++++++----------
> > 1 file changed, 11 insertions(+), 10 deletions(-)
> >
> > diff --git a/arch/arm/mach-shmobile/setup-r8a7790.c
> > b/arch/arm/mach-shmobile/setup-r8a7790.c index d0f5c9f..988266e 100644
> > --- a/arch/arm/mach-shmobile/setup-r8a7790.c
> > +++ b/arch/arm/mach-shmobile/setup-r8a7790.c
> > @@ -31,17 +31,18 @@
> >
> > #include <mach/r8a7790.h>
> > #include <asm/mach/arch.h>
> >
> > -static struct resource pfc_resources[] __initdata = {
> > +static const struct resource pfc_resources[] __initdata = {
>
> I think *const* data should be annotated with '__initconst', no?
You're absolutely right.
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-08-08 11:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-07 22:56 [PATCH v2 2/9] ARM: shmobile: r8a7790: Constify platform data and resources Laurent Pinchart
2013-08-08 11:11 ` Sergei Shtylyov
2013-08-08 11:22 ` Laurent Pinchart
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).