Re: [PATCH] powerpc: add of_find_next_property and of_get_aliased_index

2008-06-26 Thread Benjamin Herrenschmidt
+struct property *of_find_next_property(const struct device_node *np, + struct property *prev) +{ + struct property *next; + + if (!np) + return NULL; + + read_lock(devtree_lock); + next = prev ? prev-next : np-properties; +

Re: [PATCH] powerpc: add of_find_next_property and of_get_aliased_index

2008-06-26 Thread Timur Tabi
Segher Boessenkool wrote: Well, yes, your suggested code doesn't allow punctuation either; but that wasn't my point, it doesn't allow numbers in names. Why don't you just parse a number from the end? Oh, you mean start at the end and go backwards? Hmmm, I guess I could do that. The only

Re: [PATCH] powerpc: add of_find_next_property and of_get_aliased_index

2008-06-26 Thread Stefan Roese
On Thursday 26 June 2008, Timur Tabi wrote: The only thing a platform should ever use aliases for is if it needs to (for whatever purpose) find a specific device, that it cannot identify otherwise (via reg, ...). And then that platform code should look up the device by the alias, not look

Re: [PATCH] powerpc: add of_find_next_property and of_get_aliased_index

2008-06-26 Thread Timur Tabi
Stefan Roese wrote: On Thursday 26 June 2008, Timur Tabi wrote: The only thing a platform should ever use aliases for is if it needs to (for whatever purpose) find a specific device, that it cannot identify otherwise (via reg, ...). And then that platform code should look up the device by

[PATCH] powerpc: add of_find_next_property and of_get_aliased_index

2008-06-25 Thread Timur Tabi
Add two functions: of_find_next_property() returns the next in a list of properties for a given node. It's handy when you want a list of properties for a given node, but you don't know what the properties are called. of_get_aliased_node() looks up the aliases in the /aliases node and returns the

Re: [PATCH] powerpc: add of_find_next_property and of_get_aliased_index

2008-06-25 Thread Timur Tabi
Segher Boessenkool wrote: It returns 2 for both i2c-1 and i2c-2. Well, I'm assuming that the alias property names will follow the current convention of nn where is a name and nn is a number. No dashes or other punctuation. Also, alias names do not have any significance in general,

Re: [PATCH] powerpc: add of_find_next_property and of_get_aliased_index

2008-06-25 Thread Segher Boessenkool
It returns 2 for both i2c-1 and i2c-2. Well, I'm assuming that the alias property names will follow the current convention of nn where is a name and nn is a number. No dashes or other punctuation. Well, yes, your suggested code doesn't allow punctuation either; but that wasn't my

Re: [PATCH] powerpc: add of_find_next_property and of_get_aliased_index

2008-06-25 Thread Josh Boyer
On Wed, 2008-06-25 at 15:05 -0500, Timur Tabi wrote: +/** + * Return the first or next property within a node. + * @np: the node + * @prev: if NULL, return 1st prop, otherwise return the prop after 'prev' + * + * This function is used to get a list of properties within a node. It's + *