summaryrefslogtreecommitdiffstats
path: root/drivers/media/usb/uvc/uvc_driver.c
diff options
context:
space:
mode:
authorRicardo Ribalda <ribalda@chromium.org>2023-01-05 14:52:54 +0100
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2023-01-15 22:45:13 +0100
commit40140eda661ea4be219ef194a4f43b7b5e3bbd27 (patch)
tree88dc41a4ae57fb4f21aa6e5f1c062e3e694dfdcc /drivers/media/usb/uvc/uvc_driver.c
parentmedia: uvcvideo: Extend documentation of uvc_video_clock_decode() (diff)
downloadlinux-40140eda661ea4be219ef194a4f43b7b5e3bbd27.tar.xz
linux-40140eda661ea4be219ef194a4f43b7b5e3bbd27.zip
media: uvcvideo: Implement mask for V4L2_CTRL_TYPE_MENU
Replace the count with a mask field that lets us choose not only the max value, but also the minimum value and what values are valid in between. Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Ricardo Ribalda <ribalda@chromium.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'drivers/media/usb/uvc/uvc_driver.c')
-rw-r--r--drivers/media/usb/uvc/uvc_driver.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
index 80ccb42d8f4a..b4710e1aa0a5 100644
--- a/drivers/media/usb/uvc/uvc_driver.c
+++ b/drivers/media/usb/uvc/uvc_driver.c
@@ -7,6 +7,7 @@
*/
#include <linux/atomic.h>
+#include <linux/bits.h>
#include <linux/gpio/consumer.h>
#include <linux/kernel.h>
#include <linux/list.h>
@@ -2371,7 +2372,8 @@ static const struct uvc_control_mapping uvc_ctrl_power_line_mapping_limited = {
.v4l2_type = V4L2_CTRL_TYPE_MENU,
.data_type = UVC_CTRL_DATA_TYPE_ENUM,
.menu_info = power_line_frequency_controls_limited,
- .menu_count = ARRAY_SIZE(power_line_frequency_controls_limited),
+ .menu_mask =
+ GENMASK(ARRAY_SIZE(power_line_frequency_controls_limited) - 1, 0),
};
static const struct uvc_device_info uvc_ctrl_power_line_limited = {