]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
drm/omap: Remove enable checks from display .enable() and .remove()
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Sat, 8 Sep 2018 08:45:14 +0000 (11:45 +0300)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Mon, 18 Mar 2019 09:42:11 +0000 (11:42 +0200)
The displays (connectors, panels and encoders) bail out from their
.enable() and .disable() handlers if the dss device is already enabled
or disabled. Those safety checks are not needed when the functions are
called through the omapdss_device_ops, as the .enable() and .disable()
handlers are called from the DRM atomic helpers that already guarantee
that no double enabling or disabling can occur.

However, the handlers are also called directly from the .remove()
handler. While this shouldn't be needed either as the modules can't be
removed as long as the device is in use, it's still a good practice to
disable the device explicitly. There is currently a safety check in
.remove() in some drivers but not all of them.

Remove the safety checks from the .enable() and .disable() handlers, and
add missing ones in the .remove() handler.

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>
14 files changed:
drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
drivers/gpu/drm/omapdrm/displays/connector-dvi.c
drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c
drivers/gpu/drm/omapdrm/displays/panel-dpi.c
drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c
drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c
drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c
drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c
drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c
drivers/gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c
drivers/gpu/drm/omapdrm/omap_encoder.c

index 910a5b9c036a0f47a8c962bd79e6e55b21a8c5b5..2b5b77627cfbafde5ea83acd178935493015cad1 100644 (file)
@@ -46,9 +46,6 @@ static void tvc_disable(struct omap_dss_device *dssdev)
 {
        struct omap_dss_device *src = dssdev->src;
 
-       if (!omapdss_device_is_enabled(dssdev))
-               return;
-
        src->ops->disable(src);
 }
 
@@ -92,7 +89,8 @@ static int __exit tvc_remove(struct platform_device *pdev)
 
        omapdss_device_unregister(&ddata->dssdev);
 
-       tvc_disable(dssdev);
+       if (omapdss_device_is_enabled(dssdev))
+               tvc_disable(dssdev);
 
        return 0;
 }
index 1e0925791c3d8399763ebdcb9365d2e26419a3e5..a1784e2638356003f583323bf9e8d5e7d6d52890 100644 (file)
@@ -57,9 +57,6 @@ static void dvic_disable(struct omap_dss_device *dssdev)
 {
        struct omap_dss_device *src = dssdev->src;
 
-       if (!omapdss_device_is_enabled(dssdev))
-               return;
-
        src->ops->disable(src);
 }
 
@@ -282,7 +279,8 @@ static int __exit dvic_remove(struct platform_device *pdev)
 
        omapdss_device_unregister(&ddata->dssdev);
 
-       dvic_disable(dssdev);
+       if (omapdss_device_is_enabled(dssdev))
+               dvic_disable(dssdev);
 
        i2c_put_adapter(ddata->i2c_adapter);
 
index 649364e04edd5924021241fe2fe19c454e55a097..05cd503c4d29aa64e3d2ddffbd1b315485c3493a 100644 (file)
@@ -52,9 +52,6 @@ static void hdmic_disable(struct omap_dss_device *dssdev)
 {
        struct omap_dss_device *src = dssdev->src;
 
-       if (!omapdss_device_is_enabled(dssdev))
-               return;
-
        src->ops->disable(src);
 }
 
@@ -179,7 +176,8 @@ static int __exit hdmic_remove(struct platform_device *pdev)
 
        omapdss_device_unregister(&ddata->dssdev);
 
-       hdmic_disable(dssdev);
+       if (omapdss_device_is_enabled(dssdev))
+               hdmic_disable(dssdev);
 
        return 0;
 }
index 0b1032625e42209cb1f3ae8d5b7e50280f25354d..ce116c28479fec2c173f86f5b711a8e53672e5f7 100644 (file)
@@ -49,9 +49,6 @@ static int opa362_enable(struct omap_dss_device *dssdev)
 
        dev_dbg(dssdev->dev, "enable\n");
 
-       if (omapdss_device_is_enabled(dssdev))
-               return 0;
-
        r = src->ops->enable(src);
        if (r)
                return r;
@@ -71,9 +68,6 @@ static void opa362_disable(struct omap_dss_device *dssdev)
 
        dev_dbg(dssdev->dev, "disable\n");
 
-       if (!omapdss_device_is_enabled(dssdev))
-               return;
-
        if (ddata->enable_gpio)
                gpiod_set_value_cansleep(ddata->enable_gpio, 0);
 
index fcc2dc5188a24d7e70a3f132d69f590e7654dbf9..d51410ed1e133558210f46c4c9c0393a0992d782 100644 (file)
@@ -42,9 +42,6 @@ static int tfp410_enable(struct omap_dss_device *dssdev)
        struct omap_dss_device *src = dssdev->src;
        int r;
 
-       if (omapdss_device_is_enabled(dssdev))
-               return 0;
-
        r = src->ops->enable(src);
        if (r)
                return r;
@@ -62,9 +59,6 @@ static void tfp410_disable(struct omap_dss_device *dssdev)
        struct panel_drv_data *ddata = to_panel_data(dssdev);
        struct omap_dss_device *src = dssdev->src;
 
-       if (!omapdss_device_is_enabled(dssdev))
-               return;
-
        if (ddata->pd_gpio)
                gpiod_set_value_cansleep(ddata->pd_gpio, 0);
 
index ded779a598d361b9ca923d57e4f7841445736635..3ef4596a3698bf7cb5aed6349256717341752294 100644 (file)
@@ -72,9 +72,6 @@ static void panel_dpi_disable(struct omap_dss_device *dssdev)
        struct panel_drv_data *ddata = to_panel_data(dssdev);
        struct omap_dss_device *src = dssdev->src;
 
-       if (!omapdss_device_is_enabled(dssdev))
-               return;
-
        backlight_disable(ddata->backlight);
 
        gpiod_set_value_cansleep(ddata->enable_gpio, 0);
@@ -182,7 +179,8 @@ static int __exit panel_dpi_remove(struct platform_device *pdev)
 
        omapdss_device_unregister(dssdev);
 
-       panel_dpi_disable(dssdev);
+       if (omapdss_device_is_enabled(dssdev))
+               panel_dpi_disable(dssdev);
 
        return 0;
 }
index e346451647c485ea495860a89a5ed3c147a58a87..a7c8688237fbdc59229dfb6194457162192b15f3 100644 (file)
@@ -829,11 +829,9 @@ static void dsicm_disable(struct omap_dss_device *dssdev)
 
        src->ops->dsi.bus_lock(src);
 
-       if (omapdss_device_is_enabled(dssdev)) {
-               r = dsicm_wake_up(ddata);
-               if (!r)
-                       dsicm_power_off(ddata);
-       }
+       r = dsicm_wake_up(ddata);
+       if (!r)
+               dsicm_power_off(ddata);
 
        src->ops->dsi.bus_unlock(src);
 
@@ -1367,7 +1365,8 @@ static int __exit dsicm_remove(struct platform_device *pdev)
 
        omapdss_device_unregister(dssdev);
 
-       dsicm_disable(dssdev);
+       if (omapdss_device_is_enabled(dssdev))
+               dsicm_disable(dssdev);
        omapdss_device_disconnect(dssdev->src, dssdev);
 
        sysfs_remove_group(&pdev->dev.kobj, &dsicm_attr_group);
index 19c0c3e85aa5a23a1e3e5bda757c9a7b49556723..2c3b15ba5a398160b2832723f32daedf50203110 100644 (file)
@@ -144,9 +144,6 @@ static void lb035q02_disable(struct omap_dss_device *dssdev)
        struct panel_drv_data *ddata = to_panel_data(dssdev);
        struct omap_dss_device *src = dssdev->src;
 
-       if (!omapdss_device_is_enabled(dssdev))
-               return;
-
        if (ddata->enable_gpio)
                gpiod_set_value_cansleep(ddata->enable_gpio, 0);
 
@@ -235,7 +232,8 @@ static int lb035q02_panel_spi_remove(struct spi_device *spi)
 
        omapdss_device_unregister(dssdev);
 
-       lb035q02_disable(dssdev);
+       if (omapdss_device_is_enabled(dssdev))
+               lb035q02_disable(dssdev);
 
        return 0;
 }
index 9cef1d16d7d398350455e7f28ee63b34b65743cc..ef83459611befc351dba780640cd0fc6e62df99b 100644 (file)
@@ -138,9 +138,6 @@ static void nec_8048_disable(struct omap_dss_device *dssdev)
        struct panel_drv_data *ddata = to_panel_data(dssdev);
        struct omap_dss_device *src = dssdev->src;
 
-       if (!omapdss_device_is_enabled(dssdev))
-               return;
-
        gpiod_set_value_cansleep(ddata->res_gpio, 0);
 
        src->ops->disable(src);
@@ -226,7 +223,8 @@ static int nec_8048_remove(struct spi_device *spi)
 
        omapdss_device_unregister(dssdev);
 
-       nec_8048_disable(dssdev);
+       if (omapdss_device_is_enabled(dssdev))
+               nec_8048_disable(dssdev);
 
        return 0;
 }
