On Fri, Aug 21, 2026 at 04:39:22PM +0200, Maxime Ripard wrote:
> The malidp crtc implementation provides a custom reset hook. However,
> this hook only allocates the state, initializes it with
> __drm_atomic_helper_crtc_reset(), and frees the previous state. It
> does not perform any hardware reset.
> 
> Since this is exactly what the atomic_create_state hook is meant to
> do, minus the old state cleanup which the caller handles, convert the
> implementation to use atomic_create_state with
> __drm_atomic_helper_crtc_state_init() instead.
> 
> Signed-off-by: Maxime Ripard <[email protected]>

Acked-by: Liviu Dudau <[email protected]>

Best regards,
Liviu

> ---
> Cc: Liviu Dudau <[email protected]>
> ---
>  drivers/gpu/drm/arm/malidp_crtc.c | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/arm/malidp_crtc.c 
> b/drivers/gpu/drm/arm/malidp_crtc.c
> index ebe8e1078777..157ff148efe7 100644
> --- a/drivers/gpu/drm/arm/malidp_crtc.c
> +++ b/drivers/gpu/drm/arm/malidp_crtc.c
> @@ -474,21 +474,21 @@ static void malidp_crtc_destroy_state(struct drm_crtc 
> *crtc,
>       }
>  
>       kfree(mali_state);
>  }
>  
> -static void malidp_crtc_reset(struct drm_crtc *crtc)
> +static struct drm_crtc_state *malidp_crtc_create_state(struct drm_crtc *crtc)
>  {
> -     struct malidp_crtc_state *state = kzalloc_obj(*state);
> +     struct malidp_crtc_state *state;
>  
> -     if (crtc->state)
> -             malidp_crtc_destroy_state(crtc, crtc->state);
> +     state = kzalloc_obj(*state);
> +     if (!state)
> +             return ERR_PTR(-ENOMEM);
>  
> -     if (state)
> -             __drm_atomic_helper_crtc_reset(crtc, &state->base);
> -     else
> -             __drm_atomic_helper_crtc_reset(crtc, NULL);
> +     __drm_atomic_helper_crtc_state_init(&state->base, crtc);
> +
> +     return &state->base;
>  }
>  
>  static int malidp_crtc_enable_vblank(struct drm_crtc *crtc)
>  {
>       struct malidp_drm *malidp = crtc_to_malidp_device(crtc);
> @@ -509,11 +509,11 @@ static void malidp_crtc_disable_vblank(struct drm_crtc 
> *crtc)
>  }
>  
>  static const struct drm_crtc_funcs malidp_crtc_funcs = {
>       .set_config = drm_atomic_helper_set_config,
>       .page_flip = drm_atomic_helper_page_flip,
> -     .reset = malidp_crtc_reset,
> +     .atomic_create_state = malidp_crtc_create_state,
>       .atomic_duplicate_state = malidp_crtc_duplicate_state,
>       .atomic_destroy_state = malidp_crtc_destroy_state,
>       .enable_vblank = malidp_crtc_enable_vblank,
>       .disable_vblank = malidp_crtc_disable_vblank,
>  };
> 
> -- 
> 2.55.0
> 

-- 
====================
| I would like to |
| fix the world,  |
| but they're not |
| giving me the   |
 \ source code!  /
  ---------------
    ¯\_(ツ)_/¯

Reply via email to