
30 Jan
2009
30 Jan
'09
10:22 p.m.
Scott Wood wrote:
Matthias Fuchs wrote:
Now I want to replace the above code to only touch the ns16550 compatible nodes that are direct childs of /plb/opb. Not those under /plb/ebc and even not those under /plb/opb/ebc. This is not easy to do with the fdt API. Below you find my first and dirty hack.
Isn't there a more simple way to do so? Don't bother me about the printf, variable names etc. It's just for discussion.
Take the node that you want to search under (/plb/opb), and pass it to fdt_next_node(), with an initial depth of zero. Continue until depth returns to zero (or less).
I just saw that you want to restrict it to direct children -- for that, ignore any nodes where depth != 1.
-Scott