[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20251119-uvcdynctrl-v2-6-0359ffb98c9e@chromium.org>
Date: Wed, 19 Nov 2025 19:37:15 +0000
From: Ricardo Ribalda <ribalda@...omium.org>
To: Laurent Pinchart <laurent.pinchart@...asonboard.com>,
Hans de Goede <hansg@...nel.org>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: linux-media@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-usb@...r.kernel.org, Ricardo Ribalda <ribalda@...omium.org>
Subject: [PATCH v2 6/6] media: uvcvideo: RFC: Convert
allow_privacy_override into Kconfig
This patch is just shared for discussion purposes! Do not land.
In a perfect world, after a deprecation process, we will be able to
remove allow_privacy_override and block all privacy related controls.
If there is any usecase out in the field that resists, we shall move it
into a Kconfig.
This patch shows how the transition to Kconfig can look.
Signed-off-by: Ricardo Ribalda <ribalda@...omium.org>
---
drivers/media/usb/uvc/Kconfig | 11 +++++++++++
drivers/media/usb/uvc/uvc_ctrl.c | 4 ++--
drivers/media/usb/uvc/uvc_driver.c | 20 --------------------
drivers/media/usb/uvc/uvc_v4l2.c | 4 ++--
drivers/media/usb/uvc/uvcvideo.h | 1 -
5 files changed, 15 insertions(+), 25 deletions(-)
diff --git a/drivers/media/usb/uvc/Kconfig b/drivers/media/usb/uvc/Kconfig
index 579532272fd6d7a8ef65c1a3a892b723f40e584e..7c0f2260d1357cc4f27fa63d90c42f61afd92da9 100644
--- a/drivers/media/usb/uvc/Kconfig
+++ b/drivers/media/usb/uvc/Kconfig
@@ -20,3 +20,14 @@ config USB_VIDEO_CLASS_INPUT_EVDEV
to report button events.
If you are in doubt, say Y.
+
+config USB_VIDEO_CLASS_ALLOW_PRIVACY_OVERRIDE
+ bool "Allow overriding the privacy controls"
+ default n
+ depends on USB_VIDEO_CLASS && BROKEN
+ help
+ If this option is enabled, the privacy related controls, such as
+ the ones controlling the privacy LED will be accessible from
+ userspace.
+
+ If you are in doubt, say N.
diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_ctrl.c
index d9cbb942f798dc7138608982a5d3e3ef9f8141f6..c41724a342e57f64f3c10af9752bd45209f80e36 100644
--- a/drivers/media/usb/uvc/uvc_ctrl.c
+++ b/drivers/media/usb/uvc/uvc_ctrl.c
@@ -3025,9 +3025,9 @@ int uvc_xu_ctrl_query(struct uvc_video_chain *chain,
}
if (uvc_ctrl_is_privacy_control(entity->guid, xqry->selector) &&
- !uvc_allow_privacy_override_param) {
+ !IS_ENABLED(CONFIG_USB_VIDEO_CLASS_ALLOW_PRIVACY_OVERRIDE)) {
dev_warn_once(&chain->dev->intf->dev,
- "Privacy related controls can only be accessed if param allow_privacy_override is true\n");
+ "Privacy related controls can only be accessed if CONFIG_USB_VIDEO_CLASS_ALLOW_PRIVACY_OVERRIDE is true\n");
uvc_dbg(chain->dev, CONTROL, "Blocking access to privacy related Control %pUl/%u\n",
entity->guid, xqry->selector);
return -EACCES;
diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
index c292bf8b6f57e9fdacee726285f5b46e638fd317..71563d8f4bcf581694ccd4b665ff52b629caa0b6 100644
--- a/drivers/media/usb/uvc/uvc_driver.c
+++ b/drivers/media/usb/uvc/uvc_driver.c
@@ -35,7 +35,6 @@ unsigned int uvc_hw_timestamps_param;
static unsigned int uvc_quirks_param = -1;
unsigned int uvc_dbg_param;
unsigned int uvc_timeout_param = UVC_CTRL_STREAMING_TIMEOUT;
-bool uvc_allow_privacy_override_param;
static struct usb_driver uvc_driver;
@@ -2475,25 +2474,6 @@ MODULE_PARM_DESC(trace, "Trace level bitmask");
module_param_named(timeout, uvc_timeout_param, uint, 0644);
MODULE_PARM_DESC(timeout, "Streaming control requests timeout");
-static int param_set_privacy(const char *val, const struct kernel_param *kp)
-{
- pr_warn_once("uvcvideo: " DEPRECATED
- "allow_privacy_override parameter will be eventually removed.\n");
- return param_set_bool(val, kp);
-}
-
-static const struct kernel_param_ops param_ops_privacy = {
- .set = param_set_privacy,
- .get = param_get_bool,
-};
-
-param_check_bool(allow_privacy_override, &uvc_allow_privacy_override_param);
-module_param_cb(allow_privacy_override, ¶m_ops_privacy,
- &uvc_allow_privacy_override_param, 0644);
-__MODULE_PARM_TYPE(allow_privacy_override, "bool");
-MODULE_PARM_DESC(allow_privacy_override,
- "Allow access to privacy related controls");
-
/* ------------------------------------------------------------------------
* Driver initialization and cleanup
*/
diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c
index 510cf47c86a62ba7fe3c7fa51be82c996cf37f9f..d52497d68b910553f385b1b41ec5c4eecb915743 100644
--- a/drivers/media/usb/uvc/uvc_v4l2.c
+++ b/drivers/media/usb/uvc/uvc_v4l2.c
@@ -134,9 +134,9 @@ static int uvc_ioctl_xu_ctrl_map(struct uvc_video_chain *chain,
}
if (uvc_ctrl_is_privacy_control(xmap->entity, xmap->selector) &&
- !uvc_allow_privacy_override_param) {
+ !IS_ENABLED(CONFIG_USB_VIDEO_CLASS_ALLOW_PRIVACY_OVERRIDE)) {
dev_warn_once(&chain->dev->intf->dev,
- "Privacy related controls can only be mapped if param allow_privacy_override is true\n");
+ "Privacy related controls can only be mapped if CONFIG_USB_VIDEO_CLASS_ALLOW_PRIVACY_OVERRIDE is true\n");
return -EACCES;
}
diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvideo.h
index 4b1a70e3100bbf2180411a865a89952a81d0f0a4..5da219e1c6ac89e89a1658f1126bfa292876d55f 100644
--- a/drivers/media/usb/uvc/uvcvideo.h
+++ b/drivers/media/usb/uvc/uvcvideo.h
@@ -662,7 +662,6 @@ extern unsigned int uvc_clock_param;
extern unsigned int uvc_dbg_param;
extern unsigned int uvc_timeout_param;
extern unsigned int uvc_hw_timestamps_param;
-extern bool uvc_allow_privacy_override_param;
#define uvc_dbg(_dev, flag, fmt, ...) \
do { \
--
2.52.0.rc1.455.g30608eb744-goog
Powered by blists - more mailing lists