Skip to content

Commit

Permalink
of: property: Fix the semantics of of_is_ancestor_of()
Browse files Browse the repository at this point in the history
The of_is_ancestor_of() function was renamed from of_link_is_valid()
based on review feedback. The rename meant the semantics of the function
had to be inverted, but this was missed in the earlier patch.

So, fix the semantics of of_is_ancestor_of() and invert the conditional
expressions where it is used.

Fixes: a3e1d1a ("of: property: Add functional dependency link from DT bindings")
Signed-off-by: Saravana Kannan <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
Saravana Kannan authored and gregkh committed Nov 21, 2019
1 parent 60774d2 commit 3883539
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/of/property.c
Original file line number Diff line number Diff line change
Expand Up @@ -993,11 +993,11 @@ static bool of_is_ancestor_of(struct device_node *test_ancestor,
while (child) {
if (child == test_ancestor) {
of_node_put(child);
return false;
return true;
}
child = of_get_next_parent(child);
}
return true;
return false;
}

/**
Expand Down Expand Up @@ -1043,7 +1043,7 @@ static int of_link_to_phandle(struct device *dev, struct device_node *sup_np,
* descendant nodes. By definition, a child node can't be a functional
* dependency for the parent node.
*/
if (!of_is_ancestor_of(dev->of_node, sup_np)) {
if (of_is_ancestor_of(dev->of_node, sup_np)) {
dev_dbg(dev, "Not linking to %pOFP - is descendant\n", sup_np);
of_node_put(sup_np);
return -EINVAL;
Expand Down

0 comments on commit 3883539

Please sign in to comment.