Subject: Re: [i2c] [PATCH 3/5] powerpc: Document device nodes for I2C devices.

From: David Brownell <[email-masked]>
Date: Fri, 18 May 2007 12:00:31 -0700

On Friday 18 May 2007, Jean Delvare wrote:
> On Fri, 18 May 2007 10:58:06 -0500, Scott Wood wrote:
> > Jean Delvare wrote:
> > > On Thu, 17 May 2007 14:32:11 -0500, Scott Wood wrote:
> > > 
> > >>(and the 
> > >>i2c code in Linux should be fixed to allow drivers to specify multiple 
> > >>match names).
> > > 
> > > 
> > > Back when David proposed his new-style i2c code, I had the same
> > > objection. But we addressed the need differently. If you look at struct
> > > i2c_board_info, you'll see two string fields, driver_name and type. The
> > > former specifies the driver name, the second specifies the exact device
> > > variant. For drivers which support several device variants, the
> > > platform code should fill both fields.
> > 
> > But that still requires the platform to know the driver name, rather 
> > than matching any driver which knows about the type.

Given that the platform (== board/system) may care about the upper layer
of the driver (APIs exposed) not just the lower one (talking-to-hardware),
that seems like a reasonable tradeoff.  It wouldn't want to use the driver
which provides the wrong programming interface!

Plus, to repeat, there is no notion of "type" in I2C.   So in order to
talk about a "type based matching" algorithm you'd have to define one...

> > This prevents the  
> > use of OS-independent device trees (such as in Open Firmware), which 
> > cannot know specific Linux driver names, without something hacky like a 
> > type-to-driver table in the device tree code.
> 
> Oh well, this was also the reason why I objected to David's approach in
> the first place. If you dig back in the i2c list archive, you'll find
> that I was asking for exactly the same thing you do now: that each i2c
> driver would export a list of supported devices, and the i2c-core would
> match a device name against that list (independent of the driver name.)
> It felt more flexible, but I wondered how useful it would be in
> practice, and finally gave up and David had the last word. If you had
> shown up back then rather than now...

With concrete suggestions and patches.  I'd have to dig back in the
list archives to see the details of what was said at that time, but
I don't recall any suggestions being rejected unless they dropped
essential functionality.  (There was one notion to key driver binding
purely on device address, for example...)

- Dave