[Intel-gfx] [PATCH 12/18] drm/sti: Use drm_atomic_helper_shutdown
Ville Syrjälä
ville.syrjala at linux.intel.com
Wed Oct 3 13:07:26 UTC 2018
On Wed, Oct 03, 2018 at 11:17:26AM +0200, Daniel Vetter wrote:
> 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.
>
> Signed-off-by: Daniel Vetter <daniel.vetter at ffwll.ch>
> Cc: Benjamin Gaignard <benjamin.gaignard at linaro.org>
> Cc: Vincent Abriou <vincent.abriou at st.com>
> ---
> drivers/gpu/drm/sti/sti_cursor.c | 1 -
> drivers/gpu/drm/sti/sti_drv.c | 6 +++---
> drivers/gpu/drm/sti/sti_gdp.c | 1 -
> drivers/gpu/drm/sti/sti_hqvdp.c | 1 -
> 4 files changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/sti/sti_cursor.c b/drivers/gpu/drm/sti/sti_cursor.c
> index 57b870e1e696..bc908453ffb3 100644
> --- a/drivers/gpu/drm/sti/sti_cursor.c
> +++ b/drivers/gpu/drm/sti/sti_cursor.c
> @@ -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);
> }
>
> diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
> index 6dced8abcf16..ac54e0f9caea 100644
> --- a/drivers/gpu/drm/sti/sti_drv.c
> +++ b/drivers/gpu/drm/sti/sti_drv.c
> @@ -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);
Looks like a more sane ordering. Not really sure how these component
based drivers work so probably not the best person to judge this,
but based on my weak understanding
Reviewed-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
> 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:
> diff --git a/drivers/gpu/drm/sti/sti_gdp.c b/drivers/gpu/drm/sti/sti_gdp.c
> index c32de6cbf061..3c19614d3f75 100644
> --- a/drivers/gpu/drm/sti/sti_gdp.c
> +++ b/drivers/gpu/drm/sti/sti_gdp.c
> @@ -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);
> }
>
> diff --git a/drivers/gpu/drm/sti/sti_hqvdp.c b/drivers/gpu/drm/sti/sti_hqvdp.c
> index 03ac3b4a4469..23565f52dd71 100644
> --- a/drivers/gpu/drm/sti/sti_hqvdp.c
> +++ b/drivers/gpu/drm/sti/sti_hqvdp.c
> @@ -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);
> }
>
> --
> 2.19.0.rc2
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Ville Syrjälä
Intel
More information about the Intel-gfx
mailing list