Hi Rob
I think we should get rid of or minimize of_graph_get_next_endpoint() in its current form. In general, drivers should be asking for a specific port number because their function is fixed in the binding. Iterating over endpoints within a port is okay as that's usually a selecting 1 of N operation.
Most cases are in the form of of_graph_get_next_endpoint(dev, NULL) which is equivalent to of_graph_get_endpoint_by_regs(dev, 0, 0). Technically, -1 instead of 0 is equivalent, but I'd argue is sloppy and wrong.
I also added of_graph_get_remote_node() for this reason and cleaned a lot of these (in DRM) up some time ago. Because in the end, a driver generally just wants the remote device it is connected to and details of parsing the graph should be mostly opaque.
Wouldn't something like this work for this case:
#define for_each_port_endpoint_of_node(parent, port, child) \ for (child = of_graph_get_endpoint_by_regs(parent, port, -1); child != NULL; \ child = of_get_next_child(parent, child))
I see. I will split this patch-set to like below
- patch-set for reduce/remove to using current next_endpoint() - patch-set for rename current next_endpoint() to next_device_endpoint() - patch-set for adding new next_port_endpoint()
Thank you for your help !!
Best regards --- Renesas Electronics Ph.D. Kuninori Morimoto