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>
{
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;
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);