On Tue, Mar 20, 2012 at 09:56:09AM -0600, Stephen Warren wrote: > On 03/20/2012 09:43 AM, Thierry Reding wrote: > > What would be a good way to represent this in platform data? > I think most get subsystems have a get API that works for both DT and > non-DT, rather than using platform data: Yes, please - having to have explict handling in drivers to select a mechanism to look up stuff in the subsystem would be very sad. > # works in DT right now IIRC: > regulator_get(dev, supply_name) Yes, that's totally transparent to the device. > For board files, this would rely on some table which mapped from the get > parameters to the returned object. IIRC, most of these tables are > indexed by (dev_name(dev), name) and probably return the dev_name() of > the providing device (or whatever internally makes sense to identify the > device) plus some subsystem-specific data (e.g. PWM index). That's how regulator and clk do it (I think pinctrl too, and IIO also does this though it's in staging) - the consumer works with the struct device and the name of the thing it's requesting and the things doing the mapping (boards, SoCs, whatever) map this onto the actual device with a lookup table which works in terms of dev_name() for the requesting device. We use dev_name() because many buses don't make a struct device available until very late in system startup.
Attachment:
signature.asc
Description: Digital signature