Linux Media Controller development
 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, Frank Li <Frank.Li@nxp.com>
Subject: Re: [PATCH 11/19] media: nxp: imx7-media-csi: use _vb2_fop_release/vb2_video_unregister_device
Date: Fri, 17 Jul 2026 15:41:10 +0300	[thread overview]
Message-ID: <20260717124110.GS1778116@killaraus.ideasonboard.com> (raw)
In-Reply-To: <b782f0db9e0521f97f001d71e3acdc0bc610b066.1784276382.git.hverkuil+cisco@kernel.org>

On Fri, Jul 17, 2026 at 10:19:34AM +0200, Hans Verkuil wrote:
> Use _vb2_fop_release instead of manually calling vb2_queue_release
> and v4l2_fh_release.
> 
> Use vb2_video_unregister_device instead of video_unregister_device
> to ensure vb2_queue_release is called inside vb2_video_unregister_device
> if needed.

Please expand on the "if needed" to explain why this is needed.

> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Cc: Frank Li <Frank.Li@nxp.com>
> ---
>  drivers/media/platform/nxp/imx7-media-csi.c | 10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/media/platform/nxp/imx7-media-csi.c b/drivers/media/platform/nxp/imx7-media-csi.c
> index 7ddc7ba06e3d..eb2b54944ed1 100644
> --- a/drivers/media/platform/nxp/imx7-media-csi.c
> +++ b/drivers/media/platform/nxp/imx7-media-csi.c
> @@ -1545,14 +1545,10 @@ static int imx7_csi_video_release(struct file *file)
>  
>  	mutex_lock(&csi->vdev_mutex);
>  
> -	if (file->private_data == vq->owner) {
> -		vb2_queue_release(vq);
> -		vq->owner = NULL;
> -	}
> +	_vb2_fop_release(file, NULL);
>  
>  	v4l2_pipeline_pm_put(&csi->vdev->entity);
>  
> -	v4l2_fh_release(file);

You're effectively inverting the order of v4l2_pipeline_pm_put() and
v4l2_fh_release(). Please explain in the commit message why this is
safe.

Commit messages need first and foremost to explain *why* a change is
needed. The *what* and *how* are secondary.

>  	mutex_unlock(&csi->vdev_mutex);
>  	return 0;
>  }
> @@ -1627,7 +1623,7 @@ static int imx7_csi_video_register(struct imx7_csi *csi)
>  				    MEDIA_LNK_FL_ENABLED);
>  	if (ret) {
>  		dev_err(csi->dev, "failed to create link to device node\n");
> -		video_unregister_device(vdev);
> +		vb2_video_unregister_device(vdev);
>  		return ret;
>  	}
>  
> @@ -1637,7 +1633,7 @@ static int imx7_csi_video_register(struct imx7_csi *csi)
>  static void imx7_csi_video_unregister(struct imx7_csi *csi)
>  {
>  	media_entity_cleanup(&csi->vdev->entity);
> -	video_unregister_device(csi->vdev);
> +	vb2_video_unregister_device(csi->vdev);
>  }
>  
>  static int imx7_csi_video_init(struct imx7_csi *csi)

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2026-07-17 12:41 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
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 [this message]
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=20260717124110.GS1778116@killaraus.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=Frank.Li@nxp.com \
    --cc=hverkuil+cisco@kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox