public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Oliver Neukum <oneukum@suse.com>
Cc: mchehab@kernel.org, hverkuil+cisco@kernel.org,
	linux-media@vger.kernel.org, Sakari Ailus <sakari.ailus@iki.fi>
Subject: Re: [PATCH] drivers: media: remove V4L2_FL_USES_V4L2_FH
Date: Tue, 21 Apr 2026 00:52:26 +0300	[thread overview]
Message-ID: <20260420215226.GA2360857@killaraus.ideasonboard.com> (raw)
In-Reply-To: <20260420142917.652245-1-oneukum@suse.com>

Hi Oliver,

Thank you for the patch.

On Mon, Apr 20, 2026 at 04:29:17PM +0200, Oliver Neukum wrote:
> As usage of the feature is mandatory there is no point
> in keeping the flag for it.

The point of the flag is to make sure all drivers call v4l2_fh_init()
(directly our by using the v4l2_fh_open() helper), as part of the
transition towards making this mandatory. This was merged in v6.18. As
I haven't heard of any regression, I assume all commonly used drivers
have been properly converted. Less commonly used drivers, however, may
not have been tested correctly. If we drop this flag now we'll crash
instead of returning an error. I feel we should keep the safeguard for a
while still, ideally replacing it with a mechanism that ensures all
drivers use the V4L2 fh API.

> Signed-off-by: Oliver Neukum <oneukum@suse.com>
> ---
>  drivers/media/v4l2-core/v4l2-dev.c | 8 --------
>  drivers/media/v4l2-core/v4l2-fh.c  | 1 -
>  include/media/v4l2-dev.h           | 5 -----
>  3 files changed, 14 deletions(-)
> 
> diff --git a/drivers/media/v4l2-core/v4l2-dev.c b/drivers/media/v4l2-core/v4l2-dev.c
> index 6ce623a1245a..5db1461d2159 100644
> --- a/drivers/media/v4l2-core/v4l2-dev.c
> +++ b/drivers/media/v4l2-core/v4l2-dev.c
> @@ -431,14 +431,6 @@ static int v4l2_open(struct inode *inode, struct file *filp)
>  	}
>  
>  	ret = vdev->fops->open(filp);
> -	if (ret)
> -		goto done;
> -
> -	/* All drivers must use v4l2_fh. */
> -	if (WARN_ON(!test_bit(V4L2_FL_USES_V4L2_FH, &vdev->flags))) {
> -		vdev->fops->release(filp);
> -		ret = -ENODEV;
> -	}
>  
>  done:
>  	if (vdev->dev_debug & V4L2_DEV_DEBUG_FOP)
> diff --git a/drivers/media/v4l2-core/v4l2-fh.c b/drivers/media/v4l2-core/v4l2-fh.c
> index b184bed8aca9..8741e623bd17 100644
> --- a/drivers/media/v4l2-core/v4l2-fh.c
> +++ b/drivers/media/v4l2-core/v4l2-fh.c
> @@ -24,7 +24,6 @@ void v4l2_fh_init(struct v4l2_fh *fh, struct video_device *vdev)
>  	/* Inherit from video_device. May be overridden by the driver. */
>  	fh->ctrl_handler = vdev->ctrl_handler;
>  	INIT_LIST_HEAD(&fh->list);
> -	set_bit(V4L2_FL_USES_V4L2_FH, &fh->vdev->flags);
>  	/*
>  	 * determine_valid_ioctls() does not know if struct v4l2_fh
>  	 * is used by this driver, but here we do. So enable the
> diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h
> index 2e0f6d2e6a78..7201f7787ce0 100644
> --- a/include/media/v4l2-dev.h
> +++ b/include/media/v4l2-dev.h
> @@ -71,10 +71,6 @@ struct dentry;
>   *	indicates that a &struct video_device is registered.
>   *	Drivers can clear this flag if they want to block all future
>   *	device access. It is cleared by video_unregister_device.
> - * @V4L2_FL_USES_V4L2_FH:
> - *	indicates that file->private_data points to &struct v4l2_fh.
> - *	This flag is set by the core when v4l2_fh_init() is called.
> - *	All drivers must use it.
>   * @V4L2_FL_QUIRK_INVERTED_CROP:
>   *	some old M2M drivers use g/s_crop/cropcap incorrectly: crop and
>   *	compose are swapped. If this flag is set, then the selection
> @@ -92,7 +88,6 @@ struct dentry;
>   */
>  enum v4l2_video_device_flags {
>  	V4L2_FL_REGISTERED		= 0,
> -	V4L2_FL_USES_V4L2_FH		= 1,
>  	V4L2_FL_QUIRK_INVERTED_CROP	= 2,
>  	V4L2_FL_SUBDEV_RO_DEVNODE	= 3,
>  };

-- 
Regards,

Laurent Pinchart

      reply	other threads:[~2026-04-20 21:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-20 14:29 [PATCH] drivers: media: remove V4L2_FL_USES_V4L2_FH Oliver Neukum
2026-04-20 21:52 ` Laurent Pinchart [this message]

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=20260420215226.GA2360857@killaraus.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=hverkuil+cisco@kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=oneukum@suse.com \
    --cc=sakari.ailus@iki.fi \
    /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