linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 7/9] ARM: shmobile: lager: Constify platform data and resources
@ 2013-08-07 22:56 Laurent Pinchart
  2013-08-08 11:37 ` Sergei Shtylyov
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Laurent Pinchart @ 2013-08-07 22:56 UTC (permalink / raw)
  To: linux-sh

Platform data and resources for Lager 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/board-lager.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/arm/mach-shmobile/board-lager.c b/arch/arm/mach-shmobile/board-lager.c
index 4872939..76363f9 100644
--- a/arch/arm/mach-shmobile/board-lager.c
+++ b/arch/arm/mach-shmobile/board-lager.c
@@ -55,7 +55,7 @@ static struct gpio_led lager_leds[] = {
 	},
 };
 
-static __initdata struct gpio_led_platform_data lager_leds_pdata = {
+static const __initdata struct gpio_led_platform_data lager_leds_pdata = {
 	.leds		= lager_leds,
 	.num_leds	= ARRAY_SIZE(lager_leds),
 };
@@ -71,7 +71,7 @@ static struct gpio_keys_button gpio_buttons[] = {
 	GPIO_KEY(KEY_1,		RCAR_GP_PIN(1, 14),	"SW2-pin1"),
 };
 
-static __initdata struct gpio_keys_platform_data lager_keys_pdata = {
+static const __initdata struct gpio_keys_platform_data lager_keys_pdata = {
 	.buttons	= gpio_buttons,
 	.nbuttons	= ARRAY_SIZE(gpio_buttons),
 };
@@ -83,17 +83,17 @@ static struct regulator_consumer_supply fixed3v3_power_consumers[]  };
 
 /* MMCIF */
-static struct sh_mmcif_plat_data mmcif1_pdata __initdata = {
+static const struct sh_mmcif_plat_data mmcif1_pdata __initdata = {
 	.caps		= MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE,
 };
 
-static struct resource mmcif1_resources[] __initdata = {
+static const struct resource mmcif1_resources[] __initdata = {
 	DEFINE_RES_MEM_NAMED(0xee220000, 0x80, "MMCIF1"),
 	DEFINE_RES_IRQ(gic_spi(170)),
 };
 
 /* Ether */
-static struct sh_eth_plat_data ether_pdata __initdata = {
+static const struct sh_eth_plat_data ether_pdata __initdata = {
 	.phy			= 0x1,
 	.edmac_endian		= EDMAC_LITTLE_ENDIAN,
 	.register_type		= SH_ETH_REG_FAST_RCAR,
@@ -101,7 +101,7 @@ static struct sh_eth_plat_data ether_pdata __initdata = {
 	.ether_link_active_low	= 1,
 };
 
-static struct resource ether_resources[] __initdata = {
+static const struct resource ether_resources[] __initdata = {
 	DEFINE_RES_MEM(0xee700000, 0x400),
 	DEFINE_RES_IRQ(gic_spi(162)),
 };
@@ -156,7 +156,7 @@ static void __init lager_add_standard_devices(void)
 					  &ether_pdata, sizeof(ether_pdata));
 }
 
-static const char *lager_boards_compat_dt[] __initdata = {
+static const char * const lager_boards_compat_dt[] __initdata = {
 	"renesas,lager",
 	NULL,
 };
-- 
1.8.1.5


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 7/9] ARM: shmobile: lager: Constify platform data and resources
  2013-08-07 22:56 [PATCH v2 7/9] ARM: shmobile: lager: Constify platform data and resources Laurent Pinchart
@ 2013-08-08 11:37 ` Sergei Shtylyov
  2013-08-08 11:48 ` Laurent Pinchart
  2013-08-09  0:33 ` Simon Horman
  2 siblings, 0 replies; 4+ messages in thread
From: Sergei Shtylyov @ 2013-08-08 11:37 UTC (permalink / raw)
  To: linux-sh

On 08-08-2013 2:56, Laurent Pinchart wrote:

> Platform data and resources for Lager 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/board-lager.c | 14 +++++++-------
>   1 file changed, 7 insertions(+), 7 deletions(-)

