From: shawn.guo@freescale.com (Shawn Guo)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/2] Input: gpio-keys: do not reference platform_data after .probe exits
Date: Tue, 19 Jul 2011 16:56:05 +0800 [thread overview]
Message-ID: <20110719085604.GI3838@S2100-06.ap.freescale.net> (raw)
In-Reply-To: <20110719074841.GB26574@n2100.arm.linux.org.uk>
On Tue, Jul 19, 2011 at 08:48:41AM +0100, Russell King - ARM Linux wrote:
> On Tue, Jul 19, 2011 at 09:17:26AM +0800, Shawn Guo wrote:
> > On Mon, Jul 18, 2011 at 10:02:44AM -0700, Dmitry Torokhov wrote:
> > > On Monday, July 18, 2011 09:45:07 AM Shawn Guo wrote:
> > > > The patch makes a copy of platform data into driver data, so that any
> > > > reference to platform_data after .probe exits can be avoided.
> > >
> > > And why is this beneficial? I am of the opinion that platform data should
> > > stay on (and be accessed through a const pointer to ensure that the driver
> > > will not alter it).
> > >
> > To me, it's a common sense that platform data should not be referenced
> > after .probe exits, so that any platform code providing the data can
> > claim the data as __initconst.
>
> That's totally buggered, and that's putting it kindly.
>
Well, you can tell I'm an idiot, but I was not trying to do what you
say here.
> Consider a driver built as a module, vs built-in. If you build it as a
> module, your driver data is stale by the time you insert the module.
> It's not much better with it built-in - if you have hotplug enabled, you
> can unbind and rebind the driver, which means that the .probe function
> can be called long after the .init sections have been discarded.
>
> So no, this is no justification for the patch.
>
> Don't *ever* make any platform devices or any data pointed to by a
> platform device discardable after init time. It's an oops waiting to
> happen.
>
Something learnt. Thanks, Russell.
--
Regards,
Shawn
next prev parent reply other threads:[~2011-07-19 8:56 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-18 16:45 [PATCH 0/2] add device tree probe support for gpio_keys Shawn Guo
2011-07-18 16:45 ` [PATCH 1/2] Input: gpio-keys: do not reference platform_data after .probe exits Shawn Guo
2011-07-18 17:02 ` Dmitry Torokhov
2011-07-18 17:15 ` Grant Likely
2011-07-18 17:24 ` Dmitry Torokhov
2011-07-19 1:17 ` Shawn Guo
2011-07-19 7:48 ` Russell King - ARM Linux
2011-07-19 8:56 ` Shawn Guo [this message]
2011-07-18 16:45 ` [PATCH 2/2] Input: gpio-keys: add device tree probe support Shawn Guo
2011-07-18 17:05 ` Dmitry Torokhov
2011-07-19 1:22 ` Shawn Guo
2011-07-19 3:55 ` Shawn Guo
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=20110719085604.GI3838@S2100-06.ap.freescale.net \
--to=shawn.guo@freescale.com \
--cc=linux-arm-kernel@lists.infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox