drm/omap: Remove connection checks from display .enable() and .remove()
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 displays (connectors, panels and encoders) return an error from
their .enable() handler when the dss device is not connected. They also
disconnect the dss device explicitly from their .remove() handler if it
is still connected.

Those safety checks are not needed:

- 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.

- The .remove() handler can only be called when unloading the module as
  the driver has the suppress_bind_attrs attribute set, and a reference
  to the module is taken when constructing the dss devices chain, so the
  module can only be unloaded when the dss device is disconnected.

Remove the safety checks.

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/displays/encoder-opa362.c
drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c
drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c
drivers/gpu/drm/omapdrm/dss/base.c
drivers/gpu/drm/omapdrm/dss/omapdss.h
drivers/gpu/drm/omapdrm/omap_encoder.c

index 4fefd80f53bb8ed8853af4cdb265920f911fcba6..0b1032625e42209cb1f3ae8d5b7e50280f25354d 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_connected(dssdev))
-               return -ENODEV;
-
        if (omapdss_device_is_enabled(dssdev))
                return 0;
 
@@ -145,10 +142,6 @@ static int __exit opa362_remove(struct platform_device *pdev)
        if (omapdss_device_is_enabled(dssdev))
                opa362_disable(dssdev);
 
-       WARN_ON(omapdss_device_is_connected(dssdev));
-       if (omapdss_device_is_connected(dssdev))
-               omapdss_device_disconnect(NULL, dssdev);
-
        return 0;
 }
 
index f1a748353279772e60ff0d20d23eaaee4511c810..fcc2dc5188a24d7e70a3f132d69f590e7654dbf9 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_connected(dssdev))
-               return -ENODEV;
-
        if (omapdss_device_is_enabled(dssdev))
                return 0;
 
@@ -139,10 +136,6 @@ static int __exit tfp410_remove(struct platform_device *pdev)
        if (omapdss_device_is_enabled(dssdev))
                tfp410_disable(dssdev);
 
-       WARN_ON(omapdss_device_is_connected(dssdev));
-       if (omapdss_device_is_connected(dssdev))
-               omapdss_device_disconnect(NULL, dssdev);
-
        return 0;
 }
 
index 94de55fd8884072385ddb97c1940a365029e0b1b..1a2bc59bf104e4ce300267908f860d9162a8a706 100644 (file)
@@ -229,10 +229,6 @@ static int __exit tpd_remove(struct platform_device *pdev)
        if (omapdss_device_is_enabled(dssdev))
                tpd_disable(dssdev);
 
-       WARN_ON(omapdss_device_is_connected(dssdev));
-       if (omapdss_device_is_connected(dssdev))
-               omapdss_device_disconnect(NULL, dssdev);
-
        return 0;
 }
 
index 472f56e3de70d30d1978c8cfc35278d4b2dd395a..787157b0069495ac1e7cc17632cd74ff03440dd0 100644 (file)
@@ -185,6 +185,11 @@ done:
 }
 EXPORT_SYMBOL(omapdss_device_get_next);
 
+static bool omapdss_device_is_connected(struct omap_dss_device *dssdev)
+{
+       return dssdev->src;
+}
+
 int omapdss_device_connect(struct dss_device *dss,
                           struct omap_dss_device *src,
                           struct omap_dss_device *dst)
index de0520a8eb4ebd2b5d24703444ac54bb9b852da5..698155dd7941f6b26a64474a0d42d42e4f669f56 100644 (file)
@@ -505,11 +505,6 @@ int omap_dispc_unregister_isr(omap_dispc_isr_t isr, void *arg, u32 mask);
 int omapdss_compat_init(void);
 void omapdss_compat_uninit(void);
 
-static inline bool omapdss_device_is_connected(struct omap_dss_device *dssdev)
-{
-       return dssdev->src;
-}
-
 static inline bool omapdss_device_is_enabled(struct omap_dss_device *dssdev)
 {
        return dssdev->state == OMAP_DSS_DISPLAY_ACTIVE;
index 5427c0b3ff9e1dddfa040f28384ab954823ef1e3..3c3d88e1df38ee016c8521766eb3e1a4c4a24b8f 100644 (file)
@@ -168,24 +168,17 @@ static void omap_encoder_enable(struct drm_encoder *encoder)
 
        dev_dbg(dev->dev, "enable(%s)\n", dssdev->name);
 
-       if (!omapdss_device_is_connected(dssdev)) {
-               r = -ENODEV;
-               goto error;
-       }
-
        if (omapdss_device_is_enabled(dssdev))
                return;
 
        r = dssdev->ops->enable(dssdev);
-       if (r)
-               goto error;
+       if (r) {
+               dev_err(dev->dev, "Failed to enable display '%s': %d\n",
+                       dssdev->name, r);
+               return;
+       }
 
        dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
-       return;
-
-error:
-       dev_err(dev->dev, "Failed to enable display '%s': %d\n",
-               dssdev->name, r);
 }
 
 static int omap_encoder_atomic_check(struct drm_encoder *encoder,