diff options
| author | Tom Rini <[email protected]> | 2017-09-12 09:32:51 -0400 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2017-09-12 09:32:51 -0400 |
| commit | de2ad2c40db389e4747f566e44aa7f1a1aec91fb (patch) | |
| tree | 76bd1340bc1b8b25e5acffeed74bceea5913969a /include/dm/ofnode.h | |
| parent | d81a1de96e2636163783c342b8fda965e696e382 (diff) | |
| parent | ee87a097b0f66158ce2985940a5f28ba15a3552d (diff) | |
Merge git://git.denx.de/u-boot-dm
Diffstat (limited to 'include/dm/ofnode.h')
| -rw-r--r-- | include/dm/ofnode.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h index de2769ed537..79374b8f91a 100644 --- a/include/dm/ofnode.h +++ b/include/dm/ofnode.h @@ -628,4 +628,28 @@ int ofnode_read_resource(ofnode node, uint index, struct resource *res); int ofnode_read_resource_byname(ofnode node, const char *name, struct resource *res); +/** + * ofnode_for_each_subnode() - iterate over all subnodes of a parent + * + * @node: child node (ofnode, lvalue) + * @parent: parent node (ofnode) + * + * This is a wrapper around a for loop and is used like so: + * + * ofnode node; + * + * ofnode_for_each_subnode(node, parent) { + * Use node + * ... + * } + * + * Note that this is implemented as a macro and @node is used as + * iterator in the loop. The parent variable can be a constant or even a + * literal. + */ +#define ofnode_for_each_subnode(node, parent) \ + for (node = ofnode_first_subnode(parent); \ + ofnode_valid(node); \ + node = ofnode_next_subnode(node)) + #endif |