> diff --git a/arch/arm/mach-shmobile/board-lager.c b/arch/arm/mach-shmobile/board-lager.c
> index 4872939..76363f9 100644
> --- a/arch/arm/mach-shmobile/board-lager.c
> +++ b/arch/arm/mach-shmobile/board-lager.c
> @@ -55,7 +55,7 @@ static struct gpio_led lager_leds[] = {
>   	},
>   };
>
> -static __initdata struct gpio_led_platform_data lager_leds_pdata = {
> +static const __initdata struct gpio_led_platform_data lager_leds_pdata = {

    Shouldn't it be annotated with '__initconst' now? Also, I've heard that 
the annotation should come last for the data definitions, otherwise it won't 
take effect (is that really true?).

WBR, Sergei


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 7/9] ARM: shmobile: lager: Constify platform data and resources
  2013-08-07 22:56 [PATCH v2 7/9] ARM: shmobile: lager: Constify platform data and resources Laurent Pinchart
  2013-08-08 11:37 ` Sergei Shtylyov
@ 2013-08-08 11:48 ` Laurent Pinchart
  2013-08-09  0:33 ` Simon Horman
  2 siblings, 0 replies; 4+ messages in thread
From: Laurent Pinchart @ 2013-08-08 11:48 UTC (permalink / raw)
  To: linux-sh

Hi Sergei,

On Thursday 08 August 2013 15:37:30 Sergei Shtylyov wrote:
> On 08-08-2013 2:56, Laurent Pinchart wrote:
> > Platform data and resources for Lager 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/board-lager.c | 14 +++++++-------
> >   1 file changed, 7 insertions(+), 7 deletions(-)
> > 
> > diff --git a/arch/arm/mach-shmobile/board-lager.c
> > b/arch/arm/mach-shmobile/board-lager.c index 4872939..76363f9 100644
> > --- a/arch/arm/mach-shmobile/board-lager.c
> > +++ b/arch/arm/mach-shmobile/board-lager.c
> > @@ -55,7 +55,7 @@ static struct gpio_led lager_leds[] = {
> > 
> >   	},
> >   
> >   };
> > 
> > -static __initdata struct gpio_led_platform_data lager_leds_pdata = {
> > +static const __initdata struct gpio_led_platform_data lager_leds_pdata > > {
> 
> Shouldn't it be annotated with '__initconst' now?

Yes it should, like in the other patches. I'll resubmit the series.

> Also, I've heard that the annotation should come last for the data
> definitions, otherwise it won't take effect (is that really true?).

I don't know, but I'll move to __initconst last nonetheless, as that's the 
preferred formatting in the kernel.

-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 7/9] ARM: shmobile: lager: Constify platform data and resources
  2013-08-07 22:56 [PATCH v2 7/9] ARM: shmobile: lager: Constify platform data and resources Laurent Pinchart
  2013-08-08 11:37 ` Sergei Shtylyov
  2013-08-08 11:48 ` Laurent Pinchart
@ 2013-08-09  0:33 ` Simon Horman
  2 siblings, 0 replies; 4+ messages in thread
From: Simon Horman @ 2013-08-09  0:33 UTC (permalink / raw)
  To: linux-sh

On Thu, Aug 08, 2013 at 01:48:20PM +0200, Laurent Pinchart wrote:
> Hi Sergei,
> 
> On Thursday 08 August 2013 15:37:30 Sergei Shtylyov wrote:
> > On 08-08-2013 2:56, Laurent Pinchart wrote:
> > > Platform data and resources for Lager 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/board-lager.c | 14 +++++++-------
> > >   1 file changed, 7 insertions(+), 7 deletions(-)
> > > 
> > > diff --git a/arch/arm/mach-shmobile/board-lager.c
> > > b/arch/arm/mach-shmobile/board-lager.c index 4872939..76363f9 100644
> > > --- a/arch/arm/mach-shmobile/board-lager.c
> > > +++ b/arch/arm/mach-shmobile/board-lager.c
> > > @@ -55,7 +55,7 @@ static struct gpio_led lager_leds[] = {
> > > 
> > >   	},
> > >   
> > >   };
> > > 
> > > -static __initdata struct gpio_led_platform_data lager_leds_pdata = {
> > > +static const __initdata struct gpio_led_platform_data lager_leds_pdata > > > {
> > 
> > Shouldn't it be annotated with '__initconst' now?
> 
> Yes it should, like in the other patches. I'll resubmit the series.
> 
> > Also, I've heard that the annotation should come last for the data
> > definitions, otherwise it won't take effect (is that really true?).
> 
> I don't know, but I'll move to __initconst last nonetheless, as that's the 
> preferred formatting in the kernel.

There seems to be some debate over this,
nonetheless putting it last seems like a good idea.

http://www.spinics.net/lists/arm-kernel/msg264997.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-08-09  0:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-07 22:56 [PATCH v2 7/9] ARM: shmobile: lager: Constify platform data and resources Laurent Pinchart
2013-08-08 11:37 ` Sergei Shtylyov
2013-08-08 11:48 ` Laurent Pinchart
2013-08-09  0:33 ` Simon Horman

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).