diff options
author | Rob Herring <robh@kernel.org> | 2018-08-27 09:38:08 -0400 |
---|---|---|
committer | Rob Herring <robh@kernel.org> | 2018-09-04 10:59:45 -0400 |
commit | b610e2ff4622794f4472b7b0e899b3320671d909 (patch) | |
tree | 0d26c581ca954c083d25554cc09b413b4d3d7cc1 /drivers/of/unittest.c | |
parent | 57361846b52bc686112da6ca5368d11210796804 (diff) |
of/unittest: remove use of node name pointer in overlay high level test
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.
Reviewed-by: Frank Rowand <frank.rowand@sony.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Diffstat (limited to 'drivers/of/unittest.c')
-rw-r--r-- | drivers/of/unittest.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c index 722537e14848..7d0073b640bd 100644 --- a/drivers/of/unittest.c +++ b/drivers/of/unittest.c | |||
@@ -2347,11 +2347,14 @@ static __init void of_unittest_overlay_high_level(void) | |||
2347 | } | 2347 | } |
2348 | } | 2348 | } |
2349 | 2349 | ||
2350 | for (np = overlay_base_root->child; np; np = np->sibling) { | 2350 | for_each_child_of_node(overlay_base_root, np) { |
2351 | if (of_get_child_by_name(of_root, np->name)) { | 2351 | struct device_node *base_child; |
2352 | unittest(0, "illegal node name in overlay_base %s", | 2352 | for_each_child_of_node(of_root, base_child) { |
2353 | np->name); | 2353 | if (!strcmp(np->full_name, base_child->full_name)) { |
2354 | return; | 2354 | unittest(0, "illegal node name in overlay_base %pOFn", |
2355 | np); | ||
2356 | return; | ||
2357 | } | ||
2355 | } | 2358 | } |
2356 | } | 2359 | } |
2357 | 2360 | ||