Re: "cell-index" vs. "index" vs. no index in I2C device nodes
From: David Gibson <hidden>
Date: 2008-06-05 22:56:37
From: David Gibson <hidden>
Date: 2008-06-05 22:56:37
On Thu, Jun 05, 2008 at 02:16:41PM -0500, Timur Tabi wrote:
Grant Likely wrote:quoted
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 aren't trivially reversible, but it shouldn't be too hard to write a helper function which will do the scan and parse you describe. -- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson