@@ -717,13 +717,7 @@ struct device_node *of_graph_get_next_endpoint(const struct device_node *parent,
717
717
* parent port node.
718
718
*/
719
719
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 );
727
721
if (!port ) {
728
722
pr_debug ("graph: no port node found in %pOF\n" , parent );
729
723
return NULL ;
@@ -741,7 +735,7 @@ struct device_node *of_graph_get_next_endpoint(const struct device_node *parent,
741
735
* getting the next child. If the previous endpoint is NULL this
742
736
* will return the first child.
743
737
*/
744
- endpoint = of_get_next_child (port , prev );
738
+ endpoint = of_graph_get_next_port_endpoint (port , prev );
745
739
if (endpoint ) {
746
740
of_node_put (port );
747
741
return endpoint ;
@@ -750,11 +744,9 @@ struct device_node *of_graph_get_next_endpoint(const struct device_node *parent,
750
744
/* No more endpoints under this port, try the next one. */
751
745
prev = NULL ;
752
746
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 ;
758
750
}
759
751
}
760
752
EXPORT_SYMBOL (of_graph_get_next_endpoint );
0 commit comments