diff options
author | Simon Glass <sjg@chromium.org> | 2017-08-05 15:45:54 -0600 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2017-09-11 21:43:58 -0600 |
commit | 3991f42ed2e38aff28ba3c24369bfbd90620bea7 (patch) | |
tree | 4e91056bedde884d7bec42bf45a32e6a1fcd01e0 /drivers/core/ofnode.c | |
parent | 8639f69a61b47971dba47ab5ed72e47436729bb1 (diff) |
dm: core: Add ofnode_for_each_subnode()
Add a convenience macro to iterate over subnodes of a node. Make use of
this where appropriate in the code.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/core/ofnode.c')
-rw-r--r-- | drivers/core/ofnode.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c index 0685b689d8..c6ca13fabf 100644 --- a/drivers/core/ofnode.c +++ b/drivers/core/ofnode.c @@ -390,10 +390,11 @@ int ofnode_decode_display_timing(ofnode parent, int index, if (!ofnode_valid(timings)) return -EINVAL; - for (i = 0, node = ofnode_first_subnode(timings); - ofnode_valid(node) && i != index; - node = ofnode_first_subnode(node)) - i++; + i = 0; + ofnode_for_each_subnode(node, timings) { + if (i++ == index) + break; + } if (!ofnode_valid(node)) return -EINVAL; |