aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/v4l2-ioctl.c
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2010-04-06 14:56:08 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-05-19 11:57:10 -0400
commit6a717883e720f75dec252c8af2a2d6dd049af254 (patch)
tree66ac33312b2d5b3888cfbd6bedb65451ab28a89b /drivers/media/video/v4l2-ioctl.c
parentdd1ad942ac0b1bb7f72f9f3d822ec937aa07dc4d (diff)
V4L/DVB: video_ioctl2: handle the v4l1 compat bit first and move VIDIOCGMBUF into the switch
Try to make a more sensible sequence of events in __video_do_ioctl: first check for a valid ops pointer, then get the compat part done. The VIDIOCGMBUF command is now part of the big switch. 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.c44
1 files changed, 25 insertions, 19 deletions
diff --git a/drivers/media/video/v4l2-ioctl.c b/drivers/media/video/v4l2-ioctl.c
index 571f0c6e7c83..3da8d8f041d8 100644
--- a/drivers/media/video/v4l2-ioctl.c
+++ b/drivers/media/video/v4l2-ioctl.c
@@ -610,17 +610,33 @@ static long __video_do_ioctl(struct file *file,
610 void *fh = file->private_data; 610 void *fh = file->private_data;
611 long ret = -EINVAL; 611 long ret = -EINVAL;
612 612
613 if (ops == NULL) {
614 printk(KERN_WARNING "videodev: \"%s\" has no ioctl_ops.\n",
615 vfd->name);
616 return -EINVAL;
617 }
618
619#ifdef CONFIG_VIDEO_V4L1_COMPAT
620 /********************************************************
621 All other V4L1 calls are handled by v4l1_compat module.
622 Those calls will be translated into V4L2 calls, and
623 __video_do_ioctl will be called again, with one or more
624 V4L2 ioctls.
625 ********************************************************/
626 if (_IOC_TYPE(cmd) == 'v' && cmd != VIDIOCGMBUF &&
627 _IOC_NR(cmd) < BASE_VIDIOCPRIVATE) {
628 return v4l_compat_translate_ioctl(file, cmd, arg,
629 __video_do_ioctl);
630 }
631#endif
632
613 if ((vfd->debug & V4L2_DEBUG_IOCTL) && 633 if ((vfd->debug & V4L2_DEBUG_IOCTL) &&
614 !(vfd->debug & V4L2_DEBUG_IOCTL_ARG)) { 634 !(vfd->debug & V4L2_DEBUG_IOCTL_ARG)) {
615 v4l_print_ioctl(vfd->name, cmd); 635 v4l_print_ioctl(vfd->name, cmd);
616 printk(KERN_CONT "\n"); 636 printk(KERN_CONT "\n");
617 } 637 }
618 638
619 if (ops == NULL) { 639 switch (cmd) {
620 printk(KERN_WARNING "videodev: \"%s\" has no ioctl_ops.\n",
621 vfd->name);
622 return -EINVAL;
623 }
624 640
625#ifdef CONFIG_VIDEO_V4L1_COMPAT 641#ifdef CONFIG_VIDEO_V4L1_COMPAT
626 /*********************************************************** 642 /***********************************************************
@@ -630,31 +646,21 @@ static long __video_do_ioctl(struct file *file,
630 ***********************************************************/ 646 ***********************************************************/
631 647
632 /* --- streaming capture ------------------------------------- */ 648 /* --- streaming capture ------------------------------------- */
633 if (cmd == VIDIOCGMBUF) { 649 case VIDIOCGMBUF:
650 {
634 struct video_mbuf *p = arg; 651 struct video_mbuf *p = arg;
635 652
636 if (!ops->vidiocgmbuf) 653 if (!ops->vidiocgmbuf)
637 return ret; 654 break;
638 ret = ops->vidiocgmbuf(file, fh, p); 655 ret = ops->vidiocgmbuf(file, fh, p);
639 if (!ret) 656 if (!ret)
640 dbgarg(cmd, "size=%d, frames=%d, offsets=0x%08lx\n", 657 dbgarg(cmd, "size=%d, frames=%d, offsets=0x%08lx\n",
641 p->size, p->frames, 658 p->size, p->frames,
642 (unsigned long)p->offsets); 659 (unsigned long)p->offsets);
643 return ret; 660 break;
644 } 661 }
645
646 /********************************************************
647 All other V4L1 calls are handled by v4l1_compat module.
648 Those calls will be translated into V4L2 calls, and
649 __video_do_ioctl will be called again, with one or more
650 V4L2 ioctls.
651 ********************************************************/
652 if (_IOC_TYPE(cmd) == 'v' && _IOC_NR(cmd) < BASE_VIDIOCPRIVATE)
653 return v4l_compat_translate_ioctl(file, cmd, arg,
654 __video_do_ioctl);
655#endif 662#endif
656 663
657 switch (cmd) {
658 /* --- capabilities ------------------------------------------ */ 664 /* --- capabilities ------------------------------------------ */
659 case VIDIOC_QUERYCAP: 665 case VIDIOC_QUERYCAP:
660 { 666 {