[PATCH v2 21/60] drm/omap: dss: Move debug message and checks to connection handlers
Sebastian Reichel
sre at kernel.org
Sun Jun 10 19:47:30 UTC 2018
Hi,
On Sat, May 26, 2018 at 08:24:39PM +0300, Laurent Pinchart wrote:
> The connectors, encoders and display duplicate the same debug messages
> and connection checks in their omap_dss_device connect and disconnect
> handlers. Move the code to the connect and disconnect wrappers.
>
> To simplify the code the connect function returns -EBUSY unconditionally
> if the device is already connected. This doesn't cause any change in
> practice: the connect handler of displays is never called on a connected
> device as it is only invoked during omapdrm initialization.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> ---
Reviewed-by: Sebastian Reichel <sebastian.reichel at collabora.co.uk>
-- Sebastian
> drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c | 10 ----------
> drivers/gpu/drm/omapdrm/displays/connector-dvi.c | 6 ------
> drivers/gpu/drm/omapdrm/displays/connector-hdmi.c | 10 ----------
> drivers/gpu/drm/omapdrm/displays/encoder-opa362.c | 11 -----------
> drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c | 7 -------
> drivers/gpu/drm/omapdrm/displays/panel-dpi.c | 6 ------
> drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c | 6 ------
> drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c | 6 ------
> drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c | 6 ------
> drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c | 6 ------
> drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c | 6 ------
> drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c | 6 ------
> drivers/gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c | 6 ------
> drivers/gpu/drm/omapdrm/dss/base.c | 12 ++++++++++++
> 14 files changed, 12 insertions(+), 92 deletions(-)
>
> diff --git a/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c b/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
> index 41ba3c5dbe7d..d77e21fc26ad 100644
> --- a/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
> +++ b/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
> @@ -48,11 +48,6 @@ static int tvc_connect(struct omap_dss_device *dssdev)
> struct omap_dss_device *in;
> int r;
>
> - dev_dbg(ddata->dev, "connect\n");
> -
> - if (omapdss_device_is_connected(dssdev))
> - return 0;
> -
> in = omapdss_of_find_source_for_first_ep(ddata->dev->of_node);
> if (IS_ERR(in)) {
> dev_err(ddata->dev, "failed to find video source\n");
> @@ -74,11 +69,6 @@ static void tvc_disconnect(struct omap_dss_device *dssdev)
> struct panel_drv_data *ddata = to_panel_data(dssdev);
> struct omap_dss_device *in = ddata->in;
>
> - dev_dbg(ddata->dev, "disconnect\n");
> -
> - if (!omapdss_device_is_connected(dssdev))
> - return;
> -
> omapdss_device_disconnect(in, dssdev);
>
> omap_dss_put_device(in);
> diff --git a/drivers/gpu/drm/omapdrm/displays/connector-dvi.c b/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
> index f193bbda550c..9a3ecc3ed5b2 100644
> --- a/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
> +++ b/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
> @@ -63,9 +63,6 @@ static int dvic_connect(struct omap_dss_device *dssdev)
> struct omap_dss_device *in;
> int r;
>
> - if (omapdss_device_is_connected(dssdev))
> - return 0;
> -
> in = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
> if (IS_ERR(in)) {
> dev_err(dssdev->dev, "failed to find video source\n");
> @@ -87,9 +84,6 @@ static void dvic_disconnect(struct omap_dss_device *dssdev)
> struct panel_drv_data *ddata = to_panel_data(dssdev);
> struct omap_dss_device *in = ddata->in;
>
> - if (!omapdss_device_is_connected(dssdev))
> - return;
> -
> omapdss_device_disconnect(in, dssdev);
>
> omap_dss_put_device(in);
> diff --git a/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c b/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
> index 014554afbb0d..665af9932317 100644
> --- a/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
> +++ b/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
> @@ -58,11 +58,6 @@ static int hdmic_connect(struct omap_dss_device *dssdev)
> struct omap_dss_device *in;
> int r;
>
> - dev_dbg(ddata->dev, "connect\n");
> -
> - if (omapdss_device_is_connected(dssdev))
> - return 0;
> -
> in = omapdss_of_find_source_for_first_ep(ddata->dev->of_node);
> if (IS_ERR(in)) {
> dev_err(ddata->dev, "failed to find video source\n");
> @@ -84,11 +79,6 @@ static void hdmic_disconnect(struct omap_dss_device *dssdev)
> struct panel_drv_data *ddata = to_panel_data(dssdev);
> struct omap_dss_device *in = ddata->in;
>
> - dev_dbg(ddata->dev, "disconnect\n");
> -
> - if (!omapdss_device_is_connected(dssdev))
> - return;
> -
> omapdss_device_disconnect(in, dssdev);
>
> omap_dss_put_device(in);
> diff --git a/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c b/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
> index 752b565987c1..5b9ef09e6b2d 100644
> --- a/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
> +++ b/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
> @@ -39,11 +39,6 @@ static int opa362_connect(struct omap_dss_device *dssdev,
> struct omap_dss_device *in;
> int r;
>
> - dev_dbg(dssdev->dev, "connect\n");
> -
> - if (omapdss_device_is_connected(dssdev))
> - return -EBUSY;
> -
> in = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
> if (IS_ERR(in)) {
> dev_err(dssdev->dev, "failed to find video source\n");
> @@ -69,12 +64,6 @@ static void opa362_disconnect(struct omap_dss_device *dssdev,
> struct panel_drv_data *ddata = to_panel_data(dssdev);
> struct omap_dss_device *in = ddata->in;
>
> - dev_dbg(dssdev->dev, "disconnect\n");
> -
> - WARN_ON(!omapdss_device_is_connected(dssdev));
> - if (!omapdss_device_is_connected(dssdev))
> - return;
> -
> WARN_ON(dst != dssdev->dst);
> if (dst != dssdev->dst)
> return;
> diff --git a/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c b/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c
> index a8660e5e5ffc..b22c8f71c0e5 100644
> --- a/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c
> +++ b/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c
> @@ -35,9 +35,6 @@ static int tfp410_connect(struct omap_dss_device *dssdev,
> struct omap_dss_device *in;
> int r;
>
> - if (omapdss_device_is_connected(dssdev))
> - return -EBUSY;
> -
> in = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
> if (IS_ERR(in)) {
> dev_err(dssdev->dev, "failed to find video source\n");
> @@ -63,10 +60,6 @@ static void tfp410_disconnect(struct omap_dss_device *dssdev,
> struct panel_drv_data *ddata = to_panel_data(dssdev);
> struct omap_dss_device *in = ddata->in;
>
> - WARN_ON(!omapdss_device_is_connected(dssdev));
> - if (!omapdss_device_is_connected(dssdev))
> - return;
> -
> WARN_ON(dst != dssdev->dst);
> if (dst != dssdev->dst)
> return;
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
> index 987519501336..5d704cf0809f 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
> @@ -41,9 +41,6 @@ static int panel_dpi_connect(struct omap_dss_device *dssdev)
> struct omap_dss_device *in;
> int r;
>
> - if (omapdss_device_is_connected(dssdev))
> - return 0;
> -
> in = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
> if (IS_ERR(in)) {
> dev_err(dssdev->dev, "failed to find video source\n");
> @@ -65,9 +62,6 @@ static void panel_dpi_disconnect(struct omap_dss_device *dssdev)
> struct panel_drv_data *ddata = to_panel_data(dssdev);
> struct omap_dss_device *in = ddata->in;
>
> - if (!omapdss_device_is_connected(dssdev))
> - return;
> -
> omapdss_device_disconnect(in, dssdev);
>
> omap_dss_put_device(in);
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index b7cd2ef17fbb..be6c0c811e66 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -763,9 +763,6 @@ static int dsicm_connect(struct omap_dss_device *dssdev)
> struct omap_dss_device *in;
> int r;
>
> - if (omapdss_device_is_connected(dssdev))
> - return 0;
> -
> in = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
> if (IS_ERR(in)) {
> dev_err(dssdev->dev, "failed to find video source\n");
> @@ -807,9 +804,6 @@ static void dsicm_disconnect(struct omap_dss_device *dssdev)
> struct panel_drv_data *ddata = to_panel_data(dssdev);
> struct omap_dss_device *in = ddata->in;
>
> - if (!omapdss_device_is_connected(dssdev))
> - return;
> -
> in->ops->dsi.release_vc(in, ddata->channel);
> omapdss_device_disconnect(in, dssdev);
>
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c b/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c
> index e4a3b5828bf9..50b74e7351e9 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c
> @@ -122,9 +122,6 @@ static int lb035q02_connect(struct omap_dss_device *dssdev)
> struct omap_dss_device *in;
> int r;
>
> - if (omapdss_device_is_connected(dssdev))
> - return 0;
> -
> in = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
> if (IS_ERR(in)) {
> dev_err(dssdev->dev, "failed to find video source\n");
> @@ -148,9 +145,6 @@ static void lb035q02_disconnect(struct omap_dss_device *dssdev)
> struct panel_drv_data *ddata = to_panel_data(dssdev);
> struct omap_dss_device *in = ddata->in;
>
> - if (!omapdss_device_is_connected(dssdev))
> - return;
> -
> omapdss_device_disconnect(in, dssdev);
>
> omap_dss_put_device(in);
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c b/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c
> index e89dd32a2a60..769cba6c99ef 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c
> @@ -118,9 +118,6 @@ static int nec_8048_connect(struct omap_dss_device *dssdev)
> struct omap_dss_device *in;
> int r;
>
> - if (omapdss_device_is_connected(dssdev))
> - return 0;
> -
> in = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
> if (IS_ERR(in)) {
> dev_err(dssdev->dev, "failed to find video source\n");
> @@ -142,9 +139,6 @@ static void nec_8048_disconnect(struct omap_dss_device *dssdev)
> struct panel_drv_data *ddata = to_panel_data(dssdev);
> struct omap_dss_device *in = ddata->in;
>
> - if (!omapdss_device_is_connected(dssdev))
> - return;
> -
> omapdss_device_disconnect(in, dssdev);
>
> omap_dss_put_device(in);
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c b/drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c
> index d0451cfab7f8..629ea2d93575 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c
> @@ -64,9 +64,6 @@ static int sharp_ls_connect(struct omap_dss_device *dssdev)
> struct omap_dss_device *in;
> int r;
>
> - if (omapdss_device_is_connected(dssdev))
> - return 0;
> -
> in = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
> if (IS_ERR(in)) {
> dev_err(dssdev->dev, "failed to find video source\n");
> @@ -88,9 +85,6 @@ static void sharp_ls_disconnect(struct omap_dss_device *dssdev)
> struct panel_drv_data *ddata = to_panel_data(dssdev);
> struct omap_dss_device *in = ddata->in;
>
> - if (!omapdss_device_is_connected(dssdev))
> - return;
> -
> omapdss_device_disconnect(in, dssdev);
>
> omap_dss_put_device(in);
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c b/drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c
> index 77721acf664d..75cb672b1161 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c
> @@ -513,9 +513,6 @@ static int acx565akm_connect(struct omap_dss_device *dssdev)
> struct omap_dss_device *in;
> int r;
>
> - if (omapdss_device_is_connected(dssdev))
> - return 0;
> -
> in = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
> if (IS_ERR(in)) {
> dev_err(dssdev->dev, "failed to find video source\n");
> @@ -537,9 +534,6 @@ static void acx565akm_disconnect(struct omap_dss_device *dssdev)
> struct panel_drv_data *ddata = to_panel_data(dssdev);
> struct omap_dss_device *in = ddata->in;
>
> - if (!omapdss_device_is_connected(dssdev))
> - return;
> -
> omapdss_device_disconnect(in, dssdev);
>
> omap_dss_put_device(in);
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c b/drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c
> index 0baf5a5a5895..2491c4876dd4 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c
> @@ -172,9 +172,6 @@ static int td028ttec1_panel_connect(struct omap_dss_device *dssdev)
> struct omap_dss_device *in;
> int r;
>
> - if (omapdss_device_is_connected(dssdev))
> - return 0;
> -
> in = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
> if (IS_ERR(in)) {
> dev_err(dssdev->dev, "failed to find video source\n");
> @@ -196,9 +193,6 @@ static void td028ttec1_panel_disconnect(struct omap_dss_device *dssdev)
> struct panel_drv_data *ddata = to_panel_data(dssdev);
> struct omap_dss_device *in = ddata->in;
>
> - if (!omapdss_device_is_connected(dssdev))
> - return;
> -
> omapdss_device_disconnect(in, dssdev);
>
> omap_dss_put_device(in);
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c b/drivers/gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c
> index 1daba7a60a9c..df3d8103823d 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c
> @@ -343,9 +343,6 @@ static int tpo_td043_connect(struct omap_dss_device *dssdev)
> struct omap_dss_device *in;
> int r;
>
> - if (omapdss_device_is_connected(dssdev))
> - return 0;
> -
> in = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
> if (IS_ERR(in)) {
> dev_err(dssdev->dev, "failed to find video source\n");
> @@ -367,9 +364,6 @@ static void tpo_td043_disconnect(struct omap_dss_device *dssdev)
> struct panel_drv_data *ddata = to_panel_data(dssdev);
> struct omap_dss_device *in = ddata->in;
>
> - if (!omapdss_device_is_connected(dssdev))
> - return;
> -
> omapdss_device_disconnect(in, dssdev);
>
> omap_dss_put_device(in);
> diff --git a/drivers/gpu/drm/omapdrm/dss/base.c b/drivers/gpu/drm/omapdrm/dss/base.c
> index 576fd3d13259..01c117d8775b 100644
> --- a/drivers/gpu/drm/omapdrm/dss/base.c
> +++ b/drivers/gpu/drm/omapdrm/dss/base.c
> @@ -105,6 +105,11 @@ struct omap_dss_device *omapdss_find_device_by_port(struct device_node *src,
> int omapdss_device_connect(struct omap_dss_device *src,
> struct omap_dss_device *dst)
> {
> + dev_dbg(src->dev, "connect\n");
> +
> + if (omapdss_device_is_connected(src))
> + return -EBUSY;
> +
> if (src->driver)
> return src->driver->connect(src);
> else
> @@ -115,6 +120,13 @@ EXPORT_SYMBOL_GPL(omapdss_device_connect);
> void omapdss_device_disconnect(struct omap_dss_device *src,
> struct omap_dss_device *dst)
> {
> + dev_dbg(src->dev, "disconnect\n");
> +
> + if (!omapdss_device_is_connected(src)) {
> + WARN_ON(!src->driver);
> + return;
> + }
> +
> if (src->driver)
> src->driver->disconnect(src);
> else
> --
> Regards,
>
> Laurent Pinchart
>
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20180610/2d6b54ac/attachment.sig>
More information about the dri-devel
mailing list