drm/sti: Use drm_atomic_helper_shutdown
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Thu, 4 Oct 2018 20:24:37 +0000 (22:24 +0200)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Fri, 5 Oct 2018 16:04:09 +0000 (18:04 +0200)
drm_plane_helper_disable is a non-atomic drivers only function, and
will blow up (since no one passes the locking context it needs).

Atomic drivers which want to quiescent their hw on unload should
use drm_atomic_helper_shutdown() instead.

The sti cleanup code seems supremely confused:
- In the load error path it calls drm_mode_config_cleanup before it
  stops various kms services like poll worker or fbdev emulation.
  That's going to oops.
- The actual unload code doesn't even bother with the cleanup and just
  leaks.

Try to fix this while at it.

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Cc: Vincent Abriou <vincent.abriou@st.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181004202446.22905-13-daniel.vetter@ffwll.ch
drivers/gpu/drm/sti/sti_cursor.c
drivers/gpu/drm/sti/sti_drv.c
drivers/gpu/drm/sti/sti_gdp.c
drivers/gpu/drm/sti/sti_hqvdp.c

index 57b870e..bc90845 100644 (file)
@@ -332,7 +332,6 @@ static void sti_cursor_destroy(struct drm_plane *drm_plane)
 {
        DRM_DEBUG_DRIVER("\n");
 
-       drm_plane_helper_disable(drm_plane, NULL);
        drm_plane_cleanup(drm_plane);
 }
 
index 6dced8a..ac54e0f 100644 (file)
@@ -206,6 +206,8 @@ static void sti_cleanup(struct drm_device *ddev)
        struct sti_private *private = ddev->dev_private;
 
        drm_kms_helper_poll_fini(ddev);
+       drm_atomic_helper_shutdown(ddev);
+       drm_mode_config_cleanup(ddev);
        component_unbind_all(ddev->dev, ddev);
        kfree(private);
        ddev->dev_private = NULL;
@@ -230,7 +232,7 @@ static int sti_bind(struct device *dev)
 
        ret = drm_dev_register(ddev, 0);
        if (ret)
-               goto err_register;
+               goto err_cleanup;
 
        drm_mode_config_reset(ddev);
 
@@ -238,8 +240,6 @@ static int sti_bind(struct device *dev)
 
        return 0;
 
-err_register:
-       drm_mode_config_cleanup(ddev);
 err_cleanup:
        sti_cleanup(ddev);
 err_drm_dev_put:
index c32de6c..3c19614 100644 (file)
@@ -883,7 +883,6 @@ static void sti_gdp_destroy(struct drm_plane *drm_plane)
 {
        DRM_DEBUG_DRIVER("\n");
 
-       drm_plane_helper_disable(drm_plane, NULL);
        drm_plane_cleanup(drm_plane);
 }
 
index 03ac3b4..23565f5 100644 (file)
@@ -1260,7 +1260,6 @@ static void sti_hqvdp_destroy(struct drm_plane *drm_plane)
 {
        DRM_DEBUG_DRIVER("\n");
 
-       drm_plane_helper_disable(drm_plane, NULL);
        drm_plane_cleanup(drm_plane);
 }