diff mbox

[4/4] ARM: shmobile: lager: Make spi_flash_data const

Message ID 1388764128-27686-4-git-send-email-geert@linux-m68k.org (mailing list archive)
State Accepted
Commit d422c451a9795c7a10c3ae1ab7ca87ce7518546b
Headers show

Commit Message

Geert Uytterhoeven Jan. 3, 2014, 3:48 p.m. UTC
From: Geert Uytterhoeven <geert+renesas@linux-m68k.org>

Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
---
 arch/arm/mach-shmobile/board-lager.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Simon Horman Jan. 6, 2014, 2:31 a.m. UTC | #1
On Fri, Jan 03, 2014 at 04:48:48PM +0100, Geert Uytterhoeven wrote:
> From: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
> ---
>  arch/arm/mach-shmobile/board-lager.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm/mach-shmobile/board-lager.c b/arch/arm/mach-shmobile/board-lager.c
> index f20c10a18543..40ace7195f84 100644
> --- a/arch/arm/mach-shmobile/board-lager.c
> +++ b/arch/arm/mach-shmobile/board-lager.c
> @@ -263,7 +263,7 @@ static struct mtd_partition spi_flash_part[] = {
>  	},
>  };
>  
> -static struct flash_platform_data spi_flash_data = {
> +static const struct flash_platform_data spi_flash_data = {
>  	.name           = "m25p80",
>  	.parts          = spi_flash_part,
>  	.nr_parts       = ARRAY_SIZE(spi_flash_part),

Should spi_flash_part also be const?

And should flash_platform_data and spi_flash_part be annotated
as __initconst?
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Geert Uytterhoeven Jan. 6, 2014, 8:09 a.m. UTC | #2
On Mon, Jan 6, 2014 at 3:31 AM, Simon Horman <horms@verge.net.au> wrote:
>> -static struct flash_platform_data spi_flash_data = {
>> +static const struct flash_platform_data spi_flash_data = {
>>       .name           = "m25p80",
>>       .parts          = spi_flash_part,
>>       .nr_parts       = ARRAY_SIZE(spi_flash_part),
>
> Should spi_flash_part also be const?

No, .parts is a non-const pointer (but perhaps it can be made const, but that
may be more invasive, and have side-effects).

> And should flash_platform_data and spi_flash_part be annotated
> as __initconst?

AFAIU, those are not copied.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Simon Horman Jan. 7, 2014, 1:16 a.m. UTC | #3
On Mon, Jan 06, 2014 at 09:09:53AM +0100, Geert Uytterhoeven wrote:
> On Mon, Jan 6, 2014 at 3:31 AM, Simon Horman <horms@verge.net.au> wrote:
> >> -static struct flash_platform_data spi_flash_data = {
> >> +static const struct flash_platform_data spi_flash_data = {
> >>       .name           = "m25p80",
> >>       .parts          = spi_flash_part,
> >>       .nr_parts       = ARRAY_SIZE(spi_flash_part),
> >
> > Should spi_flash_part also be const?
> 
> No, .parts is a non-const pointer (but perhaps it can be made const, but that
> may be more invasive, and have side-effects).
> 
> > And should flash_platform_data and spi_flash_part be annotated
> > as __initconst?
> 
> AFAIU, those are not copied.

Thanks, I will queue up this patch as is.
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/arch/arm/mach-shmobile/board-lager.c b/arch/arm/mach-shmobile/board-lager.c
index f20c10a18543..40ace7195f84 100644
--- a/arch/arm/mach-shmobile/board-lager.c
+++ b/arch/arm/mach-shmobile/board-lager.c
@@ -263,7 +263,7 @@  static struct mtd_partition spi_flash_part[] = {
 	},
 };
 
-static struct flash_platform_data spi_flash_data = {
+static const struct flash_platform_data spi_flash_data = {
 	.name           = "m25p80",
 	.parts          = spi_flash_part,
 	.nr_parts       = ARRAY_SIZE(spi_flash_part),