public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: <Manikandan.M@microchip.com>
To: <Ludovic.Desroches@microchip.com>, <Dharma.B@microchip.com>,
	<maarten.lankhorst@linux.intel.com>, <mripard@kernel.org>,
	<tzimmermann@suse.de>, <airlied@gmail.com>, <simona@ffwll.ch>,
	<Nicolas.Ferre@microchip.com>, <alexandre.belloni@bootlin.com>,
	<claudiu.beznea@tuxon.dev>
Cc: <dri-devel@lists.freedesktop.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 8/8] drm/atmel-hlcdc: destroy properly the plane state in the reset callback
Date: Mon, 5 Jan 2026 06:24:33 +0000	[thread overview]
Message-ID: <5c7b089a-6e6c-4624-b5d4-e3363318801c@microchip.com> (raw)
In-Reply-To: <20251218-lcd_cleanup_mainline-v2-8-df837aba878f@microchip.com>

On 18/12/25 6:56 pm, Ludovic Desroches wrote:
> If there is a plane state to destroy when doing a plane reset, destroy
> it using the atmel_hlcdc_plane_destroy_state() function. So we call
> __drm_atomic_helper_plane_destroy_state() and avoid code duplication.
> 
> Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com>

Reviewed-by: Manikandan Muralidharan <manikandan.m@microchip.com>

> ---
>   drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | 52 ++++++++++++-------------
>   1 file changed, 26 insertions(+), 26 deletions(-)
> 
> diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
> index c1f3aaae29fb9f6b947f81e2fb4e7a61e10ac5d9..81dc730362322a4bae9b48dca97b06baa1e331e7 100644
> --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
> +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
> @@ -1155,32 +1155,6 @@ static int atmel_hlcdc_plane_alloc_dscrs(struct drm_plane *p,
>   	return -ENOMEM;
>   }
>   
> -static void atmel_hlcdc_plane_reset(struct drm_plane *p)
> -{
> -	struct atmel_hlcdc_plane_state *state;
> -
> -	if (p->state) {
> -		state = drm_plane_state_to_atmel_hlcdc_plane_state(p->state);
> -
> -		if (state->base.fb)
> -			drm_framebuffer_put(state->base.fb);
> -
> -		kfree(state);
> -		p->state = NULL;
> -	}
> -
> -	state = kzalloc(sizeof(*state), GFP_KERNEL);
> -	if (state) {
> -		if (atmel_hlcdc_plane_alloc_dscrs(p, state)) {
> -			kfree(state);
> -			drm_err(p->dev,
> -				"Failed to allocate initial plane state\n");
> -			return;
> -		}
> -		__drm_atomic_helper_plane_reset(p, &state->base);
> -	}
> -}
> -
>   static struct drm_plane_state *
>   atmel_hlcdc_plane_atomic_duplicate_state(struct drm_plane *p)
>   {
> @@ -1222,6 +1196,32 @@ static void atmel_hlcdc_plane_atomic_destroy_state(struct drm_plane *p,
>   	kfree(state);
>   }
>   
> +static void atmel_hlcdc_plane_reset(struct drm_plane *p)
> +{
> +	struct atmel_hlcdc_plane_state *state;
> +	struct atmel_hlcdc_dc *dc = p->dev->dev_private;
> +	struct atmel_hlcdc_plane *plane = drm_plane_to_atmel_hlcdc_plane(p);
> +
> +	if (p->state) {
> +		atmel_hlcdc_plane_atomic_destroy_state(p, p->state);
> +		p->state = NULL;
> +	}
> +
> +	state = kzalloc(sizeof(*state), GFP_KERNEL);
> +	if (state) {
> +		if (atmel_hlcdc_plane_alloc_dscrs(p, state)) {
> +			kfree(state);
> +			drm_err(p->dev,
> +				"Failed to allocate initial plane state\n");
> +			return;
> +		}
> +		__drm_atomic_helper_plane_reset(p, &state->base);
> +	}
> +
> +	if (plane->layer.desc->layout.csc)
> +		dc->desc->ops->lcdc_csc_init(plane, plane->layer.desc);
> +}
> +
>   static const struct drm_plane_funcs layer_plane_funcs = {
>   	.update_plane = drm_atomic_helper_update_plane,
>   	.disable_plane = drm_atomic_helper_disable_plane,
> 

-- 
Thanks and Regards,
Manikandan M.


  reply	other threads:[~2026-01-05  6:24 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-18 13:25 [PATCH v2 0/8] drm/atmel-hlcdc: make more use of helpers Ludovic Desroches
2025-12-18 13:25 ` [PATCH v2 1/8] drm/atmel-hlcdc: use managed device resources for the display controller Ludovic Desroches
2025-12-18 13:26 ` [PATCH v2 2/8] drm/atmel-hlcdc: add support for the nomodeset kernel parameter Ludovic Desroches
2025-12-18 13:26 ` [PATCH v2 3/8] drm/atmel-hlcdc: use drmm_simple_encoder_alloc() Ludovic Desroches
2025-12-18 13:26 ` [PATCH v2 4/8] drm/atmel-hlcdc: use drm_crtc_mask() Ludovic Desroches
2025-12-18 13:26 ` [PATCH v2 5/8] drm/atmel-hlcdc: use devm_drm_of_get_bridge() Ludovic Desroches
2026-01-05  6:20   ` Manikandan.M
2025-12-18 13:26 ` [PATCH v2 6/8] drm/atmel-hlcdc: use drmm_crtc_alloc_with_planes() Ludovic Desroches
2025-12-18 13:26 ` [PATCH v2 7/8] drm/atmel-hlcdc: use drmm_universal_plane_alloc() Ludovic Desroches
2025-12-18 13:26 ` [PATCH v2 8/8] drm/atmel-hlcdc: destroy properly the plane state in the reset callback Ludovic Desroches
2026-01-05  6:24   ` Manikandan.M [this message]
2026-01-20 11:22 ` [PATCH v2 0/8] drm/atmel-hlcdc: make more use of helpers Manikandan.M

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5c7b089a-6e6c-4624-b5d4-e3363318801c@microchip.com \
    --to=manikandan.m@microchip.com \
    --cc=Dharma.B@microchip.com \
    --cc=Ludovic.Desroches@microchip.com \
    --cc=Nicolas.Ferre@microchip.com \
    --cc=airlied@gmail.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=claudiu.beznea@tuxon.dev \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox