1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-09-01 08:42:12 +02:00

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>
This commit is contained in:
Simon Glass
2017-08-05 15:45:54 -06:00
parent 8639f69a61
commit 3991f42ed2
5 changed files with 33 additions and 15 deletions

View File

@@ -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;