Hi Petr, Thanks for the review. On Mon, Sep 02, 2019 at 05:18:03PM +0200, Petr Mladek wrote: > On Mon 2019-09-02 11:32:37, Sakari Ailus wrote: > > Instead of implementing our own means of discovering parent nodes, node > > names or counting how many parents a node has, use the newly added > > functions in the fwnode API to obtain that information. > > > > Signed-off-by: Sakari Ailus <sakari.ailus@xxxxxxxxxxxxxxx> > > Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> > > --- > > lib/vsprintf.c | 38 ++++++++++++++++---------------------- > > 1 file changed, 16 insertions(+), 22 deletions(-) > > > > diff --git a/lib/vsprintf.c b/lib/vsprintf.c > > index b00b57f9f911f..a04a2167101ef 100644 > > --- a/lib/vsprintf.c > > +++ b/lib/vsprintf.c > > @@ -1863,32 +1864,24 @@ char *flags_string(char *buf, char *end, void *flags_ptr, > > return format_flags(buf, end, flags, names); > > } > > > > -static const char *device_node_name_for_depth(const struct device_node *np, int depth) > > -{ > > - for ( ; np && depth; depth--) > > - np = np->parent; > > - > > - return kbasename(np->full_name); > > -} > > - > > static noinline_for_stack > > -char *device_node_gen_full_name(const struct device_node *np, char *buf, char *end) > > +char *fwnode_full_name_string(struct fwnode_handle *fwnode, char *buf, > > + char *end) > > { > > int depth; > > - const struct device_node *parent = np->parent; > > > > - /* special case for root node */ > > - if (!parent) > > - return string_nocheck(buf, end, "/", default_str_spec); > > + for (depth = fwnode_count_parents(fwnode); depth >= 0; depth--) { > > It looked suspicious that it iterated "depth + 1" times. It might be > obvious for people traversing paths every day but not for me ;-) > Please, add a comment, for example: > > /* Iterate over parents and current node. */ > > With the above comment: > > Reviewed-by: Petr Mladek <pmladek@xxxxxxxx> Thanks. How about: /* Loop starting from the root node to the current node. */ -- Sakari Ailus sakari.ailus@xxxxxxxxxxxxxxx