Subject: Re: "cell-index" vs. "index" vs. no index in I2C device nodes

From: Segher Boessenkool <[email-masked]>
Date: Thu, 5 Jun 2008 17:52:16 +0200

>> if you need explicit indexing then use an alias.  My opinion however
>> is that explicit indexing is unnecessary and is just an artifact of
>> current i2c subsystem internals.  There is already enough information
>> in the device tree to match i2c devices with i2c busses without
>> resorting to indexes.
>
> Not for ALSA SoC V2 devices.  In ASoC V2, the "fabric" driver needs to 
> identify
> the codec by its specific I2C bus and address number.  The codec 
> driver is not
> an OF driver (normally), so it doesn't have access to any OF data.  
> It's just an
> I2C driver, so its given an I2C address and some number that 
> represents an adapter.
>
> Therefore, the fabric driver and the codec driver need to independently
> determine the I2C bus number, and they need to match.  The fabric 
> driver parses
> the OF tree and looks up the cell-index property.  The codec driver 
> uses the
> adapter->nr variable.  The patch I posted ensures that the two contain 
> the same
> number.

Sounds to me like both simply need to use adapter->nr.  For access to
Linux-internal data structures (and that is what this "index" is), you
shouldn't have to go via the device tree.  If the Linux data structures
do not have the information you need, well, fix that.

Segher