[PATCH 7/7] drm/fsl-dcu: Use drm_plane_helper_destroy()

Daniel Vetter daniel at ffwll.ch
Thu Aug 11 16:46:04 UTC 2022


On Wed, Jul 20, 2022 at 10:30:58AM +0200, Thomas Zimmermann wrote:
> Replace the driver's own function with drm_plane_helper_destroy(). No
> functional changes.
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>

Somewhat aside, but the real fix here is switching over to the drmm
versions of this. As long as all you're doing is cleanup+kfree those
should be safe, even if the driver overall is not converted at all.

Well ok I think you need to minimally convert over to
drmm_mode_config_init(), otherwise things go boom.

Quick grep says we don't have _destroy() helpers for anything else, so
this plane helper here is very much the odd one out, not sure spreading it
is a good idea. Maybe some todo at least?
-Daniel

> ---
>  drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c | 9 ++-------
>  1 file changed, 2 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c
> index e4f518e44945..3b20e79158c8 100644
> --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c
> +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c
> @@ -14,6 +14,7 @@
>  #include <drm/drm_fourcc.h>
>  #include <drm/drm_framebuffer.h>
>  #include <drm/drm_gem_cma_helper.h>
> +#include <drm/drm_plane_helper.h>
>  #include <drm/drm_probe_helper.h>
>  
>  #include "fsl_dcu_drm_drv.h"
> @@ -170,16 +171,10 @@ static const struct drm_plane_helper_funcs fsl_dcu_drm_plane_helper_funcs = {
>  	.atomic_update = fsl_dcu_drm_plane_atomic_update,
>  };
>  
> -static void fsl_dcu_drm_plane_destroy(struct drm_plane *plane)
> -{
> -	drm_plane_cleanup(plane);
> -	kfree(plane);
> -}
> -
>  static const struct drm_plane_funcs fsl_dcu_drm_plane_funcs = {
>  	.atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
>  	.atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
> -	.destroy = fsl_dcu_drm_plane_destroy,
> +	.destroy = drm_plane_helper_destroy,
>  	.disable_plane = drm_atomic_helper_disable_plane,
>  	.reset = drm_atomic_helper_plane_reset,
>  	.update_plane = drm_atomic_helper_update_plane,
> -- 
> 2.36.1
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


More information about the dri-devel mailing list