On 10.05.2016 19:32, Andrew Jones wrote: > Search up the tree until we find #address-cells/#size-cells. > Also only assign outputs if both address and size are found. > > Signed-off-by: Andrew Jones <drjones@xxxxxxxxxx> > --- > lib/devicetree.c | 17 +++++++++++++---- > lib/devicetree.h | 3 ++- > 2 files changed, 15 insertions(+), 5 deletions(-) > > diff --git a/lib/devicetree.c b/lib/devicetree.c > index a5c7f7c69ddfd..d3751e2b7e7f9 100644 > --- a/lib/devicetree.c > +++ b/lib/devicetree.c > @@ -24,21 +24,30 @@ int dt_get_nr_cells(int fdtnode, u32 *nr_address_cells, u32 *nr_size_cells) > { > const struct fdt_property *prop; > u32 *nr_cells; > - int len; > + int len, nac, nsc; > + > + while (1) { > + prop = fdt_get_property(fdt, fdtnode, "#address-cells", &len); > + if (prop != NULL || len != -FDT_ERR_NOTFOUND) > + break; > + fdtnode = fdt_parent_offset(fdt, fdtnode); > + } Why do you need this search? ePAPR clearly states: "The #address-cells and #size-cells properties are not inherited from ancestors in the device tree. They shall be explicitly defined." So as far as I can see, it should always be enough to look up the properties in the parent of the node, no need for a recursion here? Thomas -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html