[RFC PATCH 1/5] of: property: Add in-ports/out-ports support to of_fwnode_graph_get_port_parent()

From: Sunil V L

Date: Tue Sep 29 2026 - 05:05:17 EST


From: Sunil V L <sunilvl@xxxxxxxxxxxxxxxx>

Similar to its OF counterpart, the helper
of_fwnode_graph_get_port_parent() should also treat "in-ports" and
"out-ports" as container nodes. Without this, fwnode_* interfaces may
incorrectly return these nodes as port parents.

Extend the check to skip "in-ports" and "out-ports" so that the
correct parent node is returned. This change helps in using the
fwnode_* interface instead of OF-specific helpers.

This change is similar to commit 8f1e0d791b528 ("of: property: Add
in-ports/out-ports support to of_graph_get_port_parent()"), which
addressed the same issue in the OF specific handler.

Signed-off-by: Sunil V L <sunilvl@xxxxxxxxxxxxxxxx>
---
drivers/of/property.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/of/property.c b/drivers/of/property.c
index 72cf12907de0..c259ac1f0457 100644
--- a/drivers/of/property.c
+++ b/drivers/of/property.c
@@ -1228,7 +1228,9 @@ of_fwnode_graph_get_port_parent(struct fwnode_handle *fwnode)
return NULL;

/* Is this the "ports" node? If not, it's the port parent. */
- if (!of_node_name_eq(np, "ports"))
+ if (!of_node_name_eq(np, "ports") &&
+ !of_node_name_eq(np, "in-ports") &&
+ !of_node_name_eq(np, "out-ports"))
return of_fwnode_handle(np);

return of_fwnode_handle(of_get_next_parent(np));
--
2.43.0