Commit 620011e0 authored by Philipp Zabel's avatar Philipp Zabel

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: default avatarPhilipp Zabel <p.zabel@pengutronix.de>
parent ee896866
...@@ -558,7 +558,7 @@ static int imx_ldb_bind(struct device *dev, struct device *master, void *data) ...@@ -558,7 +558,7 @@ static int imx_ldb_bind(struct device *dev, struct device *master, void *data)
for_each_child_of_node(np, child) { for_each_child_of_node(np, child) {
struct imx_ldb_channel *channel; struct imx_ldb_channel *channel;
struct device_node *ddc_node; struct device_node *ddc_node;
struct device_node *port; struct device_node *ep;
ret = of_property_read_u32(child, "reg", &i); ret = of_property_read_u32(child, "reg", &i);
if (ret || i < 0 || i > 1) if (ret || i < 0 || i > 1)
...@@ -581,22 +581,23 @@ static int imx_ldb_bind(struct device *dev, struct device *master, void *data) ...@@ -581,22 +581,23 @@ static int imx_ldb_bind(struct device *dev, struct device *master, void *data)
* The output port is port@4 with an external 4-port mux or * The output port is port@4 with an external 4-port mux or
* port@2 with the internal 2-port mux. * port@2 with the internal 2-port mux.
*/ */
port = of_graph_get_port_by_id(child, imx_ldb->lvds_mux ? 4 : 2); ep = of_graph_get_endpoint_by_regs(child,
if (port) { imx_ldb->lvds_mux ? 4 : 2,
struct device_node *endpoint, *remote; -1);
if (ep) {
endpoint = of_get_child_by_name(port, "endpoint"); struct device_node *remote;
if (endpoint) {
remote = of_graph_get_remote_port_parent(endpoint); remote = of_graph_get_remote_port_parent(ep);
if (remote) of_node_put(ep);
channel->panel = of_drm_find_panel(remote); if (remote)
else channel->panel = of_drm_find_panel(remote);
return -EPROBE_DEFER; else
if (!channel->panel) { return -EPROBE_DEFER;
dev_err(dev, "panel not found: %s\n", of_node_put(remote);
remote->full_name); if (!channel->panel) {
return -EPROBE_DEFER; dev_err(dev, "panel not found: %s\n",
} remote->full_name);
return -EPROBE_DEFER;
} }
} }
......
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