Thread (7 messages) 7 messages, 3 authors, 2013-05-06

Re: [PATCH 1/2] Input: touchscreen: ads7846: copy info from pdata to private struct

From: Mark Brown <broonie@kernel.org>
Date: 2013-05-06 10:25:41

On Sun, May 05, 2013 at 08:24:44PM -0700, Dmitry Torokhov wrote:
On Thu, Apr 25, 2013 at 01:33:52PM +0200, Daniel Mack wrote:
quoted
In preparation for DT bindings, we have to store all runtime information
inside struct ads7846. Add more variable to struct ads7846 and refactor
some code so the probe-time supplied pdata is not used from any other
function than the probe() callback.
I think more common pattern is to allocate platform data structure when
parsing device tree, often with devm_kzalloc() so it is cleaned up after
driver is unbound.
Both are used fairly widely.  It's very common to do the separate
allocation when converting an existing driver to device tree as the code
using the platform data is frequently written with lots of pdata-> in it
and may potentially have some different behaviour if there's no platform
data at all (though that's a bit questionable) so allocating a new
struct is pretty natural and makes for a much less invasive patch.  When
there's no existing platform data code it's probably more common to
embed the structure as this saves an allocation and means that the users
can assume that there's a platform data struct there which makes them a
little simpler.

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help