diff --git a/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c b/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c index 5b151b88e1c1bee5ec3fda5e6fff0b693afb684b..15921b361672d35562a6ffcc0005396c9496d738 100644 --- a/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c +++ b/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c @@ -47,10 +47,10 @@ static int tvc_connect(struct omap_dss_device *dssdev) struct omap_dss_device *src; int r; - src = omapdss_of_find_source_for_first_ep(ddata->dev->of_node); - if (IS_ERR(src)) { + src = omapdss_of_find_connected_device(ddata->dev->of_node, 0); + if (IS_ERR_OR_NULL(src)) { dev_err(ddata->dev, "failed to find video source\n"); - return PTR_ERR(src); + return src ? PTR_ERR(src) : -EINVAL; } r = omapdss_device_connect(dssdev->dss, src, dssdev); diff --git a/drivers/gpu/drm/omapdrm/displays/connector-dvi.c b/drivers/gpu/drm/omapdrm/displays/connector-dvi.c index 14f7941eb83a8c321743128be82b2cdf6c214efd..f8510cd7b1666da3716403fee1fcc1c701e4c17a 100644 --- a/drivers/gpu/drm/omapdrm/displays/connector-dvi.c +++ b/drivers/gpu/drm/omapdrm/displays/connector-dvi.c @@ -61,10 +61,10 @@ static int dvic_connect(struct omap_dss_device *dssdev) struct omap_dss_device *src; int r; - src = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node); - if (IS_ERR(src)) { + src = omapdss_of_find_connected_device(dssdev->dev->of_node, 0); + if (IS_ERR_OR_NULL(src)) { dev_err(dssdev->dev, "failed to find video source\n"); - return PTR_ERR(src); + return src ? PTR_ERR(src) : -EINVAL; } r = omapdss_device_connect(dssdev->dss, src, dssdev); diff --git a/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c b/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c index 005b1b0cbc466bd867fd5142bf7c5cbddbb62834..3452925ed54db748a7788d78ecf8e819da5f2c2f 100644 --- a/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c +++ b/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c @@ -57,10 +57,10 @@ static int hdmic_connect(struct omap_dss_device *dssdev) struct omap_dss_device *src; int r; - src = omapdss_of_find_source_for_first_ep(ddata->dev->of_node); - if (IS_ERR(src)) { + src = omapdss_of_find_connected_device(ddata->dev->of_node, 0); + if (IS_ERR_OR_NULL(src)) { dev_err(ddata->dev, "failed to find video source\n"); - return PTR_ERR(src); + return src ? PTR_ERR(src) : -EINVAL; } r = omapdss_device_connect(dssdev->dss, src, dssdev); diff --git a/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c b/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c index d74b90961c68a72fb9f7e10a0a1809f632cfe83e..939e259d601d341ae7783f835f15fcc750474ba6 100644 --- a/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c +++ b/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c @@ -37,7 +37,7 @@ static int opa362_connect(struct omap_dss_device *dssdev, struct omap_dss_device *src; int r; - src = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node); + src = omapdss_of_find_connected_device(dssdev->dev->of_node, 0); if (IS_ERR(src)) { dev_err(dssdev->dev, "failed to find video source\n"); return PTR_ERR(src); diff --git a/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c b/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c index 2bb1af8f815f5a6488f7c7dd7196bd93b0ddd6d9..55549c5a5af2f1dc05b66b2fe93cba4dd95d2772 100644 --- a/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c +++ b/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c @@ -33,7 +33,7 @@ static int tfp410_connect(struct omap_dss_device *dssdev, struct omap_dss_device *src; int r; - src = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node); + src = omapdss_of_find_connected_device(dssdev->dev->of_node, 0); if (IS_ERR(src)) { dev_err(dssdev->dev, "failed to find video source\n"); return PTR_ERR(src); diff --git a/drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c b/drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c index e33f73f06e004ef4ee49c930cbd821290ca582f7..58a831c3f74ca7c1d40667164b6b1adbb4ed2b05 100644 --- a/drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c +++ b/drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c @@ -42,7 +42,7 @@ static int tpd_connect(struct omap_dss_device *dssdev, struct omap_dss_device *src; int r; - src = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node); + src = omapdss_of_find_connected_device(dssdev->dev->of_node, 0); if (IS_ERR(src)) { dev_err(dssdev->dev, "failed to find video source\n"); return PTR_ERR(src); diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c index c8cd2f663ddf8d1ba46d415b40ab479fc5d32c9e..8c17ad4ddf848e1db94abe39c7c0c219cb200eb1 100644 --- a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c +++ b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c @@ -39,10 +39,10 @@ static int panel_dpi_connect(struct omap_dss_device *dssdev) struct omap_dss_device *src; int r; - src = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node); - if (IS_ERR(src)) { + src = omapdss_of_find_connected_device(dssdev->dev->of_node, 0); + if (IS_ERR_OR_NULL(src)) { dev_err(dssdev->dev, "failed to find video source\n"); - return PTR_ERR(src); + return src ? PTR_ERR(src) : -EINVAL; } r = omapdss_device_connect(dssdev->dss, src, dssdev); diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c index febb20961dc5ced016c1cf2d2055ea3767f904a3..501c47f9513072adfd35037daba06438a4f707fd 100644 --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c @@ -763,10 +763,10 @@ static int dsicm_connect(struct omap_dss_device *dssdev) struct omap_dss_device *src; int r; - src = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node); - if (IS_ERR(src)) { + src = omapdss_of_find_connected_device(dssdev->dev->of_node, 0); + if (IS_ERR_OR_NULL(src)) { dev_err(dssdev->dev, "failed to find video source\n"); - return PTR_ERR(src); + return src ? PTR_ERR(src) : -EINVAL; } r = omapdss_device_connect(dssdev->dss, src, dssdev); diff --git a/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c b/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c index 52e30bd1ed4aeeed5d646598db8271a7333fbf37..73416b1c73865c2bf2b14c100b3694ca4346475a 100644 --- a/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c +++ b/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c @@ -121,10 +121,10 @@ static int lb035q02_connect(struct omap_dss_device *dssdev) struct omap_dss_device *src; int r; - src = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node); - if (IS_ERR(src)) { + src = omapdss_of_find_connected_device(dssdev->dev->of_node, 0); + if (IS_ERR_OR_NULL(src)) { dev_err(dssdev->dev, "failed to find video source\n"); - return PTR_ERR(src); + return src ? PTR_ERR(src) : -EINVAL; } r = omapdss_device_connect(dssdev->dss, src, dssdev); diff --git a/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c b/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c index 3f88407fe3c08dca1258918660a5a8b2fcbedb50..cf5d9e1522a8c952e64deee2a167d436751adfd9 100644 --- a/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c +++ b/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c @@ -116,10 +116,10 @@ static int nec_8048_connect(struct omap_dss_device *dssdev) struct omap_dss_device *src; int r; - src = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node); - if (IS_ERR(src)) { + src = omapdss_of_find_connected_device(dssdev->dev->of_node, 0); + if (IS_ERR_OR_NULL(src)) { dev_err(dssdev->dev, "failed to find video source\n"); - return PTR_ERR(src); + return src ? PTR_ERR(src) : -EINVAL; } r = omapdss_device_connect(dssdev->dss, src, dssdev); diff --git a/drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c b/drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c index 08576ae94d5543dab868fc1de066c7053e938a80..1c3180495dfdaa69ebf9cd2f2150d22935c28561 100644 --- a/drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c +++ b/drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c @@ -62,10 +62,10 @@ static int sharp_ls_connect(struct omap_dss_device *dssdev) struct omap_dss_device *src; int r; - src = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node); - if (IS_ERR(src)) { + src = omapdss_of_find_connected_device(dssdev->dev->of_node, 0); + if (IS_ERR_OR_NULL(src)) { dev_err(dssdev->dev, "failed to find video source\n"); - return PTR_ERR(src); + return src ? PTR_ERR(src) : -EINVAL; } r = omapdss_device_connect(dssdev->dss, src, dssdev); diff --git a/drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c b/drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c index 181c3c2719180f8c0d86db789430575676e23e44..d91ab8dab4d94904b42f3b7171857abad333becb 100644 --- a/drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c +++ b/drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c @@ -511,10 +511,10 @@ static int acx565akm_connect(struct omap_dss_device *dssdev) struct omap_dss_device *src; int r; - src = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node); - if (IS_ERR(src)) { + src = omapdss_of_find_connected_device(dssdev->dev->of_node, 0); + if (IS_ERR_OR_NULL(src)) { dev_err(dssdev->dev, "failed to find video source\n"); - return PTR_ERR(src); + return src ? PTR_ERR(src) : -EINVAL; } r = omapdss_device_connect(dssdev->dss, src, dssdev); diff --git a/drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c b/drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c index 39234f5db144c5b91c017bcf42fdaee39f4c98e8..a57daf44d4213b75aca7b27d9f16dffca9e3c7af 100644 --- a/drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c +++ b/drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c @@ -170,10 +170,10 @@ static int td028ttec1_panel_connect(struct omap_dss_device *dssdev) struct omap_dss_device *src; int r; - src = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node); - if (IS_ERR(src)) { + src = omapdss_of_find_connected_device(dssdev->dev->of_node, 0); + if (IS_ERR_OR_NULL(src)) { dev_err(dssdev->dev, "failed to find video source\n"); - return PTR_ERR(src); + return src ? PTR_ERR(src) : -EINVAL; } r = omapdss_device_connect(dssdev->dss, src, dssdev); diff --git a/drivers/gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c b/drivers/gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c index 61fcf228638731c7988039b6457c5c94cebfee15..719c298d3996424b0d8a4bce058d872932c947db 100644 --- a/drivers/gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c +++ b/drivers/gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c @@ -341,10 +341,10 @@ static int tpo_td043_connect(struct omap_dss_device *dssdev) struct omap_dss_device *src; int r; - src = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node); - if (IS_ERR(src)) { + src = omapdss_of_find_connected_device(dssdev->dev->of_node, 0); + if (IS_ERR_OR_NULL(src)) { dev_err(dssdev->dev, "failed to find video source\n"); - return PTR_ERR(src); + return src ? PTR_ERR(src) : -EINVAL; } r = omapdss_device_connect(dssdev->dss, src, dssdev); diff --git a/drivers/gpu/drm/omapdrm/dss/dss-of.c b/drivers/gpu/drm/omapdrm/dss/dss-of.c index 771b20db2d98a8c7cbc9f38c409319b79b9620e0..0422597ac6b0c26b985b679dc174ac910097dae6 100644 --- a/drivers/gpu/drm/omapdrm/dss/dss-of.c +++ b/drivers/gpu/drm/omapdrm/dss/dss-of.c @@ -47,7 +47,7 @@ dss_of_port_get_parent_device(struct device_node *port) } struct omap_dss_device * -omapdss_of_find_source_for_first_ep(struct device_node *node) +omapdss_of_find_connected_device(struct device_node *node, unsigned int port) { struct device_node *src_node; struct device_node *src_port; @@ -56,27 +56,27 @@ omapdss_of_find_source_for_first_ep(struct device_node *node) u32 port_number = 0; /* Get the endpoint... */ - ep = of_graph_get_endpoint_by_regs(node, 0, 0); + ep = of_graph_get_endpoint_by_regs(node, port, 0); if (!ep) - return ERR_PTR(-EINVAL); + return NULL; /* ... and its remote port... */ src_port = of_graph_get_remote_port(ep); of_node_put(ep); if (!src_port) - return ERR_PTR(-EINVAL); + return NULL; /* ... and the remote port's number and parent... */ of_property_read_u32(src_port, "reg", &port_number); src_node = dss_of_port_get_parent_device(src_port); of_node_put(src_port); if (!src_node) - return NULL; + return ERR_PTR(-EINVAL); - /* ... and finally the source. */ + /* ... and finally the connected device. */ src = omapdss_find_device_by_port(src_node, port_number); of_node_put(src_node); return src ? src : ERR_PTR(-EPROBE_DEFER); } -EXPORT_SYMBOL_GPL(omapdss_of_find_source_for_first_ep); +EXPORT_SYMBOL_GPL(omapdss_of_find_connected_device); diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h index c2d9ebdec3d14cb3d7c450757c98e8f45582baa3..dc2f8167f61b5513378c39ed8ea8a353171407e5 100644 --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h @@ -532,7 +532,7 @@ static inline bool omapdss_device_is_enabled(struct omap_dss_device *dssdev) } struct omap_dss_device * -omapdss_of_find_source_for_first_ep(struct device_node *node); +omapdss_of_find_connected_device(struct device_node *node, unsigned int port); enum dss_writeback_channel { DSS_WB_LCD1_MGR = 0,