drm/omap: Remove connection checks from internal encoders .enable()
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Tue, 4 Sep 2018 20:53:34 +0000 (23:53 +0300)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Mon, 18 Mar 2019 09:42:11 +0000 (11:42 +0200)
The internal encoders return an error from their .enable() handler when
their are not connected to a dss manager. As the flag used is set and
cleared in the connect and disconnect handlers, this effectively checks
whether the omap_dss_device is connected.

The .enable() handler is called from code paths that access the dss
devices chain from the display device, which is set to NULL when the
device isn't connected, making it impossible to access the device in
that case.

The safety check is thus not needed, remove it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Tested-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
drivers/gpu/drm/omapdrm/dss/dpi.c
drivers/gpu/drm/omapdrm/dss/dsi.c
drivers/gpu/drm/omapdrm/dss/hdmi4.c
drivers/gpu/drm/omapdrm/dss/hdmi5.c
drivers/gpu/drm/omapdrm/dss/omapdss.h
drivers/gpu/drm/omapdrm/dss/sdi.c
drivers/gpu/drm/omapdrm/dss/venc.c

index ca4f3c4c631860c754bae74220db46265ea0fef4..0cf3b220e35f5510d5d5ff10bf765b0c1dc49333 100644 (file)
@@ -386,12 +386,6 @@ static int dpi_display_enable(struct omap_dss_device *dssdev)
 
        mutex_lock(&dpi->lock);
 
-       if (!out->dispc_channel_connected) {
-               DSSERR("failed to enable display: no output/manager\n");
-               r = -ENODEV;
-               goto err_no_out_mgr;
-       }
-
        if (dpi->vdds_dsi_reg) {
                r = regulator_enable(dpi->vdds_dsi_reg);
                if (r)
@@ -439,7 +433,6 @@ err_get_dispc:
        if (dpi->vdds_dsi_reg)
                regulator_disable(dpi->vdds_dsi_reg);
 err_reg_enable:
-err_no_out_mgr:
        mutex_unlock(&dpi->lock);
        return r;
 }
@@ -596,23 +589,15 @@ static int dpi_connect(struct omap_dss_device *src,
                       struct omap_dss_device *dst)
 {
        struct dpi_data *dpi = dpi_get_data_from_dssdev(dst);
-       int r;
 
        dpi_init_pll(dpi);
 
-       r = omapdss_device_connect(dst->dss, dst, dst->next);
-       if (r)
-               return r;
-
-       dst->dispc_channel_connected = true;
-       return 0;
+       return omapdss_device_connect(dst->dss, dst, dst->next);
 }
 
 static void dpi_disconnect(struct omap_dss_device *src,
                           struct omap_dss_device *dst)
 {
-       dst->dispc_channel_connected = false;
-
        omapdss_device_disconnect(dst, dst->next);
 }
 
