Skip to content

Commit 3d4b014

Browse files
morimotorobherring
authored andcommitted
of: property: use new of_graph functions
Current of_graph_get_next_endpoint() can be replaced by using new of_graph_get_next_port(). Signed-off-by: Kuninori Morimoto <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Rob Herring (Arm) <[email protected]>
1 parent 58fe47d commit 3d4b014

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

drivers/of/property.c

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -717,13 +717,7 @@ struct device_node *of_graph_get_next_endpoint(const struct device_node *parent,
717717
* parent port node.
718718
*/
719719
if (!prev) {
720-
struct device_node *node __free(device_node) =
721-
of_get_child_by_name(parent, "ports");
722-
723-
if (node)
724-
parent = node;
725-
726-
port = of_get_child_by_name(parent, "port");
720+
port = of_graph_get_next_port(parent, NULL);
727721
if (!port) {
728722
pr_debug("graph: no port node found in %pOF\n", parent);
729723
return NULL;
@@ -741,7 +735,7 @@ struct device_node *of_graph_get_next_endpoint(const struct device_node *parent,
741735
* getting the next child. If the previous endpoint is NULL this
742736
* will return the first child.
743737
*/
744-
endpoint = of_get_next_child(port, prev);
738+
endpoint = of_graph_get_next_port_endpoint(port, prev);
745739
if (endpoint) {
746740
of_node_put(port);
747741
return endpoint;
@@ -750,11 +744,9 @@ struct device_node *of_graph_get_next_endpoint(const struct device_node *parent,
750744
/* No more endpoints under this port, try the next one. */
751745
prev = NULL;
752746

753-
do {
754-
port = of_get_next_child(parent, port);
755-
if (!port)
756-
return NULL;
757-
} while (!of_node_name_eq(port, "port"));
747+
port = of_graph_get_next_port(parent, port);
748+
if (!port)
749+
return NULL;
758750
}
759751
}
760752
EXPORT_SYMBOL(of_graph_get_next_endpoint);

0 commit comments

Comments
 (0)