All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: linux-sh@vger.kernel.org
Subject: Re: [PATCH][RFC] ARM: shmobile: lager: move res/data into init function
Date: Fri, 11 Apr 2014 12:23:17 +0000	[thread overview]
Message-ID: <5347DEB5.9070802@cogentembedded.com> (raw)
In-Reply-To: <87txa4thq0.wl%kuninori.morimoto.gx@gmail.com>

Hello.

On 11-04-2014 4:39, Kuninori Morimoto wrote:

> Thank you for your review

>>> -static const struct resource du_resources[] __initconst = {
>>> -       DEFINE_RES_MEM(0xfeb00000, 0x70000),
>>> -       DEFINE_RES_MEM_NAMED(0xfeb90000, 0x1c, "lvds.0"),
>>> -       DEFINE_RES_MEM_NAMED(0xfeb94000, 0x1c, "lvds.1"),
>>> -       DEFINE_RES_IRQ(gic_spi(256)),
>>> -       DEFINE_RES_IRQ(gic_spi(268)),
>>> -       DEFINE_RES_IRQ(gic_spi(269)),
>>> -};
>>> -
>>>   static void __init lager_add_du_device(void)
>>>   {
>>> +       struct resource du_resources[] = {
>>> +               DEFINE_RES_MEM(0xfeb00000, 0x70000),
>>> +               DEFINE_RES_MEM_NAMED(0xfeb90000, 0x1c, "lvds.0"),
>>> +               DEFINE_RES_MEM_NAMED(0xfeb94000, 0x1c, "lvds.1"),
>>> +               DEFINE_RES_IRQ(gic_spi(256)),
>>> +               DEFINE_RES_IRQ(gic_spi(268)),
>>> +               DEFINE_RES_IRQ(gic_spi(269)),
>>> +       };

>> Shouldn't the above retain the "static const"?
>> Without the static, there will be additonal code to perform the initialization
>> on the stack.

> "static" is not needed.

    It is needed in order to avoid the extra local variable initialization 
code in this function -- exactly what Geert said.

> Becouse ...

> platform_device_register_xxx()
>   -> platform_device_register_full()
>     -> platform_device_add_resources()
>     -> platform_device_add_data()

> platform_device_add_resources/data() are using kmemdup().
> This means, driver uses alloced and copied resource/data,
> not above one.

    You are answering the question Geert didn't ask. :-)

> Best regards
> ---
> Kuninori Morimoto

WBR, Sergei


  parent reply	other threads:[~2014-04-11 12:23 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-08  7:15 [PATCH][RFC] ARM: shmobile: lager: move res/data into init function Kuninori Morimoto
2014-04-10 19:24 ` Geert Uytterhoeven
2014-04-10 23:07 ` Simon Horman
2014-04-11  0:39 ` Kuninori Morimoto
2014-04-11  0:42 ` Kuninori Morimoto
2014-04-11  9:00 ` Geert Uytterhoeven
2014-04-11 12:23 ` Sergei Shtylyov [this message]
2014-04-14  0:12 ` Kuninori Morimoto
2014-04-14  2:05 ` Simon Horman
2014-04-14  2:08 ` Kuninori Morimoto

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5347DEB5.9070802@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.com \
    --cc=linux-sh@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.