From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Fri, 6 Jun 2008 08:56:37 +1000 From: David Gibson To: Timur Tabi Subject: Re: "cell-index" vs. "index" vs. no index in I2C device nodes Message-ID: <20080605225637.GG30980@yookeroo.seuss> References: <48480987.1070701@freescale.com> <484810A3.5070301@freescale.com> <20080605112122.0381a338@zod.rchland.ibm.com> <48481373.8010706@freescale.com> <20080605132735.3433f2af@zod.rchland.ibm.com> <20080605135625.562d1dbe@zod.rchland.ibm.com> <48483B99.3010300@freescale.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii In-Reply-To: <48483B99.3010300@freescale.com> Cc: Scott Wood , Stefan Roese , linuxppc-dev@ozlabs.org List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On Thu, Jun 05, 2008 at 02:16:41PM -0500, Timur Tabi wrote: > Grant Likely wrote: > > > 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