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>
diff --git a/arch/arm/mach-tegra/xusb-padctl-common.c b/arch/arm/mach-tegra/xusb-padctl-common.c
index 37b5b8f..abc18c0 100644
--- a/arch/arm/mach-tegra/xusb-padctl-common.c
+++ b/arch/arm/mach-tegra/xusb-padctl-common.c
@@ -224,9 +224,7 @@
config->name = ofnode_get_name(node);
- for (subnode = ofnode_first_subnode(node);
- ofnode_valid(subnode);
- subnode = ofnode_next_subnode(subnode)) {
+ ofnode_for_each_subnode(subnode, node) {
struct tegra_xusb_padctl_group *group;
int err;
@@ -256,9 +254,7 @@
return err;
}
- for (subnode = ofnode_first_subnode(node);
- ofnode_valid(subnode);
- subnode = ofnode_next_subnode(subnode)) {
+ ofnode_for_each_subnode(subnode, node) {
struct tegra_xusb_padctl_config *config = &padctl->config;
debug("%s: subnode=%s\n", __func__, ofnode_get_name(subnode));