Skip to content

Commit

Permalink
of: property: use new of_graph functions
Browse files Browse the repository at this point in the history
Current of_graph_get_next_endpoint() can be replaced by using
new of_graph_get_next_port().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87iktib5t0.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
  • Loading branch information
Kuninori Morimoto authored and Rob Herring (Arm) committed Oct 24, 2024
1 parent 58fe47d commit 3d4b014
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions drivers/of/property.c
Original file line number Diff line number Diff line change
Expand Up @@ -717,13 +717,7 @@ struct device_node *of_graph_get_next_endpoint(const struct device_node *parent,
* parent port node.
*/
if (!prev) {
struct device_node *node __free(device_node) =
of_get_child_by_name(parent, "ports");

if (node)
parent = node;

port = of_get_child_by_name(parent, "port");
port = of_graph_get_next_port(parent, NULL);
if (!port) {
pr_debug("graph: no port node found in %pOF\n", parent);
return NULL;
Expand All @@ -741,7 +735,7 @@ struct device_node *of_graph_get_next_endpoint(const struct device_node *parent,
* getting the next child. If the previous endpoint is NULL this
* will return the first child.
*/
endpoint = of_get_next_child(port, prev);
endpoint = of_graph_get_next_port_endpoint(port, prev);
if (endpoint) {
of_node_put(port);
return endpoint;
Expand All @@ -750,11 +744,9 @@ struct device_node *of_graph_get_next_endpoint(const struct device_node *parent,
/* 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_endpoint);
Expand Down

0 comments on commit 3d4b014

Please sign in to comment.