index 5a06fbb7984afccd3e75d25278f03e179850730c..0c5b405b4c9ecd482079a917ec488ba83d8ef8c6 100644 (file)
@@ -97,9 +97,6 @@ static void sharp_ls_disable(struct omap_dss_device *dssdev)
        struct panel_drv_data *ddata = to_panel_data(dssdev);
        struct omap_dss_device *src = dssdev->src;
 
-       if (!omapdss_device_is_enabled(dssdev))
-               return;
-
        if (ddata->ini_gpio)
                gpiod_set_value_cansleep(ddata->ini_gpio, 0);
 
@@ -233,7 +230,8 @@ static int __exit sharp_ls_remove(struct platform_device *pdev)
 
        omapdss_device_unregister(dssdev);
 
-       sharp_ls_disable(dssdev);
+       if (omapdss_device_is_enabled(dssdev))
+               sharp_ls_disable(dssdev);
 
        return 0;
 }
index 209a87c70c9990798bfdecdfe12388a7194da933..99c2c4f27dd5beb1e20305d85b1f87f0bcb30ae3 100644 (file)
@@ -605,9 +605,6 @@ static void acx565akm_disable(struct omap_dss_device *dssdev)
 {
        struct panel_drv_data *ddata = to_panel_data(dssdev);
 
-       if (!omapdss_device_is_enabled(dssdev))
-               return;
-
        mutex_lock(&ddata->mutex);
        acx565akm_panel_power_off(dssdev);
        mutex_unlock(&ddata->mutex);
@@ -750,7 +747,8 @@ static int acx565akm_remove(struct spi_device *spi)
 
        omapdss_device_unregister(dssdev);
 
-       acx565akm_disable(dssdev);
+       if (omapdss_device_is_enabled(dssdev))
+               acx565akm_disable(dssdev);
 
        return 0;
 }
index b09fea97a441d92a8afd9c3fadf5dff69b729713..8551a1df3ad672e6dbcc44e436d3bbf5cc3d0b0e 100644 (file)
@@ -270,9 +270,6 @@ static void td028ttec1_panel_disable(struct omap_dss_device *dssdev)
        struct panel_drv_data *ddata = to_panel_data(dssdev);
        struct omap_dss_device *src = dssdev->src;
 
-       if (!omapdss_device_is_enabled(dssdev))
-               return;
-
        dev_dbg(dssdev->dev, "td028ttec1_panel_disable()\n");
 
        jbt_ret_write_0(ddata, JBT_REG_DISPLAY_OFF);
@@ -357,7 +354,8 @@ static int td028ttec1_panel_remove(struct spi_device *spi)
 
        omapdss_device_unregister(dssdev);
 
-       td028ttec1_panel_disable(dssdev);
+       if (omapdss_device_is_enabled(dssdev))
+               td028ttec1_panel_disable(dssdev);
 
        return 0;
 }
index 998f21f7701a83591e45e123744c47d99e4385bd..527abed69d34fcbcef5eb82a566e0d0fdcdc7ad5 100644 (file)
@@ -350,9 +350,6 @@ static void tpo_td043_disable(struct omap_dss_device *dssdev)
        struct panel_drv_data *ddata = to_panel_data(dssdev);
        struct omap_dss_device *src = dssdev->src;
 
-       if (!omapdss_device_is_enabled(dssdev))
-               return;
-
        src->ops->disable(src);
 
        if (!ddata->spi_suspended)
@@ -457,7 +454,8 @@ static int tpo_td043_remove(struct spi_device *spi)
 
        omapdss_device_unregister(dssdev);
 
-       tpo_td043_disable(dssdev);
+       if (omapdss_device_is_enabled(dssdev))
+               tpo_td043_disable(dssdev);
 
        sysfs_remove_group(&spi->dev.kobj, &tpo_td043_attr_group);
 
index 3c3d88e1df38ee016c8521766eb3e1a4c4a24b8f..d14d465392dd1c83247736cb79f4d6c858f8f818 100644 (file)
@@ -151,9 +151,6 @@ static void omap_encoder_disable(struct drm_encoder *encoder)
 
        dev_dbg(dev->dev, "disable(%s)\n", dssdev->name);
 
-       if (!omapdss_device_is_enabled(dssdev))
-               return;
-
        dssdev->ops->disable(dssdev);
 
        dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
@@ -168,9 +165,6 @@ static void omap_encoder_enable(struct drm_encoder *encoder)
 
        dev_dbg(dev->dev, "enable(%s)\n", dssdev->name);
 
-       if (omapdss_device_is_enabled(dssdev))
-               return;
-
        r = dssdev->ops->enable(dssdev);
        if (r) {
                dev_err(dev->dev, "Failed to enable display '%s': %d\n",