Thread (2 messages) 2 messages, 2 authors, 2011-07-19

Re: [PATCH 1/2] Input: gpio-keys: do not reference platform_data after .probe exits

From: Russell King - ARM Linux <hidden>
Date: 2011-07-19 07:48:41
Also in: linux-arm-kernel, linux-devicetree

Possibly related (same subject, not in this thread)

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:
quoted
On Monday, July 18, 2011 09:45:07 AM Shawn Guo wrote:
quoted
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.

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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help