[PATCH 3.6.0-rc5] dt: introduce of_get_child to get child node by name.
Stephen Warren
swarren at wwwdotorg.org
Fri Sep 14 01:48:50 EST 2012
On 09/13/2012 09:43 AM, Rob Herring wrote:
> On 09/13/2012 10:25 AM, Srinivas KANDAGATLA wrote:
>>
>> On 13/09/12 16:14, Stephen Warren wrote:
>>> On 09/13/2012 05:10 AM, Srinivas KANDAGATLA wrote:
>>>> From: Srinivas Kandagatla <srinivas.kandagatla at st.com>
>>>>
>>>> This patch introduces of_get_child function to get a child node by its
>>>> name in a given parent node.
>>>>
>>>> Without this patch each driver code has to iterate the parent and do
>>>> a string compare, However having of_get_child libary function would
>>>> avoid code duplication, errors and is more convenient.
>>>>
>>>> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla at st.com>
>>> You forgot to Cc the drivers/of maintainers, Grant and Rob. I have here.
>>
>> Oops...
>>
>>>
>>> I can certainly see a use for this in many places; the "runtime
>>> interpreted power sequences" patch, and the regulator DT parsing code at
>>> least both could benefit from this.
>
> I would think the power sequences code would always iterate over the nodes.
There are two stages to the power sequences code; the first finds the
"power-sequences" child node in the device itself (and should use this
new API), and the next iterates over all children in that node, and then
all children in those nodes.
>> There are at-least 7-8 places in the current kernel which could use this
>> function directly.
>
> Care to point them out and preferably fix them then. That would be more
> convincing that this is needed.
drivers/mfd/tps6586x:tps6586x_parse_dt()'s call to
of_find_node_by_name() should be replaced by this function.
drivers/regulator/max8907-regulator.c:max8907_regulator_parse_dt() has
the same issue.
drivers/regulator/tps65910-regulator.c:tps65910_parse_dt_reg_data() has
the same issue.
Perhaps other regulators too; those are just the ones used on my platforms.
At least some of those three will be added during the 3.7 merge window,
so it'd be hard to fix in this patch without merging in a bunch of
dependencies first.
More information about the devicetree-discuss
mailing list