[PATCH] of: fix of_tree_for_each_node_from() macro

Sascha Hauer s.hauer at pengutronix.de
Wed Apr 27 02:04:34 PDT 2016


Hi Boris,

On Tue, Apr 26, 2016 at 08:46:06PM +0200, Boris Brezillon wrote:
> of_tree_for_each_node_from() is supposed to iterate over all DT nodes
> after the one pointed by the from parameter, but with the current
> of_next_node() implementation we cannot access the root node.
> 
> Patch of_next_node() to point to root_node when from is NULL.
> 
> Doing that also simplifies users of of_tree_for_each_node_from() which
> were duplicating the logic to point to the root_node when from is NULL.
> 
> Signed-off-by: Boris Brezillon <boris.brezillon at free-electrons.com>
> ---
> Hi Sacha,
> 
> Not sure this patch is doing exactly what we want, but it fixes a bug
> in the sunxi clk driver I'm working on. This driver declares a
> clk provider using CLK_OF_DECLARE() with the SoC compatible (the
> compatible attached to the root node), which means the clk core code has
> to match the root_node, and with the current of_tree_for_each_node() it
> never tests the root_node.

The patch looks good and I can't find a reason why it shouldn't work as
expected. I applied it for now. Let's see what happens.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list