Re: [PATCH 14/17] drm/tegra: Convert to using __drm_atomic_helper_crtc_reset() for reset.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Mar 01, 2019 at 01:56:24PM +0100, Maarten Lankhorst wrote:
> Convert tegra to using __drm_atomic_helper_crtc_reset(), instead of
> writing its own version. Instead of open coding destroy_state(),
> call it directly for freeing the old state.
> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@xxxxxxxxxxxxxxx>
> Cc: Thierry Reding <thierry.reding@xxxxxxxxx>
> Cc: Jonathan Hunter <jonathanh@xxxxxxxxxx>
> Cc: linux-tegra@xxxxxxxxxxxxxxx
> ---
>  drivers/gpu/drm/tegra/dc.c | 30 +++++++++++-------------------
>  1 file changed, 11 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c
> index 607a6ea17ecc..57c88d78cdaa 100644
> --- a/drivers/gpu/drm/tegra/dc.c
> +++ b/drivers/gpu/drm/tegra/dc.c
> @@ -1153,25 +1153,6 @@ static void tegra_dc_destroy(struct drm_crtc *crtc)
>  	drm_crtc_cleanup(crtc);
>  }
>  
> -static void tegra_crtc_reset(struct drm_crtc *crtc)
> -{
> -	struct tegra_dc_state *state;
> -
> -	if (crtc->state)
> -		__drm_atomic_helper_crtc_destroy_state(crtc->state);
> -
> -	kfree(crtc->state);
> -	crtc->state = NULL;
> -
> -	state = kzalloc(sizeof(*state), GFP_KERNEL);
> -	if (state) {
> -		crtc->state = &state->base;
> -		crtc->state->crtc = crtc;
> -	}
> -
> -	drm_crtc_vblank_reset(crtc);
> -}
> -
>  static struct drm_crtc_state *
>  tegra_crtc_atomic_duplicate_state(struct drm_crtc *crtc)
>  {
> @@ -1198,6 +1179,17 @@ static void tegra_crtc_atomic_destroy_state(struct drm_crtc *crtc,
>  	kfree(state);
>  }
>  
> +static void tegra_crtc_reset(struct drm_crtc *crtc)
> +{
> +	struct tegra_dc_state *state = kzalloc(sizeof(*state), GFP_KERNEL);
> +
> +	if (crtc->state)
> +		tegra_crtc_atomic_destroy_state(crtc, crtc->state);
> +
> +	__drm_atomic_helper_crtc_reset(crtc, &state->base);
> +	drm_crtc_vblank_reset(crtc);
> +}
> +

I would preferred a predeclaration of tegra_crtc_atomic_destroy_state()
in this case because the implementations are in the same order as their
use in tegra_crtc_funcs, but I think I can live with it, so either way:

Acked-by: Thierry Reding <treding@xxxxxxxxxx>

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux