RFC: Platform data for onboard USB assets

Andy Green andy at warmcat.com
Sat Mar 19 04:52:13 EST 2011


On 03/18/2011 03:00 PM, Somebody in the thread at some point said:

Hi -

>> You changed your first opinion about tagging "dynamically probed
>> devices" with what is effectively platform_data, cool.
>
> I still don't like the idea of attaching platform_data to more
> devices, when we try to move people away from that in other
> parts of the kernel, because of the known deficiencies.

Whatever way you look at it, data delivered into the driver by Device 
Tree is fundamentally the same action as delivering data into the driver 
by platform_data.  Yes, you query by named element with device context, 
but you end up with the same answer as if you dereference a 
platform_data member.  There are no "known deficiencies" to 
platform_data for this action either, at least, not known to me, I don't 
think lack of typechecking on the pointer itself is an issue given the 
accuracy it can be targeted to a soldered-on-the-board device.

> Passing a MAC address in a device tree property is a
> well-established method that is used on many drivers, and
> is portable across operating systems and architectures.

If you're talking about Device Tree, that itself is not at all "well 
established" let alone servicing drivers from it.  Like I say I don't 
want to seem like I am down on it, but it is very new indeed let's face 
it and few drivers are using it for functional configuration information 
compared to vast numbers using platform_data.

=====> If Device Tree APIs is mandated to implement functionality fixes 
to drivers and platform_data is blocked for this, then we end up with 
different, rotting functionality for platform_data basis and drivers 
that remain broken on the many, many, platforms that don't have and will 
never have Device Tree.  That does NOT sound like the right approach.

I guess the grand plan is to eliminate platform_data by overwhelming it 
with Device Tree refactoring.  But each driver has to be tested and each 
board definition file changed... that is a huge, huge undertaking that 
will not happen in any kind of medium and perhaps not long term either.

So they will have to coexist for a very long while.  A policy of denying 
fixes to platform_data users by enforcing introduction of Device Tree 
APIs and making platform_data users out as troglodytes does not sound 
workable.

> We don't need to implement the entire binding. My point was that
> if we implement a way to attach a device_node to a usb_device, we
> should do it in a way that is compatible with that binding, rather
> than coming up with a new way.

That document is of no interest outside open firmware / Device Tree 
implementation since it is specific to it, and there is no value to 
reference it for a platform_data based solution.

> My impression so far is that attaching a struct device_node to
> static USB devices can be useful in general, but I wouldn't
> go so far to suggest using this for dynamically probed devices.

At least we agree there's no point to target pluggable devices with 
either solution, in which case platform_data and Device Tree provide the 
same end result, plus or minus extra query API.

By the way I intend shortly to extend my patchset to cover Panda WLAN 
case via probed MMC / SDIO device in the same way as USB.  So there will 
then be a second use case for my async platform_data patchset via a 
different subsystem.  Of course, maybe it just doubles the number of 
beatings ^^

-Andy


More information about the devicetree-discuss mailing list