From mboxrd@z Thu Jan 1 00:00:00 1970 From: Scott Wood Date: Fri, 30 Jan 2009 15:22:12 -0600 Subject: [U-Boot] [RFC] fdt expert advice needed In-Reply-To: <49836EA8.4080008@freescale.com> References: <200901302211.18504.matthias.fuchs@esd-electronics.com> <49836EA8.4080008@freescale.com> Message-ID: <49836F84.2090000@freescale.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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