diff options
Diffstat (limited to 'drivers/media/video/pwc/pwc-v4l.c')
-rw-r--r-- | drivers/media/video/pwc/pwc-v4l.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/drivers/media/video/pwc/pwc-v4l.c b/drivers/media/video/pwc/pwc-v4l.c index aa87e462a958..f85c51249c7b 100644 --- a/drivers/media/video/pwc/pwc-v4l.c +++ b/drivers/media/video/pwc/pwc-v4l.c | |||
@@ -379,8 +379,27 @@ static int pwc_s_input(struct file *file, void *fh, unsigned int i) | |||
379 | 379 | ||
380 | static int pwc_queryctrl(struct file *file, void *fh, struct v4l2_queryctrl *c) | 380 | static int pwc_queryctrl(struct file *file, void *fh, struct v4l2_queryctrl *c) |
381 | { | 381 | { |
382 | int i; | 382 | int i, idx; |
383 | 383 | u32 id; | |
384 | |||
385 | id = c->id; | ||
386 | if (id & V4L2_CTRL_FLAG_NEXT_CTRL) { | ||
387 | id &= V4L2_CTRL_ID_MASK; | ||
388 | id++; | ||
389 | idx = -1; | ||
390 | for (i = 0; i < ARRAY_SIZE(pwc_controls); i++) { | ||
391 | if (pwc_controls[i].id < id) | ||
392 | continue; | ||
393 | if (idx >= 0 | ||
394 | && pwc_controls[i].id > pwc_controls[idx].id) | ||
395 | continue; | ||
396 | idx = i; | ||
397 | } | ||
398 | if (idx < 0) | ||
399 | return -EINVAL; | ||
400 | memcpy(c, &pwc_controls[idx], sizeof pwc_controls[0]); | ||
401 | return 0; | ||
402 | } | ||
384 | for (i = 0; i < sizeof(pwc_controls) / sizeof(struct v4l2_queryctrl); i++) { | 403 | for (i = 0; i < sizeof(pwc_controls) / sizeof(struct v4l2_queryctrl); i++) { |
385 | if (pwc_controls[i].id == c->id) { | 404 | if (pwc_controls[i].id == c->id) { |
386 | PWC_DEBUG_IOCTL("ioctl(VIDIOC_QUERYCTRL) found\n"); | 405 | PWC_DEBUG_IOCTL("ioctl(VIDIOC_QUERYCTRL) found\n"); |