Commit 4af642d5 authored by Philipp Zabel's avatar Philipp Zabel

drm/rcar-du: use for_each_endpoint_of_node macro

Using the for_each_... macro should make the code a bit shorter and
easier to read.
Signed-off-by: default avatarPhilipp Zabel <p.zabel@pengutronix.de>
Acked-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
parent 539bb6a2
...@@ -224,12 +224,7 @@ static int rcar_du_encoders_init_one(struct rcar_du_device *rcdu, ...@@ -224,12 +224,7 @@ static int rcar_du_encoders_init_one(struct rcar_du_device *rcdu,
entity_ep_node = of_parse_phandle(ep->local_node, "remote-endpoint", 0); entity_ep_node = of_parse_phandle(ep->local_node, "remote-endpoint", 0);
while (1) { for_each_endpoint_of_node(entity, ep_node) {
ep_node = of_graph_get_next_endpoint(entity, ep_node);
if (!ep_node)
break;
if (ep_node == entity_ep_node) if (ep_node == entity_ep_node)
continue; continue;
...@@ -296,24 +291,19 @@ static int rcar_du_encoders_init_one(struct rcar_du_device *rcdu, ...@@ -296,24 +291,19 @@ static int rcar_du_encoders_init_one(struct rcar_du_device *rcdu,
static int rcar_du_encoders_init(struct rcar_du_device *rcdu) static int rcar_du_encoders_init(struct rcar_du_device *rcdu)
{ {
struct device_node *np = rcdu->dev->of_node; struct device_node *np = rcdu->dev->of_node;
struct device_node *ep_node = NULL; struct device_node *ep_node;
unsigned int num_encoders = 0; unsigned int num_encoders = 0;
/* /*
* Iterate over the endpoints and create one encoder for each output * Iterate over the endpoints and create one encoder for each output
* pipeline. * pipeline.
*/ */
while (1) { for_each_endpoint_of_node(np, ep_node) {
enum rcar_du_output output; enum rcar_du_output output;
struct of_endpoint ep; struct of_endpoint ep;
unsigned int i; unsigned int i;
int ret; int ret;
ep_node = of_graph_get_next_endpoint(np, ep_node);
if (ep_node == NULL)
break;
ret = of_graph_parse_endpoint(ep_node, &ep); ret = of_graph_parse_endpoint(ep_node, &ep);
if (ret < 0) { if (ret < 0) {
of_node_put(ep_node); of_node_put(ep_node);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment