Re: [PATCH RFC] of: Add of_parse_map_iter() helper for nexus node map iteration
From: Kevin Hilman
Date: Wed Nov 19 2025 - 20:01:41 EST
"Kevin Hilman (TI.com)" <khilman@xxxxxxxxxxxx> writes:
> Add a new helper function of_parse_map_iter() to iterate over nexus
> node maps (c.f. DT spec, section 2.5.1.)
>
> This function provides an iterator interface for traversing map
> entries, handling the complexity of variable-sized entries based on
> <stem>-cells properties, as well as handling the <stem>-skip and
> <stem>-pass-thru properties.
>
> RFC: There's a lot of overlap between this function and
> of_parse_phandle_with_args_map(). However the key differences are:
>
> - of_parse_phandle_with_args_map() does matching
> it searches for an entry that matches specific child args
> - of_parse_map_iter() does iteration
> it simply walks through all entries sequentially
>
> There are likely ways to extract some shared code between these two
> functions into some shared helpers, but I'm hoping someone more
> familiar with this OF code can help here.
>
> However, before refactoring the shared code, it would be good to have
> some feedback on this approach.
For a bit more context, the need for this comes from the work in
drivers/pmdomain to be able to create pmdomain hierarchies using a
power-domain-map property.
I just posted an example user of this functionality here:
https://lore.kernel.org/r/20251119-pmdomain-hierarchy-onecell-v4-0-f25a1d5022f8@xxxxxxxxxxxx
Kevin