diff options
author | Philipp Zabel <p.zabel@pengutronix.de> | 2016-05-03 08:37:13 -0400 |
---|---|---|
committer | Philipp Zabel <p.zabel@pengutronix.de> | 2016-05-30 03:14:00 -0400 |
commit | 620011e0477e485fc6112ace3c0a772130e8fd4f (patch) | |
tree | fa539893388b422f0290437cd0f7d15a81c934a8 | |
parent | ee89686631174fa576e61400ac3580722edac120 (diff) |
drm/imx: imx-ldb: use of_graph_get_endpoint_by_regs helper
Instead of using of_graph_get_port_by_id() to get the port and then
of_get_child_by_name() to get the first endpoint, get to the endpoint
in a single step.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
-rw-r--r-- | drivers/gpu/drm/imx/imx-ldb.c | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/drivers/gpu/drm/imx/imx-ldb.c b/drivers/gpu/drm/imx/imx-ldb.c index f506e8dd76cb..5f8f0bf45a62 100644 --- a/drivers/gpu/drm/imx/imx-ldb.c +++ b/drivers/gpu/drm/imx/imx-ldb.c | |||
@@ -558,7 +558,7 @@ static int imx_ldb_bind(struct device *dev, struct device *master, void *data) | |||
558 | for_each_child_of_node(np, child) { | 558 | for_each_child_of_node(np, child) { |
559 | struct imx_ldb_channel *channel; | 559 | struct imx_ldb_channel *channel; |
560 | struct device_node *ddc_node; | 560 | struct device_node *ddc_node; |
561 | struct device_node *port; | 561 | struct device_node *ep; |
562 | 562 | ||
563 | ret = of_property_read_u32(child, "reg", &i); | 563 | ret = of_property_read_u32(child, "reg", &i); |
564 | if (ret || i < 0 || i > 1) | 564 | if (ret || i < 0 || i > 1) |
@@ -581,22 +581,23 @@ static int imx_ldb_bind(struct device *dev, struct device *master, void *data) | |||
581 | * The output port is port@4 with an external 4-port mux or | 581 | * The output port is port@4 with an external 4-port mux or |
582 | * port@2 with the internal 2-port mux. | 582 | * port@2 with the internal 2-port mux. |
583 | */ | 583 | */ |
584 | port = of_graph_get_port_by_id(child, imx_ldb->lvds_mux ? 4 : 2); | 584 | ep = of_graph_get_endpoint_by_regs(child, |
585 | if (port) { | 585 | imx_ldb->lvds_mux ? 4 : 2, |
586 | struct device_node *endpoint, *remote; | 586 | -1); |
587 | 587 | if (ep) { | |
588 | endpoint = of_get_child_by_name(port, "endpoint"); | 588 | struct device_node *remote; |
589 | if (endpoint) { | 589 | |
590 | remote = of_graph_get_remote_port_parent(endpoint); | 590 | remote = of_graph_get_remote_port_parent(ep); |
591 | if (remote) | 591 | of_node_put(ep); |
592 | channel->panel = of_drm_find_panel(remote); | 592 | if (remote) |
593 | else | 593 | channel->panel = of_drm_find_panel(remote); |
594 | return -EPROBE_DEFER; | 594 | else |
595 | if (!channel->panel) { | 595 | return -EPROBE_DEFER; |
596 | dev_err(dev, "panel not found: %s\n", | 596 | of_node_put(remote); |
597 | remote->full_name); | 597 | if (!channel->panel) { |
598 | return -EPROBE_DEFER; | 598 | dev_err(dev, "panel not found: %s\n", |
599 | } | 599 | remote->full_name); |
600 | return -EPROBE_DEFER; | ||
600 | } | 601 | } |
601 | } | 602 | } |
602 | 603 | ||