aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2012-06-09 08:27:10 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-07-06 16:18:52 -0400
commitd0547cba60775d9deaddbc1e0646a4b71833015d (patch)
treebf2fdfa1670e863b869a4821ed61b538995febc2 /drivers
parent59076122cbd325a9ee6ab062ebbbc4604768f97f (diff)
[media] v4l2-ioctl.c: use the new table for priority ioctls
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/video/v4l2-ioctl.c60
1 files changed, 29 insertions, 31 deletions
diff --git a/drivers/media/video/v4l2-ioctl.c b/drivers/media/video/v4l2-ioctl.c
index 7556678846f9..4029d12f984d 100644
--- a/drivers/media/video/v4l2-ioctl.c
+++ b/drivers/media/video/v4l2-ioctl.c
@@ -470,6 +470,33 @@ static int v4l_s_output(const struct v4l2_ioctl_ops *ops,
470 return ops->vidioc_s_output(file, fh, *(unsigned int *)arg); 470 return ops->vidioc_s_output(file, fh, *(unsigned int *)arg);
471} 471}
472 472
473static int v4l_g_priority(const struct v4l2_ioctl_ops *ops,
474 struct file *file, void *fh, void *arg)
475{
476 struct video_device *vfd;
477 u32 *p = arg;
478
479 if (ops->vidioc_g_priority)
480 return ops->vidioc_g_priority(file, fh, arg);
481 vfd = video_devdata(file);
482 *p = v4l2_prio_max(&vfd->v4l2_dev->prio);
483 return 0;
484}
485
486static int v4l_s_priority(const struct v4l2_ioctl_ops *ops,
487 struct file *file, void *fh, void *arg)
488{
489 struct video_device *vfd;
490 struct v4l2_fh *vfh;
491 u32 *p = arg;
492
493 if (ops->vidioc_s_priority)
494 return ops->vidioc_s_priority(file, fh, *p);
495 vfd = video_devdata(file);
496 vfh = file->private_data;
497 return v4l2_prio_change(&vfd->v4l2_dev->prio, &vfh->prio, *p);
498}
499
473static int v4l_enuminput(const struct v4l2_ioctl_ops *ops, 500static int v4l_enuminput(const struct v4l2_ioctl_ops *ops,
474 struct file *file, void *fh, void *arg) 501 struct file *file, void *fh, void *arg)
475{ 502{
@@ -612,8 +639,8 @@ static struct v4l2_ioctl_info v4l2_ioctls[] = {
612 IOCTL_INFO(VIDIOC_TRY_FMT, 0), 639 IOCTL_INFO(VIDIOC_TRY_FMT, 0),
613 IOCTL_INFO_STD(VIDIOC_ENUMAUDIO, vidioc_enumaudio, v4l_print_audio, INFO_FL_CLEAR(v4l2_audio, index)), 640 IOCTL_INFO_STD(VIDIOC_ENUMAUDIO, vidioc_enumaudio, v4l_print_audio, INFO_FL_CLEAR(v4l2_audio, index)),
614 IOCTL_INFO_STD(VIDIOC_ENUMAUDOUT, vidioc_enumaudout, v4l_print_audioout, INFO_FL_CLEAR(v4l2_audioout, index)), 641 IOCTL_INFO_STD(VIDIOC_ENUMAUDOUT, vidioc_enumaudout, v4l_print_audioout, INFO_FL_CLEAR(v4l2_audioout, index)),
615 IOCTL_INFO(VIDIOC_G_PRIORITY, 0), 642 IOCTL_INFO_FNC(VIDIOC_G_PRIORITY, v4l_g_priority, v4l_print_u32, 0),
616 IOCTL_INFO(VIDIOC_S_PRIORITY, INFO_FL_PRIO), 643 IOCTL_INFO_FNC(VIDIOC_S_PRIORITY, v4l_s_priority, v4l_print_u32, INFO_FL_PRIO),
617 IOCTL_INFO(VIDIOC_G_SLICED_VBI_CAP, INFO_FL_CLEAR(v4l2_sliced_vbi_cap, type)), 644 IOCTL_INFO(VIDIOC_G_SLICED_VBI_CAP, INFO_FL_CLEAR(v4l2_sliced_vbi_cap, type)),
618 IOCTL_INFO(VIDIOC_LOG_STATUS, 0), 645 IOCTL_INFO(VIDIOC_LOG_STATUS, 0),
619 IOCTL_INFO(VIDIOC_G_EXT_CTRLS, INFO_FL_CTRL), 646 IOCTL_INFO(VIDIOC_G_EXT_CTRLS, INFO_FL_CTRL),
@@ -750,35 +777,6 @@ static long __video_do_ioctl(struct file *file,
750 } 777 }
751 778
752 switch (cmd) { 779 switch (cmd) {
753
754 /* --- priority ------------------------------------------ */
755 case VIDIOC_G_PRIORITY:
756 {
757 enum v4l2_priority *p = arg;
758
759 if (ops->vidioc_g_priority) {
760 ret = ops->vidioc_g_priority(file, fh, p);
761 } else if (use_fh_prio) {
762 *p = v4l2_prio_max(&vfd->v4l2_dev->prio);
763 ret = 0;
764 }
765 if (!ret)
766 dbgarg(cmd, "priority is %d\n", *p);
767 break;
768 }
769 case VIDIOC_S_PRIORITY:
770 {
771 enum v4l2_priority *p = arg;
772
773 dbgarg(cmd, "setting priority to %d\n", *p);
774 if (ops->vidioc_s_priority)
775 ret = ops->vidioc_s_priority(file, fh, *p);
776 else
777 ret = v4l2_prio_change(&vfd->v4l2_dev->prio,
778 &vfh->prio, *p);
779 break;
780 }
781
782 /* --- capture ioctls ---------------------------------------- */ 780 /* --- capture ioctls ---------------------------------------- */
783 case VIDIOC_ENUM_FMT: 781 case VIDIOC_ENUM_FMT:
784 { 782 {