[PATCH 3/5] of: of_graph: honour ports subnode
Sascha Hauer
s.hauer at pengutronix.de
Wed Sep 25 07:01:13 PDT 2024
The of_graph ports of a node nowadays are usually collected under a
'ports' subnode instead of being directly under the devices node.
Handle this case correctly.
Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
drivers/of/base.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/of/base.c b/drivers/of/base.c
index fbbc3316fc..398e39340f 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -3271,11 +3271,14 @@ EXPORT_SYMBOL(of_graph_parse_endpoint);
*
* Return: A 'port' node pointer with refcount incremented.
*/
-struct device_node *of_graph_get_port_by_id(struct device_node *node, u32 id)
+struct device_node *of_graph_get_port_by_id(struct device_node *parent, u32 id)
{
- struct device_node *port;
+ struct device_node *port, *node = of_get_child_by_name(parent, "ports");
+
+ if (node)
+ parent = node;
- for_each_child_of_node(node, port) {
+ for_each_child_of_node(parent, port) {
u32 port_id = 0;
if (strncmp(port->name, "port", 4) != 0)
--
2.39.5
More information about the barebox
mailing list