index 64fb788b664749473ac89894ae9f1c8eeda5f323..c14f8fb2a99b5d76de32bcd804a589bbe5716d0f 100644 (file)
@@ -3753,19 +3753,13 @@ static int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel)
 {
        struct dsi_data *dsi = to_dsi_data(dssdev);
        int bpp = dsi_get_pixel_size(dsi->pix_fmt);
-       struct omap_dss_device *out = &dsi->output;
        u8 data_type;
        u16 word_count;
        int r;
 
-       if (!out->dispc_channel_connected) {
-               DSSERR("failed to enable display: no output/manager\n");
-               return -ENODEV;
-       }
-
        r = dsi_display_init_dispc(dsi);
        if (r)
-               goto err_init_dispc;
+               return r;
 
        if (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE) {
                switch (dsi->pix_fmt) {
@@ -3814,7 +3808,6 @@ err_mgr_enable:
        }
 err_pix_fmt:
        dsi_display_uninit_dispc(dsi);
-err_init_dispc:
        return r;
 }
 
@@ -4888,21 +4881,12 @@ static int dsi_get_clocks(struct dsi_data *dsi)
 static int dsi_connect(struct omap_dss_device *src,
                       struct omap_dss_device *dst)
 {
-       int r;
-
-       r = omapdss_device_connect(dst->dss, dst, dst->next);
-       if (r)
-               return r;
-
-       dst->dispc_channel_connected = true;
-       return 0;
+       return omapdss_device_connect(dst->dss, dst, dst->next);
 }
 
 static void dsi_disconnect(struct omap_dss_device *src,
                           struct omap_dss_device *dst)
 {
-       dst->dispc_channel_connected = false;
-
        omapdss_device_disconnect(dst, dst->next);
 }
 
index aabdda394c9c6f4cf7f93eb0f8e0f9a6126262d1..b6b44f07c74e23711bd6a6b366e210398d23f64c 100644 (file)
@@ -322,12 +322,6 @@ static int hdmi_display_enable(struct omap_dss_device *dssdev)
 
        mutex_lock(&hdmi->lock);
 
-       if (!dssdev->dispc_channel_connected) {
-               DSSERR("failed to enable display: no output/manager\n");
-               r = -ENODEV;
-               goto err0;
-       }
-
        r = hdmi_power_on_full(hdmi);
        if (r) {
                DSSERR("failed to power on device\n");
@@ -417,21 +411,12 @@ void hdmi4_core_disable(struct hdmi_core_data *core)
 static int hdmi_connect(struct omap_dss_device *src,
                        struct omap_dss_device *dst)
 {
-       int r;
-
-       r = omapdss_device_connect(dst->dss, dst, dst->next);
-       if (r)
-               return r;
-
-       dst->dispc_channel_connected = true;
-       return 0;
+       return omapdss_device_connect(dst->dss, dst, dst->next);
 }
 
 static void hdmi_disconnect(struct omap_dss_device *src,
                            struct omap_dss_device *dst)
 {
-       dst->dispc_channel_connected = false;
-
        omapdss_device_disconnect(dst, dst->next);
 }
 
index 9e8556f67a2914aed8ed1b71409956c2bcc07057..beef25703eab71a7ca55d3f29dfcf0bebe10558a 100644 (file)
@@ -330,12 +330,6 @@ static int hdmi_display_enable(struct omap_dss_device *dssdev)
 
        mutex_lock(&hdmi->lock);
 
-       if (!dssdev->dispc_channel_connected) {
-               DSSERR("failed to enable display: no output/manager\n");
-               r = -ENODEV;
-               goto err0;
-       }
-
        r = hdmi_power_on_full(hdmi);
        if (r) {
                DSSERR("failed to power on device\n");
@@ -422,21 +416,12 @@ static void hdmi_core_disable(struct omap_hdmi *hdmi)
 static int hdmi_connect(struct omap_dss_device *src,
                        struct omap_dss_device *dst)
 {
-       int r;
-
-       r = omapdss_device_connect(dst->dss, dst, dst->next);
-       if (r)
-               return r;
-
-       dst->dispc_channel_connected = true;
-       return 0;
+       return omapdss_device_connect(dst->dss, dst, dst->next);
 }
 
 static void hdmi_disconnect(struct omap_dss_device *src,
                            struct omap_dss_device *dst)
 {
-       dst->dispc_channel_connected = false;
-
        omapdss_device_disconnect(dst, dst->next);
 }
 
index 7b2f2c8bf89315916f162a3b5263f19542c8bcb9..de0520a8eb4ebd2b5d24703444ac54bb9b852da5 100644 (file)
@@ -440,7 +440,6 @@ struct omap_dss_device {
 
        /* DISPC channel for this output */
        enum omap_channel dispc_channel;
-       bool dispc_channel_connected;
 
        /* output instance */
        enum omap_dss_output_id id;
index b2fe2387037a7d9f48ba39ecad6f409d9d4e0ddf..7de817c699137cadff4d5eb2d47f98c88b943ccc 100644 (file)
@@ -136,11 +136,6 @@ static int sdi_display_enable(struct omap_dss_device *dssdev)
        unsigned long fck;
        int r;
 
-       if (!sdi->output.dispc_channel_connected) {
-               DSSERR("failed to enable display: no output/manager\n");
-               return -ENODEV;
-       }
-
        r = regulator_enable(sdi->vdds_sdi_reg);
        if (r)
                goto err_reg_enable;
@@ -251,21 +246,12 @@ static int sdi_check_timings(struct omap_dss_device *dssdev,
 static int sdi_connect(struct omap_dss_device *src,
                       struct omap_dss_device *dst)
 {
-       int r;
-
-       r = omapdss_device_connect(dst->dss, dst, dst->next);
-       if (r)
-               return r;
-
-       dst->dispc_channel_connected = true;
-       return 0;
+       return omapdss_device_connect(dst->dss, dst, dst->next);
 }
 
 static void sdi_disconnect(struct omap_dss_device *src,
                           struct omap_dss_device *dst)
 {
-       dst->dispc_channel_connected = false;
-
        omapdss_device_disconnect(dst, dst->next);
 }
 
index fbe9d42dbdb68a8751ef0032892dd2fa91eaed7a..bc9a3d52f34d7fe31de0b3b6506913d8e987185b 100644 (file)
@@ -531,12 +531,6 @@ static int venc_display_enable(struct omap_dss_device *dssdev)
 
        mutex_lock(&venc->venc_lock);
 
-       if (!dssdev->dispc_channel_connected) {
-               DSSERR("Failed to enable display: no output/manager\n");
-               r = -ENODEV;
-               goto err0;
-       }
-
        r = venc_power_on(venc);
        if (r)
                goto err0;
@@ -687,21 +681,12 @@ static int venc_get_clocks(struct venc_device *venc)
 static int venc_connect(struct omap_dss_device *src,
                        struct omap_dss_device *dst)
 {
-       int r;
-
-       r = omapdss_device_connect(dst->dss, dst, dst->next);
-       if (r)
-               return r;
-
-       dst->dispc_channel_connected = true;
-       return 0;
+       return omapdss_device_connect(dst->dss, dst, dst->next);
 }
 
 static void venc_disconnect(struct omap_dss_device *src,
                            struct omap_dss_device *dst)
 {
-       dst->dispc_channel_connected = false;
-
        omapdss_device_disconnect(dst, dst->next);
 }