staging: imx-drm-core: use of_graph_parse_endpoint
authorPhilipp Zabel <p.zabel@pengutronix.de>
Wed, 5 Mar 2014 09:20:53 +0000 (10:20 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Fri, 7 Mar 2014 16:17:49 +0000 (16:17 +0000)
Using of_graph_parse_endpoint recovers the port id from an endpoint device
tree node. This just replaces an open coded read of the "reg" property.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
drivers/staging/imx-drm/imx-drm-core.c

index e4277f996574fa6a65a361054e7359031588f57a..f926931183ea6b650561ff27da30420108ef1cde 100644 (file)
@@ -501,8 +501,9 @@ int imx_drm_encoder_get_mux_id(struct device_node *node,
 {
        struct imx_drm_crtc *imx_crtc = imx_drm_find_crtc(encoder->crtc);
        struct device_node *ep = NULL;
+       struct of_endpoint endpoint;
        struct device_node *port;
-       int id, ret;
+       int ret;
 
        if (!node || !imx_crtc)
                return -EINVAL;
@@ -515,9 +516,8 @@ int imx_drm_encoder_get_mux_id(struct device_node *node,
                port = of_graph_get_remote_port(ep);
                of_node_put(port);
                if (port == imx_crtc->port) {
-                       ret = of_property_read_u32(ep->parent, "reg", &id);
-                       of_node_put(ep);
-                       return ret ? ret : id;
+                       ret = of_graph_parse_endpoint(ep, &endpoint);
+                       return ret ? ret : endpoint.id;
                }
        } while (ep);