diff mbox series

[1/4] of/unittest: remove use of node name pointer in overlay high level test

Message ID 20180828155254.10709-2-robh@kernel.org
State Accepted
Commit b610e2ff4622794f4472b7b0e899b3320671d909
Headers show
Series [1/4] of/unittest: remove use of node name pointer in overlay high level test | expand

Commit Message

Rob Herring Aug. 28, 2018, 3:52 p.m. UTC
In preparation for removing the node name pointer, it needs to be
removed from of_unittest_overlay_high_level. However, it's not really
correct to use the node name without the unit-address and we should use
the full node name. This most easily done by iterating over the child
nodes with for_each_child_of_node() which is what of_get_child_by_name()
does internally. While at it, we might as well convert the outer loop to
use for_each_child_of_node() too instead of open coding it.

Cc: Frank Rowand <frowand.list@gmail.com>
Signed-off-by: Rob Herring <robh@kernel.org>

---
 drivers/of/unittest.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

-- 
2.17.1
diff mbox series

Patch

diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c
index 722537e14848..69a522e48970 100644
--- a/drivers/of/unittest.c
+++ b/drivers/of/unittest.c
@@ -2347,10 +2347,12 @@  static __init void of_unittest_overlay_high_level(void)
 		}
 	}
 
-	for (np = overlay_base_root->child; np; np = np->sibling) {
-		if (of_get_child_by_name(of_root, np->name)) {
-			unittest(0, "illegal node name in overlay_base %s",
-				np->name);
+	for_each_child_of_node(overlay_base_root, np) {
+		struct device_node *base_child;
+		for_each_child_of_node(of_root, base_child) {
+			if (!strcmp(np->full_name, base_child->full_name))
+				unittest(0, "illegal node name in overlay_base %pOFn",
+					np);
 			return;
 		}
 	}