aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2006-07-25 15:17:54 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2006-08-08 12:55:01 -0400
commit5bdd6cc3300be534f2a2cf826e3fb926b5695698 (patch)
tree401b0f19ff7930666d0afb3c0701c769b0d498a0 /drivers/media/video
parent487206f26364a878f5f8cec9f92796d403f1d7c9 (diff)
V4L/DVB (4371a): Fix V4L1 dependencies on compat_ioctl32
Compat32 should be able to handle V4L1 ioctls if the old API support were selected. Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video')
-rw-r--r--drivers/media/video/compat_ioctl32.c32
1 files changed, 28 insertions, 4 deletions
diff --git a/drivers/media/video/compat_ioctl32.c b/drivers/media/video/compat_ioctl32.c
index 9dddff42ec13..b69ee1194815 100644
--- a/drivers/media/video/compat_ioctl32.c
+++ b/drivers/media/video/compat_ioctl32.c
@@ -21,7 +21,7 @@
21 21
22#ifdef CONFIG_COMPAT 22#ifdef CONFIG_COMPAT
23 23
24 24#ifdef CONFIG_VIDEO_V4L1_COMPAT
25struct video_tuner32 { 25struct video_tuner32 {
26 compat_int_t tuner; 26 compat_int_t tuner;
27 char name[32]; 27 char name[32];
@@ -107,6 +107,7 @@ struct video_window32 {
107 compat_caddr_t clips; 107 compat_caddr_t clips;
108 compat_int_t clipcount; 108 compat_int_t clipcount;
109}; 109};
110#endif
110 111
111static int native_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 112static int native_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
112{ 113{
@@ -124,6 +125,7 @@ static int native_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
124} 125}
125 126
126 127
128#ifdef CONFIG_VIDEO_V4L1_COMPAT
127/* You get back everything except the clips... */ 129/* You get back everything except the clips... */
128static int put_video_window32(struct video_window *kp, struct video_window32 __user *up) 130static int put_video_window32(struct video_window *kp, struct video_window32 __user *up)
129{ 131{
@@ -138,6 +140,7 @@ static int put_video_window32(struct video_window *kp, struct video_window32 __u
138 return -EFAULT; 140 return -EFAULT;
139 return 0; 141 return 0;
140} 142}
143#endif
141 144
142struct v4l2_clip32 145struct v4l2_clip32
143{ 146{
@@ -490,6 +493,7 @@ static inline int put_v4l2_input(struct v4l2_input *kp, struct v4l2_input __user
490 return 0; 493 return 0;
491} 494}
492 495
496#ifdef CONFIG_VIDEO_V4L1_COMPAT
493struct video_code32 497struct video_code32
494{ 498{
495 char loadwhat[16]; /* name or tag of file being passed */ 499 char loadwhat[16]; /* name or tag of file being passed */
@@ -517,6 +521,8 @@ static inline int microcode32(struct video_code *kp, struct video_code32 __user
517#define VIDIOCSFREQ32 _IOW('v',15, u32) 521#define VIDIOCSFREQ32 _IOW('v',15, u32)
518#define VIDIOCSMICROCODE32 _IOW('v',27, struct video_code32) 522#define VIDIOCSMICROCODE32 _IOW('v',27, struct video_code32)
519 523
524#endif
525
520/* VIDIOC_ENUMINPUT32 is VIDIOC_ENUMINPUT minus 4 bytes of padding alignement */ 526/* VIDIOC_ENUMINPUT32 is VIDIOC_ENUMINPUT minus 4 bytes of padding alignement */
521#define VIDIOC_ENUMINPUT32 VIDIOC_ENUMINPUT - _IOC(0, 0, 0, 4) 527#define VIDIOC_ENUMINPUT32 VIDIOC_ENUMINPUT - _IOC(0, 0, 0, 4)
522#define VIDIOC_G_FMT32 _IOWR ('V', 4, struct v4l2_format32) 528#define VIDIOC_G_FMT32 _IOWR ('V', 4, struct v4l2_format32)
@@ -537,6 +543,7 @@ static inline int microcode32(struct video_code *kp, struct video_code32 __user
537#define VIDIOC_S_INPUT32 _IOWR ('V', 39, compat_int_t) 543#define VIDIOC_S_INPUT32 _IOWR ('V', 39, compat_int_t)
538#define VIDIOC_TRY_FMT32 _IOWR ('V', 64, struct v4l2_format32) 544#define VIDIOC_TRY_FMT32 _IOWR ('V', 64, struct v4l2_format32)
539 545
546#ifdef CONFIG_VIDEO_V4L1_COMPAT
540enum { 547enum {
541 MaxClips = (~0U-sizeof(struct video_window))/sizeof(struct video_clip) 548 MaxClips = (~0U-sizeof(struct video_window))/sizeof(struct video_clip)
542}; 549};
@@ -601,14 +608,17 @@ static int do_set_window(struct file *file, unsigned int cmd, unsigned long arg)
601 608
602 return native_ioctl(file, VIDIOCSWIN, (unsigned long)vw); 609 return native_ioctl(file, VIDIOCSWIN, (unsigned long)vw);
603} 610}
611#endif
604 612
605static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 613static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
606{ 614{
607 union { 615 union {
616#ifdef CONFIG_VIDEO_V4L1_COMPAT
608 struct video_tuner vt; 617 struct video_tuner vt;
609 struct video_buffer vb; 618 struct video_buffer vb;
610 struct video_window vw; 619 struct video_window vw;
611 struct video_code vc; 620 struct video_code vc;
621#endif
612 struct v4l2_format v2f; 622 struct v4l2_format v2f;
613 struct v4l2_buffer v2b; 623 struct v4l2_buffer v2b;
614 struct v4l2_framebuffer v2fb; 624 struct v4l2_framebuffer v2fb;
@@ -624,6 +634,7 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg
624 634
625 /* First, convert the command. */ 635 /* First, convert the command. */
626 switch(cmd) { 636 switch(cmd) {
637#ifdef CONFIG_VIDEO_V4L1_COMPAT
627 case VIDIOCGTUNER32: cmd = VIDIOCGTUNER; break; 638 case VIDIOCGTUNER32: cmd = VIDIOCGTUNER; break;
628 case VIDIOCSTUNER32: cmd = VIDIOCSTUNER; break; 639 case VIDIOCSTUNER32: cmd = VIDIOCSTUNER; break;
629 case VIDIOCGWIN32: cmd = VIDIOCGWIN; break; 640 case VIDIOCGWIN32: cmd = VIDIOCGWIN; break;
@@ -631,6 +642,8 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg
631 case VIDIOCSFBUF32: cmd = VIDIOCSFBUF; break; 642 case VIDIOCSFBUF32: cmd = VIDIOCSFBUF; break;
632 case VIDIOCGFREQ32: cmd = VIDIOCGFREQ; break; 643 case VIDIOCGFREQ32: cmd = VIDIOCGFREQ; break;
633 case VIDIOCSFREQ32: cmd = VIDIOCSFREQ; break; 644 case VIDIOCSFREQ32: cmd = VIDIOCSFREQ; break;
645 case VIDIOCSMICROCODE32: cmd = VIDIOCSMICROCODE; break;
646#endif
634 case VIDIOC_G_FMT32: cmd = VIDIOC_G_FMT; break; 647 case VIDIOC_G_FMT32: cmd = VIDIOC_G_FMT; break;
635 case VIDIOC_S_FMT32: cmd = VIDIOC_S_FMT; break; 648 case VIDIOC_S_FMT32: cmd = VIDIOC_S_FMT; break;
636 case VIDIOC_QUERYBUF32: cmd = VIDIOC_QUERYBUF; break; 649 case VIDIOC_QUERYBUF32: cmd = VIDIOC_QUERYBUF; break;
@@ -647,10 +660,10 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg
647 case VIDIOC_G_INPUT32: cmd = VIDIOC_G_INPUT; break; 660 case VIDIOC_G_INPUT32: cmd = VIDIOC_G_INPUT; break;
648 case VIDIOC_S_INPUT32: cmd = VIDIOC_S_INPUT; break; 661 case VIDIOC_S_INPUT32: cmd = VIDIOC_S_INPUT; break;
649 case VIDIOC_TRY_FMT32: cmd = VIDIOC_TRY_FMT; break; 662 case VIDIOC_TRY_FMT32: cmd = VIDIOC_TRY_FMT; break;
650 case VIDIOCSMICROCODE32: cmd = VIDIOCSMICROCODE; break;
651 }; 663 };
652 664
653 switch(cmd) { 665 switch(cmd) {
666#ifdef CONFIG_VIDEO_V4L1_COMPAT
654 case VIDIOCSTUNER: 667 case VIDIOCSTUNER:
655 case VIDIOCGTUNER: 668 case VIDIOCGTUNER:
656 err = get_video_tuner32(&karg.vt, up); 669 err = get_video_tuner32(&karg.vt, up);
@@ -664,6 +677,7 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg
664 break; 677 break;
665 678
666 case VIDIOCSFREQ: 679 case VIDIOCSFREQ:
680#endif
667 case VIDIOC_S_INPUT: 681 case VIDIOC_S_INPUT:
668 case VIDIOC_OVERLAY: 682 case VIDIOC_OVERLAY:
669 case VIDIOC_STREAMON: 683 case VIDIOC_STREAMON:
@@ -717,18 +731,21 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg
717 compatible_arg = 0; 731 compatible_arg = 0;
718 break; 732 break;
719 733
734#ifdef CONFIG_VIDEO_V4L1_COMPAT
720 case VIDIOCGWIN: 735 case VIDIOCGWIN:
721 case VIDIOCGFBUF: 736 case VIDIOCGFBUF:
722 case VIDIOCGFREQ: 737 case VIDIOCGFREQ:
738#endif
723 case VIDIOC_G_FBUF: 739 case VIDIOC_G_FBUF:
724 case VIDIOC_G_INPUT: 740 case VIDIOC_G_INPUT:
725 compatible_arg = 0; 741 compatible_arg = 0;
742#ifdef CONFIG_VIDEO_V4L1_COMPAT
726 case VIDIOCSMICROCODE: 743 case VIDIOCSMICROCODE:
727 err = microcode32(&karg.vc, up); 744 err = microcode32(&karg.vc, up);
728 compatible_arg = 0; 745 compatible_arg = 0;
729 break; 746 break;
747#endif
730 }; 748 };
731
732 if(err) 749 if(err)
733 goto out; 750 goto out;
734 751
@@ -743,6 +760,7 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg
743 } 760 }
744 if(err == 0) { 761 if(err == 0) {
745 switch(cmd) { 762 switch(cmd) {
763#ifdef CONFIG_VIDEO_V4L1_COMPAT
746 case VIDIOCGTUNER: 764 case VIDIOCGTUNER:
747 err = put_video_tuner32(&karg.vt, up); 765 err = put_video_tuner32(&karg.vt, up);
748 break; 766 break;
@@ -754,7 +772,7 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg
754 case VIDIOCGFBUF: 772 case VIDIOCGFBUF:
755 err = put_video_buffer32(&karg.vb, up); 773 err = put_video_buffer32(&karg.vb, up);
756 break; 774 break;
757 775#endif
758 case VIDIOC_G_FBUF: 776 case VIDIOC_G_FBUF:
759 err = put_v4l2_framebuffer32(&karg.v2fb, up); 777 err = put_v4l2_framebuffer32(&karg.v2fb, up);
760 break; 778 break;
@@ -792,7 +810,9 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg
792 err = put_v4l2_input32(&karg.v2i, up); 810 err = put_v4l2_input32(&karg.v2i, up);
793 break; 811 break;
794 812
813#ifdef CONFIG_VIDEO_V4L1_COMPAT
795 case VIDIOCGFREQ: 814 case VIDIOCGFREQ:
815#endif
796 case VIDIOC_G_INPUT: 816 case VIDIOC_G_INPUT:
797 err = put_user(((u32)karg.vx), (u32 __user *)up); 817 err = put_user(((u32)karg.vx), (u32 __user *)up);
798 break; 818 break;
@@ -810,6 +830,7 @@ long v4l_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg)
810 return ret; 830 return ret;
811 831
812 switch (cmd) { 832 switch (cmd) {
833#ifdef CONFIG_VIDEO_V4L1_COMPAT
813 case VIDIOCSWIN32: 834 case VIDIOCSWIN32:
814 ret = do_set_window(file, cmd, arg); 835 ret = do_set_window(file, cmd, arg);
815 break; 836 break;
@@ -820,6 +841,7 @@ long v4l_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg)
820 case VIDIOCSFBUF32: 841 case VIDIOCSFBUF32:
821 case VIDIOCGFREQ32: 842 case VIDIOCGFREQ32:
822 case VIDIOCSFREQ32: 843 case VIDIOCSFREQ32:
844#endif
823 case VIDIOC_QUERYCAP: 845 case VIDIOC_QUERYCAP:
824 case VIDIOC_ENUM_FMT: 846 case VIDIOC_ENUM_FMT:
825 case VIDIOC_G_FMT32: 847 case VIDIOC_G_FMT32:
@@ -851,6 +873,7 @@ long v4l_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg)
851 ret = do_video_ioctl(file, cmd, arg); 873 ret = do_video_ioctl(file, cmd, arg);
852 break; 874 break;
853 875
876#ifdef CONFIG_VIDEO_V4L1_COMPAT
854 /* Little v, the video4linux ioctls (conflict?) */ 877 /* Little v, the video4linux ioctls (conflict?) */
855 case VIDIOCGCAP: 878 case VIDIOCGCAP:
856 case VIDIOCGCHAN: 879 case VIDIOCGCHAN:
@@ -879,6 +902,7 @@ long v4l_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg)
879 case _IOR('v' , BASE_VIDIOCPRIVATE+7, int): 902 case _IOR('v' , BASE_VIDIOCPRIVATE+7, int):
880 ret = native_ioctl(file, cmd, (unsigned long)compat_ptr(arg)); 903 ret = native_ioctl(file, cmd, (unsigned long)compat_ptr(arg));
881 break; 904 break;
905#endif
882 default: 906 default:
883 v4l_print_ioctl("compat_ioctl32", cmd); 907 v4l_print_ioctl("compat_ioctl32", cmd);
884 } 908 }