mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-10 23:24:38 +00:00
dm: core: add ofnode_for_each_compatible_node()
Add a helper to iterate over all nodes with a given compatible string. Signed-off-by: Michael Walle <michael@walle.cc> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
This commit is contained in:
parent
c7155d29fb
commit
b8ec9458a3
1 changed files with 24 additions and 0 deletions
|
@ -1009,6 +1009,30 @@ ofnode ofnode_by_prop_value(ofnode from, const char *propname,
|
|||
ofnode_valid(node); \
|
||||
node = ofnode_next_subnode(node))
|
||||
|
||||
/**
|
||||
* ofnode_for_each_compatible_node() - iterate over all nodes with a given
|
||||
* compatible string
|
||||
*
|
||||
* @node: child node (ofnode, lvalue)
|
||||
* @compat: compatible string to match
|
||||
*
|
||||
* This is a wrapper around a for loop and is used like so:
|
||||
*
|
||||
* ofnode node;
|
||||
*
|
||||
* ofnode_for_each_compatible_node(node, parent, compatible) {
|
||||
* Use node
|
||||
* ...
|
||||
* }
|
||||
*
|
||||
* Note that this is implemented as a macro and @node is used as
|
||||
* iterator in the loop.
|
||||
*/
|
||||
#define ofnode_for_each_compatible_node(node, compat) \
|
||||
for (node = ofnode_by_compatible(ofnode_null(), compat); \
|
||||
ofnode_valid(node); \
|
||||
node = ofnode_by_compatible(node, compat))
|
||||
|
||||
/**
|
||||
* ofnode_get_child_count() - get the child count of a ofnode
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue