All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Hans Verkuil <hverkuil+cisco@kernel.org>
Cc: linux-media@vger.kernel.org, Keke Li <keke.li@amlogic.com>
Subject: Re: [PATCH 06/19] media: amlogic: c3: isp: drop vb2_queue_release calls
Date: Fri, 17 Jul 2026 15:47:40 +0300	[thread overview]
Message-ID: <20260717124740.GT1778116@killaraus.ideasonboard.com> (raw)
In-Reply-To: <23c3158b126781da9437ec8facf153bf95520fc4.1784276382.git.hverkuil+cisco@kernel.org>

Hi Hans,

Thank you for the patch.

On Fri, Jul 17, 2026 at 10:19:29AM +0200, Hans Verkuil wrote:
> Either that function was called when the video device was not
> yet registered (so nothing to release), or use vb2_video_unregister_device
> instead of the video_unregister_device/vb2_queue_release pair.
> 
> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
> Cc: Keke Li <keke.li@amlogic.com>
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
>  .../media/platform/amlogic/c3/isp/c3-isp-capture.c    |  7 ++-----
>  drivers/media/platform/amlogic/c3/isp/c3-isp-params.c | 11 ++++-------
>  drivers/media/platform/amlogic/c3/isp/c3-isp-stats.c  |  7 ++-----
>  3 files changed, 8 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/media/platform/amlogic/c3/isp/c3-isp-capture.c b/drivers/media/platform/amlogic/c3/isp/c3-isp-capture.c
> index 11d85f5342f0..a0d92ac1b78c 100644
> --- a/drivers/media/platform/amlogic/c3/isp/c3-isp-capture.c
> +++ b/drivers/media/platform/amlogic/c3/isp/c3-isp-capture.c
> @@ -720,7 +720,7 @@ static int c3_isp_register_capture(struct c3_isp_capture *cap)
>  	cap->pad.flags = MEDIA_PAD_FL_SINK;
>  	ret = media_entity_pads_init(&vdev->entity, 1, &cap->pad);
>  	if (ret)
> -		goto err_queue_release;
> +		goto err_destroy;
>  
>  	ret = video_register_device(vdev, VFL_TYPE_VIDEO, -1);
>  	if (ret) {
> @@ -733,8 +733,6 @@ static int c3_isp_register_capture(struct c3_isp_capture *cap)
>  
>  err_entity_cleanup:
>  	media_entity_cleanup(&vdev->entity);
> -err_queue_release:
> -	vb2_queue_release(vb2_q);
>  err_destroy:
>  	mutex_destroy(&cap->lock);
>  	return ret;
> @@ -789,9 +787,8 @@ void c3_isp_captures_unregister(struct c3_isp_device *isp)
>  
>  		if (!cap->isp)
>  			continue;
> -		vb2_queue_release(&cap->vb2_q);
>  		media_entity_cleanup(&cap->vdev.entity);
> -		video_unregister_device(&cap->vdev);
> +		vb2_video_unregister_device(&cap->vdev);

Is it safe to change the order of operations here, can't driver code
called from queue release access the media entity ?

Same below.

>  		mutex_destroy(&cap->lock);
>  	}
>  }
> diff --git a/drivers/media/platform/amlogic/c3/isp/c3-isp-params.c b/drivers/media/platform/amlogic/c3/isp/c3-isp-params.c
> index aec3eed0e443..782f18c90995 100644
> --- a/drivers/media/platform/amlogic/c3/isp/c3-isp-params.c
> +++ b/drivers/media/platform/amlogic/c3/isp/c3-isp-params.c
> @@ -876,12 +876,12 @@ int c3_isp_params_register(struct c3_isp_device *isp)
>  
>  	ret = vb2_queue_init(vb2_q);
>  	if (ret)
> -		goto err_detroy;
> +		goto err_destroy;
>  
>  	params->pad.flags = MEDIA_PAD_FL_SOURCE;
>  	ret = media_entity_pads_init(&vdev->entity, 1, &params->pad);
>  	if (ret)
> -		goto err_queue_release;
> +		goto err_destroy;
>  
>  	ret = video_register_device(vdev, VFL_TYPE_VIDEO, -1);
>  	if (ret < 0) {
> @@ -894,9 +894,7 @@ int c3_isp_params_register(struct c3_isp_device *isp)
>  
>  err_entity_cleanup:
>  	media_entity_cleanup(&vdev->entity);
> -err_queue_release:
> -	vb2_queue_release(vb2_q);
> -err_detroy:
> +err_destroy:
>  	mutex_destroy(&params->lock);
>  	return ret;
>  }
> @@ -905,9 +903,8 @@ void c3_isp_params_unregister(struct c3_isp_device *isp)
>  {
>  	struct c3_isp_params *params = &isp->params;
>  
> -	vb2_queue_release(&params->vb2_q);
>  	media_entity_cleanup(&params->vdev.entity);
> -	video_unregister_device(&params->vdev);
> +	vb2_video_unregister_device(&params->vdev);
>  	mutex_destroy(&params->lock);
>  }
>  
> diff --git a/drivers/media/platform/amlogic/c3/isp/c3-isp-stats.c b/drivers/media/platform/amlogic/c3/isp/c3-isp-stats.c
> index 8a5d7e1a30c9..78722cbe44b4 100644
> --- a/drivers/media/platform/amlogic/c3/isp/c3-isp-stats.c
> +++ b/drivers/media/platform/amlogic/c3/isp/c3-isp-stats.c
> @@ -279,7 +279,7 @@ int c3_isp_stats_register(struct c3_isp_device *isp)
>  	stats->pad.flags = MEDIA_PAD_FL_SINK;
>  	ret = media_entity_pads_init(&vdev->entity, 1, &stats->pad);
>  	if (ret)
> -		goto err_queue_release;
> +		goto err_destroy;
>  
>  	ret = video_register_device(vdev, VFL_TYPE_VIDEO, -1);
>  	if (ret) {
> @@ -292,8 +292,6 @@ int c3_isp_stats_register(struct c3_isp_device *isp)
>  
>  err_entity_cleanup:
>  	media_entity_cleanup(&vdev->entity);
> -err_queue_release:
> -	vb2_queue_release(vb2_q);
>  err_destroy:
>  	mutex_destroy(&stats->lock);
>  	return ret;
> @@ -303,9 +301,8 @@ void c3_isp_stats_unregister(struct c3_isp_device *isp)
>  {
>  	struct c3_isp_stats *stats = &isp->stats;
>  
> -	vb2_queue_release(&stats->vb2_q);
>  	media_entity_cleanup(&stats->vdev.entity);
> -	video_unregister_device(&stats->vdev);
> +	vb2_video_unregister_device(&stats->vdev);
>  	mutex_destroy(&stats->lock);
>  }
>  

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2026-07-17 12:47 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-17  8:19 [PATCH 00/19] media: clean up unnecessary vb2_queue_release calls Hans Verkuil
2026-07-17  8:19 ` [PATCH 01/19] media: videobuf2-v4l2.h: improve vb2_queue_release() documentation Hans Verkuil
2026-07-17  8:19 ` [PATCH 02/19] media: pci: hws: drop call to vb2_queue_release Hans Verkuil
2026-07-17  8:19 ` [PATCH 03/19] media: pci: ipu6: drop calls to vb2_video_unregister_device and vb2_queue_release Hans Verkuil
2026-07-17  8:19 ` [PATCH 04/19] media: pci: zoran: use vb2_video_unregister_device Hans Verkuil
2026-07-17  8:19 ` [PATCH 05/19] media: platform: amd: isp4: drop vb2_queue_release calls Hans Verkuil
2026-07-17  8:53   ` Bin Du
2026-07-17  8:19 ` [PATCH 06/19] media: amlogic: c3: isp: " Hans Verkuil
2026-07-17 12:47   ` Laurent Pinchart [this message]
2026-07-17  8:19 ` [PATCH 07/19] media: amphion: drop unnecessary vb2_queue_release call Hans Verkuil
2026-07-17  8:19 ` [PATCH 08/19] media: arm: mali-c55: drop unnecessary vb2_queue_release calls Hans Verkuil
2026-07-17  8:19 ` [PATCH 09/19] media: imagination: e5010-jpeg-enc: drop vb2_queue_release Hans Verkuil
2026-07-17  8:19 ` [PATCH 10/19] media: nuvoton: drop unnecessary vb2_queue_release calls Hans Verkuil
2026-07-17  8:19 ` [PATCH 11/19] media: nxp: imx7-media-csi: use _vb2_fop_release/vb2_video_unregister_device Hans Verkuil
2026-07-17 12:41   ` Laurent Pinchart
2026-07-17  8:19 ` [PATCH 12/19] media: raspberrypi: pisp_be: use vb2_video_unregister_device Hans Verkuil
2026-07-17  8:19 ` [PATCH 13/19] media: renesas: rzv2h-cru: " Hans Verkuil
2026-07-17  8:19 ` [PATCH 14/19] media: renesas: rzv2h-ivc: drop unnecessary vb2_queue_release calls Hans Verkuil
2026-07-17  8:19 ` [PATCH 15/19] media: samsung: s3c-camif: drop unnecessary vb2_queue_release Hans Verkuil
2026-07-17  8:19 ` [PATCH 16/19] media: ti: j721e-csi2rx: use vb2_video_unregister_device Hans Verkuil
2026-07-17  8:19 ` [PATCH 17/19] staging: media: imx: drop vb2_queue_release call Hans Verkuil
2026-07-17  8:19 ` [PATCH 18/19] staging: media: ipu7: drop unnecessary cleanup calls Hans Verkuil
2026-07-17  8:19 ` [PATCH 19/19] media: renesas: rzg2l-cru: drop unnecessary vb2_queue_release Hans Verkuil

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=20260717124740.GT1778116@killaraus.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=hverkuil+cisco@kernel.org \
    --cc=keke.li@amlogic.com \
    --cc=linux-media@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.