Re: RFC: Platform data for onboard USB assets

Andy Green
2011-03-23T10:11:29Z

On 03/23/2011 09:47 AM, Somebody in the thread at some point said:
>> There is no udev solution for what is being done currently by the async
>> platform_data patchset with SDIO WLAN. The patches are out there and in
>> use already. The only reason I don't post them here as round 2 of the
>> RFC yet is because Grant wanted a couple of days and politically it's
>> expedient for me to agree to that.
>
> Kernel policy has always been that just because some vendor has deployed
> an interface doesn't mean we care one iota about it or consider it an
> argument for the solution. In some cases in fact it bcomes the working
> demo of why it was a bad idea.

To be clear, this is not about any funny business at the interface on
the hardware.

The SDIO patches target wl12xx that is already in mainline and already
using literally platform_data. Because there's no neater way on offer,
it currently -- in mainline -- does it by having a built-in stub with
its own Kconfig, that copies platform_data from the board definition
file into a private malloc'd buffer, then uses it by getting a pointer
to the copy from another private api in the driver. All this in a
specific driver.

Considering the driver for SDIO WLAN modules like this must be told
critical stuff like which irq line they are wired up to, which is an
attribute of the physical board, having the async platform_data support
is making things cleaner and more generic in mainline directly in this
case at least.

>> But there are a huge number of users of platform_data in mainline
>> already we can agree. Are you talking about a mass conversion of those
>> to eliminating platform_data so they use your preferred token query model?
>
> Ultimately that will probably be worth doing once we have some kind of
> meaningful model. We've actually been slowly beating platform devices
> into making more use of the resource data it does have when possible, and
> we have various parsers between platform data and device specific
> platform data structs that are horrible glue-together jobs that it would
> be nice to stomp on.

For devices that are probed asynchronously though, resource and
platform_data have the same issue they can't be attached until the
device is instantiated.

>> I think the first additional effort needs to start at home on that one
>> and think through Device Tree and kernel policy on interoperation with
>> existing driver implementations using platform_data. Just being sniffy
>> about platform_data for reasons you can't back up when challenged won't
>> cut it IMO.
>
> Much of this depends upon what the data is and what it changes. Things
> like interface names for example shouldn't be kernel mangled on the whim
> of random board vendors. They follow a unified behaviour *across*
> platforms, which is what matters most in the bigger picture.
>
> Other stuff is to all intents and purposes sometimes hard coded into
> drivers because while they are USB drivers they are checking specific
> vendor id fields and changing behaviour on them. In some cases those
> vendor id fields are actually a specific hardwired device.

It's the case for even usbnet, which is using a broken heuristic to
decide what to call the interface not even based on vid / pid.

Anyway I am reconciled changing device names to fit the physical board
setup isn't going to fly, it's more important to find out if async
platform_data as a concept will fly.

Before this RFC there's no generic support for the concept, although
that hasn't stopped it being implemented in wl12xx already at individual
mainline driver level. And before this RFC, I don't believe there was
any concept of async tagging through bus path for soldered-on assets in
Device Tree either.

-Andy