* [PATCH v3 00/12] media: Remove vidioc_g/s_ctrl and vidioc_queryctrl callbacks
@ 2025-02-23 18:58 Ricardo Ribalda
2025-02-23 18:58 ` [PATCH v3 01/12] media: ioctl: Simulate v4l2_queryctrl with v4l2_query_ext_ctrl Ricardo Ribalda
` (11 more replies)
0 siblings, 12 replies; 14+ messages in thread
From: Ricardo Ribalda @ 2025-02-23 18:58 UTC (permalink / raw)
To: Mauro Carvalho Chehab, Mike Isely, Laurent Pinchart,
Hans de Goede, Sakari Ailus, Andy Shevchenko, Greg Kroah-Hartman,
Hans Verkuil
Cc: linux-media, linux-kernel, linux-staging, Ricardo Ribalda
Most of the drivers use the control framework or can use the superset
version of these callbacks: vidioc_g/s_ext_ctrl and
vidioc_query_ext_ctrl.
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
Changes in v3:
- Rename wl1273_fm_vidioc_s_ctrl
- Remove dead code from cx231xx-417
- Link to v2: https://lore.kernel.org/r/20241210-queryctrl-v2-0-c0a33d69f416@chromium.org
Changes in v2:
- v4l2_query_ext_ctrl_to_v4l2_queryctrl
- Fix conversion (Thanks Hans)
- Link to v1: https://lore.kernel.org/r/20241209-queryctrl-v1-0-deff7acfcdcb@chromium.org
---
Ricardo Ribalda (12):
media: ioctl: Simulate v4l2_queryctrl with v4l2_query_ext_ctrl
media: pvrusb2: Convert queryctrl to query_ext_ctrl
media: pvrusb2: Remove g/s_ctrl callbacks
media: uvcvideo: Remove vidioc_queryctrl
media: atomisp: Replace queryctrl with query_ext_ctrl
media: atomisp: Remove vidioc_g/s callback
media: v4l2: Remove vidioc_queryctrl callback
media: v4l2: Remove vidioc_g_ctrl callback
media: cx231xx: Remove vidioc_s_ctrl callback
media: v4l2: Remove vidioc_s_ctrl callback
media: v4l2-core: Introduce v4l2_query_ext_ctrl_to_v4l2_queryctrl
media: radio-wl1273: Rename wl1273_fm_vidioc_s_ctrl
drivers/media/radio/radio-wl1273.c | 4 +-
drivers/media/usb/cx231xx/cx231xx-417.c | 15 -------
drivers/media/usb/pvrusb2/pvrusb2-v4l2.c | 40 ++++--------------
drivers/media/usb/uvc/uvc_v4l2.c | 10 -----
drivers/media/v4l2-core/v4l2-ctrls-api.c | 51 +++++++++++++----------
drivers/media/v4l2-core/v4l2-dev.c | 6 +--
drivers/media/v4l2-core/v4l2-ioctl.c | 19 +++++----
drivers/staging/media/atomisp/pci/atomisp_ioctl.c | 35 ++++++++--------
include/media/v4l2-ctrls.h | 12 ++++++
include/media/v4l2-ioctl.h | 12 ------
10 files changed, 85 insertions(+), 119 deletions(-)
---
base-commit: c2b96a6818159fba8a3bcc38262da9e77f9b3ec7
change-id: 20241209-queryctrl-5c3632b7c857
Best regards,
--
Ricardo Ribalda <ribalda@chromium.org>
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v3 01/12] media: ioctl: Simulate v4l2_queryctrl with v4l2_query_ext_ctrl
2025-02-23 18:58 [PATCH v3 00/12] media: Remove vidioc_g/s_ctrl and vidioc_queryctrl callbacks Ricardo Ribalda
@ 2025-02-23 18:58 ` Ricardo Ribalda
2025-02-23 18:58 ` [PATCH v3 02/12] media: pvrusb2: Convert queryctrl to query_ext_ctrl Ricardo Ribalda
` (10 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: Ricardo Ribalda @ 2025-02-23 18:58 UTC (permalink / raw)
To: Mauro Carvalho Chehab, Mike Isely, Laurent Pinchart,
Hans de Goede, Sakari Ailus, Andy Shevchenko, Greg Kroah-Hartman,
Hans Verkuil
Cc: linux-media, linux-kernel, linux-staging, Ricardo Ribalda
v4l2_queryctrl is a subset of v4l2_query_ext_ctrl. If the driver does
not implement v4l2_queryctrl we can implement it with
v4l2_query_ext_ctrl.
Suggested-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/media/v4l2-core/v4l2-dev.c | 3 ++-
drivers/media/v4l2-core/v4l2-ioctl.c | 37 +++++++++++++++++++++++++++++++++++-
2 files changed, 38 insertions(+), 2 deletions(-)
diff --git a/drivers/media/v4l2-core/v4l2-dev.c b/drivers/media/v4l2-core/v4l2-dev.c
index 5bcaeeba4d09..252308a67fa8 100644
--- a/drivers/media/v4l2-core/v4l2-dev.c
+++ b/drivers/media/v4l2-core/v4l2-dev.c
@@ -572,7 +572,8 @@ static void determine_valid_ioctls(struct video_device *vdev)
and that can't be tested here. If the bit for these control ioctls
is set, then the ioctl is valid. But if it is 0, then it can still
be valid if the filehandle passed the control handler. */
- if (vdev->ctrl_handler || ops->vidioc_queryctrl)
+ if (vdev->ctrl_handler || ops->vidioc_queryctrl ||
+ ops->vidioc_query_ext_ctrl)
__set_bit(_IOC_NR(VIDIOC_QUERYCTRL), valid_ioctls);
if (vdev->ctrl_handler || ops->vidioc_query_ext_ctrl)
__set_bit(_IOC_NR(VIDIOC_QUERY_EXT_CTRL), valid_ioctls);
diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
index 0304daa8471d..deed2b44ee18 100644
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
@@ -2284,9 +2284,11 @@ static int v4l_queryctrl(const struct v4l2_ioctl_ops *ops,
struct file *file, void *fh, void *arg)
{
struct video_device *vfd = video_devdata(file);
+ struct v4l2_query_ext_ctrl qec = {};
struct v4l2_queryctrl *p = arg;
struct v4l2_fh *vfh =
test_bit(V4L2_FL_USES_V4L2_FH, &vfd->flags) ? fh : NULL;
+ int ret;
if (vfh && vfh->ctrl_handler)
return v4l2_queryctrl(vfh->ctrl_handler, p);
@@ -2294,7 +2296,40 @@ static int v4l_queryctrl(const struct v4l2_ioctl_ops *ops,
return v4l2_queryctrl(vfd->ctrl_handler, p);
if (ops->vidioc_queryctrl)
return ops->vidioc_queryctrl(file, fh, p);
- return -ENOTTY;
+ if (!ops->vidioc_query_ext_ctrl)
+ return -ENOTTY;
+
+ /* Simulate query_ext_ctr using query_ctrl. */
+ qec.id = p->id;
+ ret = ops->vidioc_query_ext_ctrl(file, fh, &qec);
+ if (ret)
+ return ret;
+
+ p->id = qec.id;
+ p->type = qec.type;
+ p->flags = qec.flags;
+ strscpy(p->name, qec.name, sizeof(p->name));
+ switch (p->type) {
+ case V4L2_CTRL_TYPE_INTEGER:
+ case V4L2_CTRL_TYPE_BOOLEAN:
+ case V4L2_CTRL_TYPE_MENU:
+ case V4L2_CTRL_TYPE_INTEGER_MENU:
+ case V4L2_CTRL_TYPE_STRING:
+ case V4L2_CTRL_TYPE_BITMASK:
+ p->minimum = qec.minimum;
+ p->maximum = qec.maximum;
+ p->step = qec.step;
+ p->default_value = qec.default_value;
+ break;
+ default:
+ p->minimum = 0;
+ p->maximum = 0;
+ p->step = 0;
+ p->default_value = 0;
+ break;
+ }
+
+ return 0;
}
static int v4l_query_ext_ctrl(const struct v4l2_ioctl_ops *ops,
--
2.48.1.601.g30ceb7b040-goog
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v3 02/12] media: pvrusb2: Convert queryctrl to query_ext_ctrl
2025-02-23 18:58 [PATCH v3 00/12] media: Remove vidioc_g/s_ctrl and vidioc_queryctrl callbacks Ricardo Ribalda
2025-02-23 18:58 ` [PATCH v3 01/12] media: ioctl: Simulate v4l2_queryctrl with v4l2_query_ext_ctrl Ricardo Ribalda
@ 2025-02-23 18:58 ` Ricardo Ribalda
2025-02-23 18:58 ` [PATCH v3 03/12] media: pvrusb2: Remove g/s_ctrl callbacks Ricardo Ribalda
` (9 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: Ricardo Ribalda @ 2025-02-23 18:58 UTC (permalink / raw)
To: Mauro Carvalho Chehab, Mike Isely, Laurent Pinchart,
Hans de Goede, Sakari Ailus, Andy Shevchenko, Greg Kroah-Hartman,
Hans Verkuil
Cc: linux-media, linux-kernel, linux-staging, Ricardo Ribalda
The driver was missing support for query_ext_ctrl. Instead of adding a
new callback for it, replace the current implementation of queryctrl and
let the ioctl framework emulate the old function.
Most of the fields are identical, so the change is pretty simple.
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/media/usb/pvrusb2/pvrusb2-v4l2.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c b/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c
index d608b793fa84..7c8be6a0cf7c 100644
--- a/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c
+++ b/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c
@@ -497,8 +497,8 @@ static int pvr2_streamoff(struct file *file, void *priv, enum v4l2_buf_type i)
return pvr2_hdw_set_streaming(hdw, 0);
}
-static int pvr2_queryctrl(struct file *file, void *priv,
- struct v4l2_queryctrl *vc)
+static int pvr2_query_ext_ctrl(struct file *file, void *priv,
+ struct v4l2_query_ext_ctrl *vc)
{
struct pvr2_v4l2_fh *fh = file->private_data;
struct pvr2_hdw *hdw = fh->channel.mc_head->hdw;
@@ -521,13 +521,16 @@ static int pvr2_queryctrl(struct file *file, void *priv,
}
pvr2_trace(PVR2_TRACE_V4LIOCTL,
- "QUERYCTRL id=0x%x mapping name=%s (%s)",
+ "QUERYEXTCTRL id=0x%x mapping name=%s (%s)",
vc->id, pvr2_ctrl_get_name(cptr),
pvr2_ctrl_get_desc(cptr));
strscpy(vc->name, pvr2_ctrl_get_desc(cptr), sizeof(vc->name));
vc->flags = pvr2_ctrl_get_v4lflags(cptr);
pvr2_ctrl_get_def(cptr, &val);
vc->default_value = val;
+ vc->nr_of_dims = 0;
+ vc->elems = 1;
+ vc->elem_size = 4;
switch (pvr2_ctrl_get_type(cptr)) {
case pvr2_ctl_enum:
vc->type = V4L2_CTRL_TYPE_MENU;
@@ -549,7 +552,7 @@ static int pvr2_queryctrl(struct file *file, void *priv,
break;
default:
pvr2_trace(PVR2_TRACE_V4LIOCTL,
- "QUERYCTRL id=0x%x name=%s not mappable",
+ "QUERYEXTCTRL id=0x%x name=%s not mappable",
vc->id, pvr2_ctrl_get_name(cptr));
return -EINVAL;
}
@@ -812,7 +815,7 @@ static const struct v4l2_ioctl_ops pvr2_ioctl_ops = {
.vidioc_try_fmt_vid_cap = pvr2_try_fmt_vid_cap,
.vidioc_streamon = pvr2_streamon,
.vidioc_streamoff = pvr2_streamoff,
- .vidioc_queryctrl = pvr2_queryctrl,
+ .vidioc_query_ext_ctrl = pvr2_query_ext_ctrl,
.vidioc_querymenu = pvr2_querymenu,
.vidioc_g_ctrl = pvr2_g_ctrl,
.vidioc_s_ctrl = pvr2_s_ctrl,
--
2.48.1.601.g30ceb7b040-goog
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v3 03/12] media: pvrusb2: Remove g/s_ctrl callbacks
2025-02-23 18:58 [PATCH v3 00/12] media: Remove vidioc_g/s_ctrl and vidioc_queryctrl callbacks Ricardo Ribalda
2025-02-23 18:58 ` [PATCH v3 01/12] media: ioctl: Simulate v4l2_queryctrl with v4l2_query_ext_ctrl Ricardo Ribalda
2025-02-23 18:58 ` [PATCH v3 02/12] media: pvrusb2: Convert queryctrl to query_ext_ctrl Ricardo Ribalda
@ 2025-02-23 18:58 ` Ricardo Ribalda
2025-02-23 18:58 ` [PATCH v3 04/12] media: uvcvideo: Remove vidioc_queryctrl Ricardo Ribalda
` (8 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: Ricardo Ribalda @ 2025-02-23 18:58 UTC (permalink / raw)
To: Mauro Carvalho Chehab, Mike Isely, Laurent Pinchart,
Hans de Goede, Sakari Ailus, Andy Shevchenko, Greg Kroah-Hartman,
Hans Verkuil
Cc: linux-media, linux-kernel, linux-staging, Ricardo Ribalda
The ioctl helpers can emulate g/s_ctrl with g/s_ext_ctrl. Simplify the
code.
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/media/usb/pvrusb2/pvrusb2-v4l2.c | 27 ---------------------------
1 file changed, 27 deletions(-)
diff --git a/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c b/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c
index 7c8be6a0cf7c..ad38e1240541 100644
--- a/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c
+++ b/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c
@@ -574,31 +574,6 @@ static int pvr2_querymenu(struct file *file, void *priv, struct v4l2_querymenu *
return ret;
}
-static int pvr2_g_ctrl(struct file *file, void *priv, struct v4l2_control *vc)
-{
- struct pvr2_v4l2_fh *fh = file->private_data;
- struct pvr2_hdw *hdw = fh->channel.mc_head->hdw;
- int val = 0;
- int ret;
-
- ret = pvr2_ctrl_get_value(pvr2_hdw_get_ctrl_v4l(hdw, vc->id),
- &val);
- vc->value = val;
- return ret;
-}
-
-static int pvr2_s_ctrl(struct file *file, void *priv, struct v4l2_control *vc)
-{
- struct pvr2_v4l2_fh *fh = file->private_data;
- struct pvr2_hdw *hdw = fh->channel.mc_head->hdw;
- int ret;
-
- ret = pvr2_ctrl_set_value(pvr2_hdw_get_ctrl_v4l(hdw, vc->id),
- vc->value);
- pvr2_hdw_commit_ctl(hdw);
- return ret;
-}
-
static int pvr2_g_ext_ctrls(struct file *file, void *priv,
struct v4l2_ext_controls *ctls)
{
@@ -817,8 +792,6 @@ static const struct v4l2_ioctl_ops pvr2_ioctl_ops = {
.vidioc_streamoff = pvr2_streamoff,
.vidioc_query_ext_ctrl = pvr2_query_ext_ctrl,
.vidioc_querymenu = pvr2_querymenu,
- .vidioc_g_ctrl = pvr2_g_ctrl,
- .vidioc_s_ctrl = pvr2_s_ctrl,
.vidioc_g_ext_ctrls = pvr2_g_ext_ctrls,
.vidioc_s_ext_ctrls = pvr2_s_ext_ctrls,
.vidioc_try_ext_ctrls = pvr2_try_ext_ctrls,
--
2.48.1.601.g30ceb7b040-goog
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v3 04/12] media: uvcvideo: Remove vidioc_queryctrl
2025-02-23 18:58 [PATCH v3 00/12] media: Remove vidioc_g/s_ctrl and vidioc_queryctrl callbacks Ricardo Ribalda
` (2 preceding siblings ...)
2025-02-23 18:58 ` [PATCH v3 03/12] media: pvrusb2: Remove g/s_ctrl callbacks Ricardo Ribalda
@ 2025-02-23 18:58 ` Ricardo Ribalda
2025-02-23 18:58 ` [PATCH v3 05/12] media: atomisp: Replace queryctrl with query_ext_ctrl Ricardo Ribalda
` (7 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: Ricardo Ribalda @ 2025-02-23 18:58 UTC (permalink / raw)
To: Mauro Carvalho Chehab, Mike Isely, Laurent Pinchart,
Hans de Goede, Sakari Ailus, Andy Shevchenko, Greg Kroah-Hartman,
Hans Verkuil
Cc: linux-media, linux-kernel, linux-staging, Ricardo Ribalda
It can be implemented by the v4l2 ioctl framework using
vidioc_query_ext_ctrl.
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/media/usb/uvc/uvc_v4l2.c | 10 ----------
1 file changed, 10 deletions(-)
diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c
index 93c6cdb23881..89052455ed50 100644
--- a/drivers/media/usb/uvc/uvc_v4l2.c
+++ b/drivers/media/usb/uvc/uvc_v4l2.c
@@ -963,15 +963,6 @@ static int uvc_ioctl_s_input(struct file *file, void *fh, unsigned int input)
return ret;
}
-static int uvc_ioctl_queryctrl(struct file *file, void *fh,
- struct v4l2_queryctrl *qc)
-{
- struct uvc_fh *handle = fh;
- struct uvc_video_chain *chain = handle->chain;
-
- return uvc_query_v4l2_ctrl(chain, qc);
-}
-
static int uvc_ioctl_query_ext_ctrl(struct file *file, void *fh,
struct v4l2_query_ext_ctrl *qec)
{
@@ -1491,7 +1482,6 @@ const struct v4l2_ioctl_ops uvc_ioctl_ops = {
.vidioc_enum_input = uvc_ioctl_enum_input,
.vidioc_g_input = uvc_ioctl_g_input,
.vidioc_s_input = uvc_ioctl_s_input,
- .vidioc_queryctrl = uvc_ioctl_queryctrl,
.vidioc_query_ext_ctrl = uvc_ioctl_query_ext_ctrl,
.vidioc_g_ext_ctrls = uvc_ioctl_g_ext_ctrls,
.vidioc_s_ext_ctrls = uvc_ioctl_s_ext_ctrls,
--
2.48.1.601.g30ceb7b040-goog
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v3 05/12] media: atomisp: Replace queryctrl with query_ext_ctrl
2025-02-23 18:58 [PATCH v3 00/12] media: Remove vidioc_g/s_ctrl and vidioc_queryctrl callbacks Ricardo Ribalda
` (3 preceding siblings ...)
2025-02-23 18:58 ` [PATCH v3 04/12] media: uvcvideo: Remove vidioc_queryctrl Ricardo Ribalda
@ 2025-02-23 18:58 ` Ricardo Ribalda
2025-02-23 18:58 ` [PATCH v3 06/12] media: atomisp: Remove vidioc_g/s callback Ricardo Ribalda
` (6 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: Ricardo Ribalda @ 2025-02-23 18:58 UTC (permalink / raw)
To: Mauro Carvalho Chehab, Mike Isely, Laurent Pinchart,
Hans de Goede, Sakari Ailus, Andy Shevchenko, Greg Kroah-Hartman,
Hans Verkuil
Cc: linux-media, linux-kernel, linux-staging, Ricardo Ribalda
The ioctl framework provides an emulator of queryctrl using
query_ext_ctrl.
Replace our implementation of queryctrl to support both.
Now that we are at it:
- Add comment about missing functionality.
- Remove superfluous clear of reserved[0].
- Remove ret var.
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/staging/media/atomisp/pci/atomisp_ioctl.c | 33 ++++++++++++-----------
1 file changed, 18 insertions(+), 15 deletions(-)
diff --git a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c
index 1a960a01854f..6b84bd8e6cf3 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c
@@ -34,7 +34,7 @@ static const char *CARD = "ATOM ISP"; /* max size 31 */
* FIXME: ISP should not know beforehand all CIDs supported by sensor.
* Instead, it needs to propagate to sensor unknown CIDs.
*/
-static struct v4l2_queryctrl ci_v4l2_controls[] = {
+static struct v4l2_query_ext_ctrl ci_v4l2_controls[] = {
{
.id = V4L2_CID_AUTO_WHITE_BALANCE,
.type = V4L2_CTRL_TYPE_BOOLEAN,
@@ -1140,31 +1140,34 @@ static int atomisp_s_ctrl(struct file *file, void *fh,
/*
* To query the attributes of a control.
- * applications set the id field of a struct v4l2_queryctrl and call the
+ * applications set the id field of a struct v4l2_query_ext_ctrl and call the
* this ioctl with a pointer to this structure. The driver fills
* the rest of the structure.
*/
-static int atomisp_queryctl(struct file *file, void *fh,
- struct v4l2_queryctrl *qc)
+static int atomisp_query_ext_ctrl(struct file *file, void *fh,
+ struct v4l2_query_ext_ctrl *qc)
{
- int i, ret = -EINVAL;
+ int i;
+ /* TODO: implement V4L2_CTRL_FLAG_NEXT_CTRL */
if (qc->id & V4L2_CTRL_FLAG_NEXT_CTRL)
- return ret;
+ return -EINVAL;
for (i = 0; i < ctrls_num; i++) {
if (ci_v4l2_controls[i].id == qc->id) {
- memcpy(qc, &ci_v4l2_controls[i],
- sizeof(struct v4l2_queryctrl));
- qc->reserved[0] = 0;
- ret = 0;
- break;
+ *qc = ci_v4l2_controls[i];
+ qc->elems = 1;
+ qc->elem_size = 4;
+ return 0;
}
}
- if (ret != 0)
- qc->flags = V4L2_CTRL_FLAG_DISABLED;
- return ret;
+ /*
+ * This is probably not needed, but this flag has been set for
+ * many kernel versions. Leave it to avoid breaking any apps.
+ */
+ qc->flags = V4L2_CTRL_FLAG_DISABLED;
+ return -EINVAL;
}
static int atomisp_camera_g_ext_ctrls(struct file *file, void *fh,
@@ -1561,7 +1564,7 @@ const struct v4l2_ioctl_ops atomisp_ioctl_ops = {
.vidioc_enum_input = atomisp_enum_input,
.vidioc_g_input = atomisp_g_input,
.vidioc_s_input = atomisp_s_input,
- .vidioc_queryctrl = atomisp_queryctl,
+ .vidioc_query_ext_ctrl = atomisp_query_ext_ctrl,
.vidioc_s_ctrl = atomisp_s_ctrl,
.vidioc_g_ctrl = atomisp_g_ctrl,
.vidioc_s_ext_ctrls = atomisp_s_ext_ctrls,
--
2.48.1.601.g30ceb7b040-goog
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v3 06/12] media: atomisp: Remove vidioc_g/s callback
2025-02-23 18:58 [PATCH v3 00/12] media: Remove vidioc_g/s_ctrl and vidioc_queryctrl callbacks Ricardo Ribalda
` (4 preceding siblings ...)
2025-02-23 18:58 ` [PATCH v3 05/12] media: atomisp: Replace queryctrl with query_ext_ctrl Ricardo Ribalda
@ 2025-02-23 18:58 ` Ricardo Ribalda
2025-02-23 18:58 ` [PATCH v3 07/12] media: v4l2: Remove vidioc_queryctrl callback Ricardo Ribalda
` (5 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: Ricardo Ribalda @ 2025-02-23 18:58 UTC (permalink / raw)
To: Mauro Carvalho Chehab, Mike Isely, Laurent Pinchart,
Hans de Goede, Sakari Ailus, Andy Shevchenko, Greg Kroah-Hartman,
Hans Verkuil
Cc: linux-media, linux-kernel, linux-staging, Ricardo Ribalda
The v4l2 ioctl framework can implement vidioc_g/s_ctrl with
vidioc_g/s_ext_ctrl() and we provide those.
These are the last references of vidioc_s/g_ctrl in the codebase. We can
attempt to remove them now.
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/staging/media/atomisp/pci/atomisp_ioctl.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c
index 6b84bd8e6cf3..1fb2ba819de3 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c
@@ -1565,8 +1565,6 @@ const struct v4l2_ioctl_ops atomisp_ioctl_ops = {
.vidioc_g_input = atomisp_g_input,
.vidioc_s_input = atomisp_s_input,
.vidioc_query_ext_ctrl = atomisp_query_ext_ctrl,
- .vidioc_s_ctrl = atomisp_s_ctrl,
- .vidioc_g_ctrl = atomisp_g_ctrl,
.vidioc_s_ext_ctrls = atomisp_s_ext_ctrls,
.vidioc_g_ext_ctrls = atomisp_g_ext_ctrls,
.vidioc_enum_framesizes = atomisp_enum_framesizes,
--
2.48.1.601.g30ceb7b040-goog
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v3 07/12] media: v4l2: Remove vidioc_queryctrl callback
2025-02-23 18:58 [PATCH v3 00/12] media: Remove vidioc_g/s_ctrl and vidioc_queryctrl callbacks Ricardo Ribalda
` (5 preceding siblings ...)
2025-02-23 18:58 ` [PATCH v3 06/12] media: atomisp: Remove vidioc_g/s callback Ricardo Ribalda
@ 2025-02-23 18:58 ` Ricardo Ribalda
2025-02-23 18:58 ` [PATCH v3 08/12] media: v4l2: Remove vidioc_g_ctrl callback Ricardo Ribalda
` (4 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: Ricardo Ribalda @ 2025-02-23 18:58 UTC (permalink / raw)
To: Mauro Carvalho Chehab, Mike Isely, Laurent Pinchart,
Hans de Goede, Sakari Ailus, Andy Shevchenko, Greg Kroah-Hartman,
Hans Verkuil
Cc: linux-media, linux-kernel, linux-staging, Ricardo Ribalda
All the drivers either use the control framework or provide a
vidioc_query_ext_ctrl. We can remove this callback to reduce the
temptation of new drivers to implement it.
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/media/v4l2-core/v4l2-dev.c | 3 +--
drivers/media/v4l2-core/v4l2-ioctl.c | 2 --
include/media/v4l2-ioctl.h | 4 ----
3 files changed, 1 insertion(+), 8 deletions(-)
diff --git a/drivers/media/v4l2-core/v4l2-dev.c b/drivers/media/v4l2-core/v4l2-dev.c
index 252308a67fa8..5267a0686400 100644
--- a/drivers/media/v4l2-core/v4l2-dev.c
+++ b/drivers/media/v4l2-core/v4l2-dev.c
@@ -572,8 +572,7 @@ static void determine_valid_ioctls(struct video_device *vdev)
and that can't be tested here. If the bit for these control ioctls
is set, then the ioctl is valid. But if it is 0, then it can still
be valid if the filehandle passed the control handler. */
- if (vdev->ctrl_handler || ops->vidioc_queryctrl ||
- ops->vidioc_query_ext_ctrl)
+ if (vdev->ctrl_handler || ops->vidioc_query_ext_ctrl)
__set_bit(_IOC_NR(VIDIOC_QUERYCTRL), valid_ioctls);
if (vdev->ctrl_handler || ops->vidioc_query_ext_ctrl)
__set_bit(_IOC_NR(VIDIOC_QUERY_EXT_CTRL), valid_ioctls);
diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
index deed2b44ee18..48ddeb01e70a 100644
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
@@ -2294,8 +2294,6 @@ static int v4l_queryctrl(const struct v4l2_ioctl_ops *ops,
return v4l2_queryctrl(vfh->ctrl_handler, p);
if (vfd->ctrl_handler)
return v4l2_queryctrl(vfd->ctrl_handler, p);
- if (ops->vidioc_queryctrl)
- return ops->vidioc_queryctrl(file, fh, p);
if (!ops->vidioc_query_ext_ctrl)
return -ENOTTY;
diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h
index bdbb7e542321..013996c33a9e 100644
--- a/include/media/v4l2-ioctl.h
+++ b/include/media/v4l2-ioctl.h
@@ -193,8 +193,6 @@ struct v4l2_fh;
* :ref:`VIDIOC_G_OUTPUT <vidioc_g_output>` ioctl
* @vidioc_s_output: pointer to the function that implements
* :ref:`VIDIOC_S_OUTPUT <vidioc_g_output>` ioctl
- * @vidioc_queryctrl: pointer to the function that implements
- * :ref:`VIDIOC_QUERYCTRL <vidioc_queryctrl>` ioctl
* @vidioc_query_ext_ctrl: pointer to the function that implements
* :ref:`VIDIOC_QUERY_EXT_CTRL <vidioc_queryctrl>` ioctl
* @vidioc_g_ctrl: pointer to the function that implements
@@ -461,8 +459,6 @@ struct v4l2_ioctl_ops {
int (*vidioc_s_output)(struct file *file, void *fh, unsigned int i);
/* Control handling */
- int (*vidioc_queryctrl)(struct file *file, void *fh,
- struct v4l2_queryctrl *a);
int (*vidioc_query_ext_ctrl)(struct file *file, void *fh,
struct v4l2_query_ext_ctrl *a);
int (*vidioc_g_ctrl)(struct file *file, void *fh,
--
2.48.1.601.g30ceb7b040-goog
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v3 08/12] media: v4l2: Remove vidioc_g_ctrl callback
2025-02-23 18:58 [PATCH v3 00/12] media: Remove vidioc_g/s_ctrl and vidioc_queryctrl callbacks Ricardo Ribalda
` (6 preceding siblings ...)
2025-02-23 18:58 ` [PATCH v3 07/12] media: v4l2: Remove vidioc_queryctrl callback Ricardo Ribalda
@ 2025-02-23 18:58 ` Ricardo Ribalda
2025-02-23 18:58 ` [PATCH v3 09/12] media: cx231xx: Remove vidioc_s_ctrl callback Ricardo Ribalda
` (3 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: Ricardo Ribalda @ 2025-02-23 18:58 UTC (permalink / raw)
To: Mauro Carvalho Chehab, Mike Isely, Laurent Pinchart,
Hans de Goede, Sakari Ailus, Andy Shevchenko, Greg Kroah-Hartman,
Hans Verkuil
Cc: linux-media, linux-kernel, linux-staging, Ricardo Ribalda
All the drivers either use the control framework or provide a
vidioc_g_ext_ctrls callback. We can remove this callback.
Thanks for your service!
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/media/v4l2-core/v4l2-dev.c | 2 +-
drivers/media/v4l2-core/v4l2-ioctl.c | 2 --
include/media/v4l2-ioctl.h | 4 ----
3 files changed, 1 insertion(+), 7 deletions(-)
diff --git a/drivers/media/v4l2-core/v4l2-dev.c b/drivers/media/v4l2-core/v4l2-dev.c
index 5267a0686400..068ee67cd574 100644
--- a/drivers/media/v4l2-core/v4l2-dev.c
+++ b/drivers/media/v4l2-core/v4l2-dev.c
@@ -576,7 +576,7 @@ static void determine_valid_ioctls(struct video_device *vdev)
__set_bit(_IOC_NR(VIDIOC_QUERYCTRL), valid_ioctls);
if (vdev->ctrl_handler || ops->vidioc_query_ext_ctrl)
__set_bit(_IOC_NR(VIDIOC_QUERY_EXT_CTRL), valid_ioctls);
- if (vdev->ctrl_handler || ops->vidioc_g_ctrl || ops->vidioc_g_ext_ctrls)
+ if (vdev->ctrl_handler || ops->vidioc_g_ext_ctrls)
__set_bit(_IOC_NR(VIDIOC_G_CTRL), valid_ioctls);
if (vdev->ctrl_handler || ops->vidioc_s_ctrl || ops->vidioc_s_ext_ctrls)
__set_bit(_IOC_NR(VIDIOC_S_CTRL), valid_ioctls);
diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
index 48ddeb01e70a..d6af0ab0d7ea 100644
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
@@ -2378,8 +2378,6 @@ static int v4l_g_ctrl(const struct v4l2_ioctl_ops *ops,
return v4l2_g_ctrl(vfh->ctrl_handler, p);
if (vfd->ctrl_handler)
return v4l2_g_ctrl(vfd->ctrl_handler, p);
- if (ops->vidioc_g_ctrl)
- return ops->vidioc_g_ctrl(file, fh, p);
if (ops->vidioc_g_ext_ctrls == NULL)
return -ENOTTY;
diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h
index 013996c33a9e..4d69128023f8 100644
--- a/include/media/v4l2-ioctl.h
+++ b/include/media/v4l2-ioctl.h
@@ -195,8 +195,6 @@ struct v4l2_fh;
* :ref:`VIDIOC_S_OUTPUT <vidioc_g_output>` ioctl
* @vidioc_query_ext_ctrl: pointer to the function that implements
* :ref:`VIDIOC_QUERY_EXT_CTRL <vidioc_queryctrl>` ioctl
- * @vidioc_g_ctrl: pointer to the function that implements
- * :ref:`VIDIOC_G_CTRL <vidioc_g_ctrl>` ioctl
* @vidioc_s_ctrl: pointer to the function that implements
* :ref:`VIDIOC_S_CTRL <vidioc_g_ctrl>` ioctl
* @vidioc_g_ext_ctrls: pointer to the function that implements
@@ -461,8 +459,6 @@ struct v4l2_ioctl_ops {
/* Control handling */
int (*vidioc_query_ext_ctrl)(struct file *file, void *fh,
struct v4l2_query_ext_ctrl *a);
- int (*vidioc_g_ctrl)(struct file *file, void *fh,
- struct v4l2_control *a);
int (*vidioc_s_ctrl)(struct file *file, void *fh,
struct v4l2_control *a);
int (*vidioc_g_ext_ctrls)(struct file *file, void *fh,
--
2.48.1.601.g30ceb7b040-goog
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v3 09/12] media: cx231xx: Remove vidioc_s_ctrl callback
2025-02-23 18:58 [PATCH v3 00/12] media: Remove vidioc_g/s_ctrl and vidioc_queryctrl callbacks Ricardo Ribalda
` (7 preceding siblings ...)
2025-02-23 18:58 ` [PATCH v3 08/12] media: v4l2: Remove vidioc_g_ctrl callback Ricardo Ribalda
@ 2025-02-23 18:58 ` Ricardo Ribalda
2025-02-25 8:19 ` Hans Verkuil
2025-02-23 18:58 ` [PATCH v3 10/12] media: v4l2: " Ricardo Ribalda
` (2 subsequent siblings)
11 siblings, 1 reply; 14+ messages in thread
From: Ricardo Ribalda @ 2025-02-23 18:58 UTC (permalink / raw)
To: Mauro Carvalho Chehab, Mike Isely, Laurent Pinchart,
Hans de Goede, Sakari Ailus, Andy Shevchenko, Greg Kroah-Hartman,
Hans Verkuil
Cc: linux-media, linux-kernel, linux-staging, Ricardo Ribalda
The driver has been converted to the control framework in the past:
commit 88b6ffedd901 ("[media] cx231xx-417: convert to the control
framework").
This function is never called, the core will only use the control
framework instead.
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/media/usb/cx231xx/cx231xx-417.c | 15 ---------------
1 file changed, 15 deletions(-)
diff --git a/drivers/media/usb/cx231xx/cx231xx-417.c b/drivers/media/usb/cx231xx/cx231xx-417.c
index a4a9781328c5..5a4b0f96cca2 100644
--- a/drivers/media/usb/cx231xx/cx231xx-417.c
+++ b/drivers/media/usb/cx231xx/cx231xx-417.c
@@ -1538,20 +1538,6 @@ static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id id)
return 0;
}
-static int vidioc_s_ctrl(struct file *file, void *priv,
- struct v4l2_control *ctl)
-{
- struct cx231xx *dev = video_drvdata(file);
- struct v4l2_subdev *sd;
-
- dprintk(3, "enter vidioc_s_ctrl()\n");
- /* Update the A/V core */
- v4l2_device_for_each_subdev(sd, &dev->v4l2_dev)
- v4l2_s_ctrl(NULL, sd->ctrl_handler, ctl);
- dprintk(3, "exit vidioc_s_ctrl()\n");
- return 0;
-}
-
static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv,
struct v4l2_fmtdesc *f)
{
@@ -1627,7 +1613,6 @@ static const struct v4l2_ioctl_ops mpeg_ioctl_ops = {
.vidioc_enum_input = cx231xx_enum_input,
.vidioc_g_input = cx231xx_g_input,
.vidioc_s_input = cx231xx_s_input,
- .vidioc_s_ctrl = vidioc_s_ctrl,
.vidioc_g_pixelaspect = vidioc_g_pixelaspect,
.vidioc_g_selection = vidioc_g_selection,
.vidioc_querycap = cx231xx_querycap,
--
2.48.1.601.g30ceb7b040-goog
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v3 10/12] media: v4l2: Remove vidioc_s_ctrl callback
2025-02-23 18:58 [PATCH v3 00/12] media: Remove vidioc_g/s_ctrl and vidioc_queryctrl callbacks Ricardo Ribalda
` (8 preceding siblings ...)
2025-02-23 18:58 ` [PATCH v3 09/12] media: cx231xx: Remove vidioc_s_ctrl callback Ricardo Ribalda
@ 2025-02-23 18:58 ` Ricardo Ribalda
2025-02-23 18:58 ` [PATCH v3 11/12] media: v4l2-core: Introduce v4l2_query_ext_ctrl_to_v4l2_queryctrl Ricardo Ribalda
2025-02-23 18:58 ` [PATCH v3 12/12] media: radio-wl1273: Rename wl1273_fm_vidioc_s_ctrl Ricardo Ribalda
11 siblings, 0 replies; 14+ messages in thread
From: Ricardo Ribalda @ 2025-02-23 18:58 UTC (permalink / raw)
To: Mauro Carvalho Chehab, Mike Isely, Laurent Pinchart,
Hans de Goede, Sakari Ailus, Andy Shevchenko, Greg Kroah-Hartman,
Hans Verkuil
Cc: linux-media, linux-kernel, linux-staging, Ricardo Ribalda
All the drivers either use the control framework or provide a
vidiod_ext_ctrl. We can remove this callback.
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/media/v4l2-core/v4l2-dev.c | 2 +-
drivers/media/v4l2-core/v4l2-ioctl.c | 2 --
include/media/v4l2-ioctl.h | 4 ----
3 files changed, 1 insertion(+), 7 deletions(-)
diff --git a/drivers/media/v4l2-core/v4l2-dev.c b/drivers/media/v4l2-core/v4l2-dev.c
index 068ee67cd574..b40c08ce909d 100644
--- a/drivers/media/v4l2-core/v4l2-dev.c
+++ b/drivers/media/v4l2-core/v4l2-dev.c
@@ -578,7 +578,7 @@ static void determine_valid_ioctls(struct video_device *vdev)
__set_bit(_IOC_NR(VIDIOC_QUERY_EXT_CTRL), valid_ioctls);
if (vdev->ctrl_handler || ops->vidioc_g_ext_ctrls)
__set_bit(_IOC_NR(VIDIOC_G_CTRL), valid_ioctls);
- if (vdev->ctrl_handler || ops->vidioc_s_ctrl || ops->vidioc_s_ext_ctrls)
+ if (vdev->ctrl_handler || ops->vidioc_s_ext_ctrls)
__set_bit(_IOC_NR(VIDIOC_S_CTRL), valid_ioctls);
if (vdev->ctrl_handler || ops->vidioc_g_ext_ctrls)
__set_bit(_IOC_NR(VIDIOC_G_EXT_CTRLS), valid_ioctls);
diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
index d6af0ab0d7ea..fea53b419351 100644
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
@@ -2411,8 +2411,6 @@ static int v4l_s_ctrl(const struct v4l2_ioctl_ops *ops,
return v4l2_s_ctrl(vfh, vfh->ctrl_handler, p);
if (vfd->ctrl_handler)
return v4l2_s_ctrl(NULL, vfd->ctrl_handler, p);
- if (ops->vidioc_s_ctrl)
- return ops->vidioc_s_ctrl(file, fh, p);
if (ops->vidioc_s_ext_ctrls == NULL)
return -ENOTTY;
diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h
index 4d69128023f8..c6ec87e88dfe 100644
--- a/include/media/v4l2-ioctl.h
+++ b/include/media/v4l2-ioctl.h
@@ -195,8 +195,6 @@ struct v4l2_fh;
* :ref:`VIDIOC_S_OUTPUT <vidioc_g_output>` ioctl
* @vidioc_query_ext_ctrl: pointer to the function that implements
* :ref:`VIDIOC_QUERY_EXT_CTRL <vidioc_queryctrl>` ioctl
- * @vidioc_s_ctrl: pointer to the function that implements
- * :ref:`VIDIOC_S_CTRL <vidioc_g_ctrl>` ioctl
* @vidioc_g_ext_ctrls: pointer to the function that implements
* :ref:`VIDIOC_G_EXT_CTRLS <vidioc_g_ext_ctrls>` ioctl
* @vidioc_s_ext_ctrls: pointer to the function that implements
@@ -459,8 +457,6 @@ struct v4l2_ioctl_ops {
/* Control handling */
int (*vidioc_query_ext_ctrl)(struct file *file, void *fh,
struct v4l2_query_ext_ctrl *a);
- int (*vidioc_s_ctrl)(struct file *file, void *fh,
- struct v4l2_control *a);
int (*vidioc_g_ext_ctrls)(struct file *file, void *fh,
struct v4l2_ext_controls *a);
int (*vidioc_s_ext_ctrls)(struct file *file, void *fh,
--
2.48.1.601.g30ceb7b040-goog
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v3 11/12] media: v4l2-core: Introduce v4l2_query_ext_ctrl_to_v4l2_queryctrl
2025-02-23 18:58 [PATCH v3 00/12] media: Remove vidioc_g/s_ctrl and vidioc_queryctrl callbacks Ricardo Ribalda
` (9 preceding siblings ...)
2025-02-23 18:58 ` [PATCH v3 10/12] media: v4l2: " Ricardo Ribalda
@ 2025-02-23 18:58 ` Ricardo Ribalda
2025-02-23 18:58 ` [PATCH v3 12/12] media: radio-wl1273: Rename wl1273_fm_vidioc_s_ctrl Ricardo Ribalda
11 siblings, 0 replies; 14+ messages in thread
From: Ricardo Ribalda @ 2025-02-23 18:58 UTC (permalink / raw)
To: Mauro Carvalho Chehab, Mike Isely, Laurent Pinchart,
Hans de Goede, Sakari Ailus, Andy Shevchenko, Greg Kroah-Hartman,
Hans Verkuil
Cc: linux-media, linux-kernel, linux-staging, Ricardo Ribalda
We use this logic in a couple of places. Refactor into a function.
No functional change expected from this patch.
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/media/v4l2-core/v4l2-ctrls-api.c | 51 +++++++++++++++++++-------------
drivers/media/v4l2-core/v4l2-ioctl.c | 28 ++----------------
include/media/v4l2-ctrls.h | 12 ++++++++
3 files changed, 44 insertions(+), 47 deletions(-)
diff --git a/drivers/media/v4l2-core/v4l2-ctrls-api.c b/drivers/media/v4l2-core/v4l2-ctrls-api.c
index 95a2202879d8..9dd2bc5893dd 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls-api.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls-api.c
@@ -1123,39 +1123,48 @@ int v4l2_query_ext_ctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_query_ext_ctr
}
EXPORT_SYMBOL(v4l2_query_ext_ctrl);
-/* Implement VIDIOC_QUERYCTRL */
-int v4l2_queryctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_queryctrl *qc)
+void v4l2_query_ext_ctrl_to_v4l2_queryctrl(struct v4l2_queryctrl *to,
+ const struct v4l2_query_ext_ctrl *from)
{
- struct v4l2_query_ext_ctrl qec = { qc->id };
- int rc;
+ to->id = from->id;
+ to->type = from->type;
+ to->flags = from->flags;
+ strscpy(to->name, from->name, sizeof(to->name));
- rc = v4l2_query_ext_ctrl(hdl, &qec);
- if (rc)
- return rc;
-
- qc->id = qec.id;
- qc->type = qec.type;
- qc->flags = qec.flags;
- strscpy(qc->name, qec.name, sizeof(qc->name));
- switch (qc->type) {
+ switch (from->type) {
case V4L2_CTRL_TYPE_INTEGER:
case V4L2_CTRL_TYPE_BOOLEAN:
case V4L2_CTRL_TYPE_MENU:
case V4L2_CTRL_TYPE_INTEGER_MENU:
case V4L2_CTRL_TYPE_STRING:
case V4L2_CTRL_TYPE_BITMASK:
- qc->minimum = qec.minimum;
- qc->maximum = qec.maximum;
- qc->step = qec.step;
- qc->default_value = qec.default_value;
+ to->minimum = from->minimum;
+ to->maximum = from->maximum;
+ to->step = from->step;
+ to->default_value = from->default_value;
break;
default:
- qc->minimum = 0;
- qc->maximum = 0;
- qc->step = 0;
- qc->default_value = 0;
+ to->minimum = 0;
+ to->maximum = 0;
+ to->step = 0;
+ to->default_value = 0;
break;
}
+}
+EXPORT_SYMBOL(v4l2_query_ext_ctrl_to_v4l2_queryctrl);
+
+/* Implement VIDIOC_QUERYCTRL */
+int v4l2_queryctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_queryctrl *qc)
+{
+ struct v4l2_query_ext_ctrl qec = { qc->id };
+ int rc;
+
+ rc = v4l2_query_ext_ctrl(hdl, &qec);
+ if (rc)
+ return rc;
+
+ v4l2_query_ext_ctrl_to_v4l2_queryctrl(qc, &qec);
+
return 0;
}
EXPORT_SYMBOL(v4l2_queryctrl);
diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
index fea53b419351..4e15ef4840b0 100644
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
@@ -2302,32 +2302,8 @@ static int v4l_queryctrl(const struct v4l2_ioctl_ops *ops,
ret = ops->vidioc_query_ext_ctrl(file, fh, &qec);
if (ret)
return ret;
-
- p->id = qec.id;
- p->type = qec.type;
- p->flags = qec.flags;
- strscpy(p->name, qec.name, sizeof(p->name));
- switch (p->type) {
- case V4L2_CTRL_TYPE_INTEGER:
- case V4L2_CTRL_TYPE_BOOLEAN:
- case V4L2_CTRL_TYPE_MENU:
- case V4L2_CTRL_TYPE_INTEGER_MENU:
- case V4L2_CTRL_TYPE_STRING:
- case V4L2_CTRL_TYPE_BITMASK:
- p->minimum = qec.minimum;
- p->maximum = qec.maximum;
- p->step = qec.step;
- p->default_value = qec.default_value;
- break;
- default:
- p->minimum = 0;
- p->maximum = 0;
- p->step = 0;
- p->default_value = 0;
- break;
- }
-
- return 0;
+ v4l2_query_ext_ctrl_to_v4l2_queryctrl(p, &qec);
+ return ret;
}
static int v4l_query_ext_ctrl(const struct v4l2_ioctl_ops *ops,
diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h
index 59679a42b3e7..83b84cb5cf06 100644
--- a/include/media/v4l2-ctrls.h
+++ b/include/media/v4l2-ctrls.h
@@ -1404,6 +1404,18 @@ v4l2_ctrl_request_hdl_ctrl_find(struct v4l2_ctrl_handler *hdl, u32 id);
*/
int v4l2_queryctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_queryctrl *qc);
+/**
+ * v4l2_query_ext_ctrl_to_v4l2_queryctrl - Convert a qec to qe.
+ *
+ * @to: The v4l2_queryctrl to write to.
+ * @from: The v4l2_query_ext_ctrl to read from.
+ *
+ * This function is a helper to convert a v4l2_query_ext_ctrl into a
+ * v4l2_queryctrl.
+ */
+void v4l2_query_ext_ctrl_to_v4l2_queryctrl(struct v4l2_queryctrl *to,
+ const struct v4l2_query_ext_ctrl *from);
+
/**
* v4l2_query_ext_ctrl - Helper function to implement
* :ref:`VIDIOC_QUERY_EXT_CTRL <vidioc_queryctrl>` ioctl
--
2.48.1.601.g30ceb7b040-goog
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v3 12/12] media: radio-wl1273: Rename wl1273_fm_vidioc_s_ctrl
2025-02-23 18:58 [PATCH v3 00/12] media: Remove vidioc_g/s_ctrl and vidioc_queryctrl callbacks Ricardo Ribalda
` (10 preceding siblings ...)
2025-02-23 18:58 ` [PATCH v3 11/12] media: v4l2-core: Introduce v4l2_query_ext_ctrl_to_v4l2_queryctrl Ricardo Ribalda
@ 2025-02-23 18:58 ` Ricardo Ribalda
11 siblings, 0 replies; 14+ messages in thread
From: Ricardo Ribalda @ 2025-02-23 18:58 UTC (permalink / raw)
To: Mauro Carvalho Chehab, Mike Isely, Laurent Pinchart,
Hans de Goede, Sakari Ailus, Andy Shevchenko, Greg Kroah-Hartman,
Hans Verkuil
Cc: linux-media, linux-kernel, linux-staging, Ricardo Ribalda
Now that vidioc_s_ctrl is gone we want to remove that string from all
the codebase.
Besides, it isn't the correct name of this function anyway. It's clearly a
left-over from the past.
Suggested-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/media/radio/radio-wl1273.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/media/radio/radio-wl1273.c b/drivers/media/radio/radio-wl1273.c
index 511a8ede05ec..f55217ccf2b8 100644
--- a/drivers/media/radio/radio-wl1273.c
+++ b/drivers/media/radio/radio-wl1273.c
@@ -1407,7 +1407,7 @@ static inline struct wl1273_device *to_radio(struct v4l2_ctrl *ctrl)
return container_of(ctrl->handler, struct wl1273_device, ctrl_handler);
}
-static int wl1273_fm_vidioc_s_ctrl(struct v4l2_ctrl *ctrl)
+static int wl1273_fm_s_ctrl(struct v4l2_ctrl *ctrl)
{
struct wl1273_device *radio = to_radio(ctrl);
struct wl1273_core *core = radio->core;
@@ -1945,7 +1945,7 @@ static void wl1273_vdev_release(struct video_device *dev)
}
static const struct v4l2_ctrl_ops wl1273_ctrl_ops = {
- .s_ctrl = wl1273_fm_vidioc_s_ctrl,
+ .s_ctrl = wl1273_fm_s_ctrl,
.g_volatile_ctrl = wl1273_fm_g_volatile_ctrl,
};
--
2.48.1.601.g30ceb7b040-goog
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH v3 09/12] media: cx231xx: Remove vidioc_s_ctrl callback
2025-02-23 18:58 ` [PATCH v3 09/12] media: cx231xx: Remove vidioc_s_ctrl callback Ricardo Ribalda
@ 2025-02-25 8:19 ` Hans Verkuil
0 siblings, 0 replies; 14+ messages in thread
From: Hans Verkuil @ 2025-02-25 8:19 UTC (permalink / raw)
To: Ricardo Ribalda, Mauro Carvalho Chehab, Mike Isely,
Laurent Pinchart, Hans de Goede, Sakari Ailus, Andy Shevchenko,
Greg Kroah-Hartman
Cc: linux-media, linux-kernel, linux-staging
On 23/02/2025 19:58, Ricardo Ribalda wrote:
> The driver has been converted to the control framework in the past:
> commit 88b6ffedd901 ("[media] cx231xx-417: convert to the control
> framework").
>
> This function is never called, the core will only use the control
> framework instead.
>
> Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Tested-by: Hans Verkuil <hverkuil@xs4all.nl>
Regards,
Hans
> ---
> drivers/media/usb/cx231xx/cx231xx-417.c | 15 ---------------
> 1 file changed, 15 deletions(-)
>
> diff --git a/drivers/media/usb/cx231xx/cx231xx-417.c b/drivers/media/usb/cx231xx/cx231xx-417.c
> index a4a9781328c5..5a4b0f96cca2 100644
> --- a/drivers/media/usb/cx231xx/cx231xx-417.c
> +++ b/drivers/media/usb/cx231xx/cx231xx-417.c
> @@ -1538,20 +1538,6 @@ static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id id)
> return 0;
> }
>
> -static int vidioc_s_ctrl(struct file *file, void *priv,
> - struct v4l2_control *ctl)
> -{
> - struct cx231xx *dev = video_drvdata(file);
> - struct v4l2_subdev *sd;
> -
> - dprintk(3, "enter vidioc_s_ctrl()\n");
> - /* Update the A/V core */
> - v4l2_device_for_each_subdev(sd, &dev->v4l2_dev)
> - v4l2_s_ctrl(NULL, sd->ctrl_handler, ctl);
> - dprintk(3, "exit vidioc_s_ctrl()\n");
> - return 0;
> -}
> -
> static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv,
> struct v4l2_fmtdesc *f)
> {
> @@ -1627,7 +1613,6 @@ static const struct v4l2_ioctl_ops mpeg_ioctl_ops = {
> .vidioc_enum_input = cx231xx_enum_input,
> .vidioc_g_input = cx231xx_g_input,
> .vidioc_s_input = cx231xx_s_input,
> - .vidioc_s_ctrl = vidioc_s_ctrl,
> .vidioc_g_pixelaspect = vidioc_g_pixelaspect,
> .vidioc_g_selection = vidioc_g_selection,
> .vidioc_querycap = cx231xx_querycap,
>
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2025-02-25 8:19 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-23 18:58 [PATCH v3 00/12] media: Remove vidioc_g/s_ctrl and vidioc_queryctrl callbacks Ricardo Ribalda
2025-02-23 18:58 ` [PATCH v3 01/12] media: ioctl: Simulate v4l2_queryctrl with v4l2_query_ext_ctrl Ricardo Ribalda
2025-02-23 18:58 ` [PATCH v3 02/12] media: pvrusb2: Convert queryctrl to query_ext_ctrl Ricardo Ribalda
2025-02-23 18:58 ` [PATCH v3 03/12] media: pvrusb2: Remove g/s_ctrl callbacks Ricardo Ribalda
2025-02-23 18:58 ` [PATCH v3 04/12] media: uvcvideo: Remove vidioc_queryctrl Ricardo Ribalda
2025-02-23 18:58 ` [PATCH v3 05/12] media: atomisp: Replace queryctrl with query_ext_ctrl Ricardo Ribalda
2025-02-23 18:58 ` [PATCH v3 06/12] media: atomisp: Remove vidioc_g/s callback Ricardo Ribalda
2025-02-23 18:58 ` [PATCH v3 07/12] media: v4l2: Remove vidioc_queryctrl callback Ricardo Ribalda
2025-02-23 18:58 ` [PATCH v3 08/12] media: v4l2: Remove vidioc_g_ctrl callback Ricardo Ribalda
2025-02-23 18:58 ` [PATCH v3 09/12] media: cx231xx: Remove vidioc_s_ctrl callback Ricardo Ribalda
2025-02-25 8:19 ` Hans Verkuil
2025-02-23 18:58 ` [PATCH v3 10/12] media: v4l2: " Ricardo Ribalda
2025-02-23 18:58 ` [PATCH v3 11/12] media: v4l2-core: Introduce v4l2_query_ext_ctrl_to_v4l2_queryctrl Ricardo Ribalda
2025-02-23 18:58 ` [PATCH v3 12/12] media: radio-wl1273: Rename wl1273_fm_vidioc_s_ctrl Ricardo Ribalda
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox