"cell-index" vs. "index" vs. no index in I2C device nodes

Segher Boessenkool segher at kernel.crashing.org
Fri Jun 6 07:31:25 EST 2008


>> No; use an alias in the aliases node.  That is what aliases is 
>> designed
>> for.  Something like 'index' is a reinvention of the wheel.
>
> Do aliases work in reverse?  That is, if I have a pointer to a device 
> node, can
> I look up its alias directly?  Or do I have to scan the aliases node 
> and do a
> comparison of each phandle, one at a time, until I find a match?  And 
> when I
> find a match, will I need to do sscanf() in order to extract the 
> actual index
> value from the property?

Aliases are one-way.  You can have multiple aliases point to the same 
node,
as well (and that is quite common, even).

If you need a unique identifier for an OF node, use its phandle.
It sounds to me like you just need to set up a mapping between
phandles and Linux i2c bus ids here?


Segher




More information about the Linuxppc-dev mailing list