Thread (37 messages) 37 messages, 5 authors, 2024-02-06
STALE849d REVIEWED: 1 (1M)
Revisions (3)
  1. v1 [diff vs current]
  2. v2 [diff vs current]
  3. v3 current

[PATCH v3 13/24] of: property: use of_graph_get_next_port() on of_graph_get_next_endpoint()

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: 2024-01-31 05:06:34
Also in: dri-devel, linux-amlogic, linux-arm-msm, linux-devicetree, linux-media, linux-omap, linux-renesas-soc, linux-samsung-soc, linux-sound, linux-staging, linux-tegra, llvm
Subsystem: open firmware and flattened device tree, the rest · Maintainers: Rob Herring, Saravana Kannan, Linus Torvalds

We have of_graph_get_next_port(), use it on of_graph_get_next_endpoint().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
---
 drivers/of/property.c | 18 ++++--------------
 1 file changed, 4 insertions(+), 14 deletions(-)
diff --git a/drivers/of/property.c b/drivers/of/property.c
index cba07d2af62b..083f92513f5e 100644
--- a/drivers/of/property.c
+++ b/drivers/of/property.c
@@ -694,15 +694,7 @@ struct device_node *of_graph_get_next_device_endpoint(const struct device_node *
 	 * parent port node.
 	 */
 	if (!prev) {
-		struct device_node *node;
-
-		node = of_get_child_by_name(parent, "ports");
-		if (node)
-			parent = node;
-
-		port = of_get_child_by_name(parent, "port");
-		of_node_put(node);
-
+		port = of_graph_get_next_port(parent, NULL);
 		if (!port) {
 			pr_err("graph: no port node found in %pOF\n", parent);
 			return NULL;
@@ -729,11 +721,9 @@ struct device_node *of_graph_get_next_device_endpoint(const struct device_node *
 		/* No more endpoints under this port, try the next one. */
 		prev = NULL;
 
-		do {
-			port = of_get_next_child(parent, port);
-			if (!port)
-				return NULL;
-		} while (!of_node_name_eq(port, "port"));
+		port = of_graph_get_next_port(parent, port);
+		if (!port)
+			return NULL;
 	}
 }
 EXPORT_SYMBOL(of_graph_get_next_device_endpoint);
-- 
2.25.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help