On 11.05.2016 15:25, Andrew Jones wrote: > Don't assume all pbus (cpu physical bus) translations will use the > same number of address and size cells as are defined in the root > node. Use the parent's (which may be the root node), as the spec > tells us to do. > > Signed-off-by: Andrew Jones <drjones@xxxxxxxxxx> > --- > lib/devicetree.c | 13 +++++++++++-- > lib/devicetree.h | 4 ++-- > 2 files changed, 13 insertions(+), 4 deletions(-) > > diff --git a/lib/devicetree.c b/lib/devicetree.c > index a5c7f7c69ddfd..7859968c7a8d2 100644 > --- a/lib/devicetree.c > +++ b/lib/devicetree.c > @@ -82,9 +82,18 @@ int dt_pbus_translate_node(int fdtnode, int regidx, > struct dt_pbus_reg *pbus_reg) > { > struct dt_reg raw_reg; > - int ret; > + u32 nac, nsc; > + int parent, ret; > + > + parent = fdt_parent_offset(fdt, fdtnode); > + if (parent < 0) > + return parent; > > - dt_reg_init(&raw_reg, root_nr_address_cells, root_nr_size_cells); > + ret = dt_get_nr_cells(parent, &nac, &nsc); > + if (ret != 0) > + return ret; > + > + dt_reg_init(&raw_reg, nac, nsc); > > ret = dt_get_reg(fdtnode, regidx, &raw_reg); > if (ret < 0) > diff --git a/lib/devicetree.h b/lib/devicetree.h > index c8c86eeae28b6..d40243a603925 100644 > --- a/lib/devicetree.h > +++ b/lib/devicetree.h > @@ -92,8 +92,8 @@ static inline dt_pbus_addr_t dt_pbus_read_cells(u32 nr_cells, u32 *cells) > > /* > * dt_pbus_translate translates device node regs for the > - * processor bus using the root node's #address-cells and > - * #size-cells and dt_pbus_read_cells() > + * processor bus using the parent node's #address-cells > + * and #size-cells and dt_pbus_read_cells() > * returns > * - zero on success > * - a negative FDT_ERR_* value on failure > Reviewed-by: Thomas Huth <thuth@xxxxxxxxxx> -- 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