Skip to content

Commit

Permalink
of/unittest: remove use of node name pointer in overlay high level test
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Rob Herring committed Sep 4, 2018
1 parent 5736184 commit b610e2f
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions drivers/of/unittest.c
Original file line number Diff line number Diff line change
Expand Up @@ -2347,11 +2347,14 @@ 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);
return;
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;
}
}
}

Expand Down

0 comments on commit b610e2f

Please sign in to comment.