aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/v4l2-ioctl.c
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2011-03-22 09:14:07 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-03-22 15:38:16 -0400
commitb1a873a37b6551a214ad37d1eee7654a9d65fd6e (patch)
tree3667a3d36c9f7c6ae73609004331f006751c44be /drivers/media/video/v4l2-ioctl.c
parent2f82441a8644287e5b647329cc30b590f6fd3714 (diff)
[media] v4l2: use new flag to enable core priority handling
Rather than guess which driver supports core priority handling, require drivers that do to explicitly set the V4L2_FL_USE_FH_PRIO flag in video_device. Updated the core prio handling accordingly and set the flag in the three drivers that do. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/v4l2-ioctl.c')
-rw-r--r--drivers/media/video/v4l2-ioctl.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/media/video/v4l2-ioctl.c b/drivers/media/video/v4l2-ioctl.c
index 3e6b6fa5771a..a01ed39e6c16 100644
--- a/drivers/media/video/v4l2-ioctl.c
+++ b/drivers/media/video/v4l2-ioctl.c
@@ -541,6 +541,7 @@ static long __video_do_ioctl(struct file *file,
541 void *fh = file->private_data; 541 void *fh = file->private_data;
542 struct v4l2_fh *vfh = NULL; 542 struct v4l2_fh *vfh = NULL;
543 struct v4l2_format f_copy; 543 struct v4l2_format f_copy;
544 int use_fh_prio = 0;
544 long ret = -EINVAL; 545 long ret = -EINVAL;
545 546
546 if (ops == NULL) { 547 if (ops == NULL) {
@@ -555,10 +556,12 @@ static long __video_do_ioctl(struct file *file,
555 printk(KERN_CONT "\n"); 556 printk(KERN_CONT "\n");
556 } 557 }
557 558
558 if (test_bit(V4L2_FL_USES_V4L2_FH, &vfd->flags)) 559 if (test_bit(V4L2_FL_USES_V4L2_FH, &vfd->flags)) {
559 vfh = file->private_data; 560 vfh = file->private_data;
561 use_fh_prio = test_bit(V4L2_FL_USE_FH_PRIO, &vfd->flags);
562 }
560 563
561 if (vfh && !ops->vidioc_s_priority) { 564 if (use_fh_prio) {
562 switch (cmd) { 565 switch (cmd) {
563 case VIDIOC_S_CTRL: 566 case VIDIOC_S_CTRL:
564 case VIDIOC_S_STD: 567 case VIDIOC_S_STD:
@@ -620,7 +623,7 @@ static long __video_do_ioctl(struct file *file,
620 623
621 if (ops->vidioc_g_priority) { 624 if (ops->vidioc_g_priority) {
622 ret = ops->vidioc_g_priority(file, fh, p); 625 ret = ops->vidioc_g_priority(file, fh, p);
623 } else if (vfh) { 626 } else if (use_fh_prio) {
624 *p = v4l2_prio_max(&vfd->v4l2_dev->prio); 627 *p = v4l2_prio_max(&vfd->v4l2_dev->prio);
625 ret = 0; 628 ret = 0;
626 } 629 }
@@ -632,7 +635,7 @@ static long __video_do_ioctl(struct file *file,
632 { 635 {
633 enum v4l2_priority *p = arg; 636 enum v4l2_priority *p = arg;
634 637
635 if (!ops->vidioc_s_priority && vfh == NULL) 638 if (!ops->vidioc_s_priority && !use_fh_prio)
636 break; 639 break;
637 dbgarg(cmd, "setting priority to %d\n", *p); 640 dbgarg(cmd, "setting priority to %d\n", *p);
638 if (ops->vidioc_s_priority) 641 if (ops->vidioc_s_priority)
@@ -2187,7 +2190,7 @@ static long __video_do_ioctl(struct file *file,
2187 2190
2188 if (!ops->vidioc_default) 2191 if (!ops->vidioc_default)
2189 break; 2192 break;
2190 if (vfh && !ops->vidioc_s_priority) 2193 if (use_fh_prio)
2191 valid_prio = v4l2_prio_check(vfd->prio, vfh->prio) >= 0; 2194 valid_prio = v4l2_prio_check(vfd->prio, vfh->prio) >= 0;
2192 ret = ops->vidioc_default(file, fh, valid_prio, cmd, arg); 2195 ret = ops->vidioc_default(file, fh, valid_prio, cmd, arg);
2193 break; 2196 break;