Skip to contentSkip to conversation

of: property: Fix the semantics of of_is_ancestor_of()

PATCH In review Saravana Kannan 2 participants 4 messages Nov 20, 2019 – Nov 21, 2019 Device tree

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

Cc Greg Kroah-Hartman <[email protected]>
---
 drivers/of/property.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/of/property.c +3 -3
index dedbf82da838..0de1e7e69b6e 100644
@@ -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;
 }
 
 /**
@@ -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;
Signature · 1 line
2.24.0.432.g9d3f5f5b63-goog
#1 lore raw
Quoted 4 lines · Saravana Kannan

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.

Quoted 8 lines

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

Cc Greg Kroah-Hartman <[email protected]>
---
 drivers/of/property.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

What git commit does this patch fix?

thanks,

greg k-h

#2 lore raw
Quoted 9 lines · Greg Kroah-Hartman
Quoted 7 lines · Saravana Kannan

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.

Quoted 8 lines
Quoted 5 lines
Cc Greg Kroah-Hartman <[email protected]>
---
 drivers/of/property.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

What git commit does this patch fix?

Fixes commit a3e1d1a7f5fcc. Let me know if you want me to send a v2 or if you can fix up the commit text on your end.

Thanks,
Saravana

-Saravana

#3 lore raw
Quoted 17 lines · Saravana Kannan
Quoted 15 lines · Greg Kroah-Hartman
Quoted 12 lines · Saravana Kannan

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.

Cc Greg Kroah-Hartman <[email protected]>
---
 drivers/of/property.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
Quoted 5 lines
Quoted 2 lines

What git commit does this patch fix?

Fixes commit a3e1d1a7f5fcc. Let me know if you want me to send a v2 or if you can fix up the commit text on your end.

I'll fix it up.