aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/imx/imx-drm-core.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2015-04-13 03:28:16 -0400
committerDave Airlie <airlied@redhat.com>2015-04-13 03:28:16 -0400
commitbb1dc08c94ead1b98e750caf535422f79363c1a2 (patch)
tree8e1db4d7b2de470223c7a98aca3e2f47d6d5ed83 /drivers/gpu/drm/imx/imx-drm-core.c
parenta7d6883619584c2dbeeb5f6a1cf86cde6a3993de (diff)
parentecaa4902222fd4d28692203bec028513fbac29c7 (diff)
Merge tag 'of-graph-drm-2015-04-08' of git://git.pengutronix.de/git/pza/linux into drm-next
drm: Use of-graph helpers to loop over endpoints Convert all drm callers that use of_graph_get_next_endpoint to loop over of-graph endpoints to the newly introduced for_each_endpoint_of_node helper macro. * tag 'of-graph-drm-2015-04-08' of git://git.pengutronix.de/git/pza/linux: drm/rockchip: use for_each_endpoint_of_node macro, drop endpoint reference on break drm/rcar-du: use for_each_endpoint_of_node macro drm/imx: use for_each_endpoint_of_node macro in imx_drm_encoder_get_mux_id drm: use for_each_endpoint_of_node macro in drm_of_find_possible_crtcs of: Explicitly include linux/types.h in of_graph.h dt-bindings: brcm: rationalize Broadcom documentation naming of/unittest: replace 'selftest' with 'unittest' Documentation: rename of_selftest.txt to of_unittest.txt Documentation: update the of_selftest.txt dt: OF_UNITTEST make dependency broken MAINTAINERS: Pantelis Antoniou device tree overlay maintainer of: Add of_graph_get_port_by_id function of: Add for_each_endpoint_of_node helper macro of: Decrement refcount of previous endpoint in of_graph_get_next_endpoint
Diffstat (limited to 'drivers/gpu/drm/imx/imx-drm-core.c')
-rw-r--r--drivers/gpu/drm/imx/imx-drm-core.c20
1 files changed, 4 insertions, 16 deletions
diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c
index a002f53aab0e..db2f5a739e05 100644
--- a/drivers/gpu/drm/imx/imx-drm-core.c
+++ b/drivers/gpu/drm/imx/imx-drm-core.c
@@ -431,15 +431,6 @@ int imx_drm_encoder_parse_of(struct drm_device *drm,
431} 431}
432EXPORT_SYMBOL_GPL(imx_drm_encoder_parse_of); 432EXPORT_SYMBOL_GPL(imx_drm_encoder_parse_of);
433 433
434static struct device_node *imx_drm_of_get_next_endpoint(
435 const struct device_node *parent, struct device_node *prev)
436{
437 struct device_node *node = of_graph_get_next_endpoint(parent, prev);
438
439 of_node_put(prev);
440 return node;
441}
442
443/* 434/*
444 * @node: device tree node containing encoder input ports 435 * @node: device tree node containing encoder input ports
445 * @encoder: drm_encoder 436 * @encoder: drm_encoder
@@ -448,7 +439,7 @@ int imx_drm_encoder_get_mux_id(struct device_node *node,
448 struct drm_encoder *encoder) 439 struct drm_encoder *encoder)
449{ 440{
450 struct imx_drm_crtc *imx_crtc = imx_drm_find_crtc(encoder->crtc); 441 struct imx_drm_crtc *imx_crtc = imx_drm_find_crtc(encoder->crtc);
451 struct device_node *ep = NULL; 442 struct device_node *ep;
452 struct of_endpoint endpoint; 443 struct of_endpoint endpoint;
453 struct device_node *port; 444 struct device_node *port;
454 int ret; 445 int ret;
@@ -456,18 +447,15 @@ int imx_drm_encoder_get_mux_id(struct device_node *node,
456 if (!node || !imx_crtc) 447 if (!node || !imx_crtc)
457 return -EINVAL; 448 return -EINVAL;
458 449
459 do { 450 for_each_endpoint_of_node(node, ep) {
460 ep = imx_drm_of_get_next_endpoint(node, ep);
461 if (!ep)
462 break;
463
464 port = of_graph_get_remote_port(ep); 451 port = of_graph_get_remote_port(ep);
465 of_node_put(port); 452 of_node_put(port);
466 if (port == imx_crtc->crtc->port) { 453 if (port == imx_crtc->crtc->port) {
467 ret = of_graph_parse_endpoint(ep, &endpoint); 454 ret = of_graph_parse_endpoint(ep, &endpoint);
455 of_node_put(ep);
468 return ret ? ret : endpoint.port; 456 return ret ? ret : endpoint.port;
469 } 457 }
470 } while (ep); 458 }
471 459
472 return -EINVAL; 460 return -EINVAL;
473} 461}