* [PATCH] drivers: media: remove V4L2_FL_USES_V4L2_FH
@ 2026-04-20 14:29 Oliver Neukum
2026-04-20 21:52 ` Laurent Pinchart
0 siblings, 1 reply; 2+ messages in thread
From: Oliver Neukum @ 2026-04-20 14:29 UTC (permalink / raw)
To: mchehab, hverkuil+cisco, laurent.pinchart+renesas, linux-media
Cc: Oliver Neukum
As usage of the feature is mandatory there is no point
in keeping the flag for it.
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,
};
--
2.53.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] drivers: media: remove V4L2_FL_USES_V4L2_FH
2026-04-20 14:29 [PATCH] drivers: media: remove V4L2_FL_USES_V4L2_FH Oliver Neukum
@ 2026-04-20 21:52 ` Laurent Pinchart
0 siblings, 0 replies; 2+ messages in thread
From: Laurent Pinchart @ 2026-04-20 21:52 UTC (permalink / raw)
To: Oliver Neukum; +Cc: mchehab, hverkuil+cisco, linux-media, Sakari Ailus
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-04-20 21:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-20 14:29 [PATCH] drivers: media: remove V4L2_FL_USES_V4L2_FH Oliver Neukum
2026-04-20 21:52 ` Laurent Pinchart
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox