of: property: Fix the semantics of of_is_ancestor_of()

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: a3e1d1a7f5 ("of: property: Add functional dependency link from DT bindings")
Signed-off-by: Saravana Kannan <saravanak@google.com>
Link: https://lore.kernel.org/r/20191120080230.16007-1-saravanak@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Saravana Kannan 2019-11-20 00:02:29 -08:00 committed by Greg Kroah-Hartman
parent 60774d2af0
commit 3883539140
1 changed files with 3 additions and 3 deletions

View File

@ -993,11 +993,11 @@ static bool of_is_ancestor_of(struct device_node *test_ancestor,
while (child) { while (child) {
if (child == test_ancestor) { if (child == test_ancestor) {
of_node_put(child); of_node_put(child);
return false; return true;
} }
child = of_get_next_parent(child); child = of_get_next_parent(child);
} }
return true; return false;
} }
/** /**
@ -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 * descendant nodes. By definition, a child node can't be a functional
* dependency for the parent node. * 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); dev_dbg(dev, "Not linking to %pOFP - is descendant\n", sup_np);
of_node_put(sup_np); of_node_put(sup_np);
return -EINVAL; return -EINVAL;