Commit 5bdd6cc3 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

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: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent 487206f2
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
#ifdef CONFIG_VIDEO_V4L1_COMPAT
struct video_tuner32 { struct video_tuner32 {
compat_int_t tuner; compat_int_t tuner;
char name[32]; char name[32];
...@@ -107,6 +107,7 @@ struct video_window32 { ...@@ -107,6 +107,7 @@ struct video_window32 {
compat_caddr_t clips; compat_caddr_t clips;
compat_int_t clipcount; compat_int_t clipcount;
}; };
#endif
static int native_ioctl(struct file *file, unsigned int cmd, unsigned long arg) static int native_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{ {
...@@ -124,6 +125,7 @@ static int native_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -124,6 +125,7 @@ static int native_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
} }
#ifdef CONFIG_VIDEO_V4L1_COMPAT
/* You get back everything except the clips... */ /* You get back everything except the clips... */
static int put_video_window32(struct video_window *kp, struct video_window32 __user *up) static int put_video_window32(struct video_window *kp, struct video_window32 __user *up)
{ {
...@@ -138,6 +140,7 @@ static int put_video_window32(struct video_window *kp, struct video_window32 __u ...@@ -138,6 +140,7 @@ static int put_video_window32(struct video_window *kp, struct video_window32 __u
return -EFAULT; return -EFAULT;
return 0; return 0;
} }
#endif
struct v4l2_clip32 struct v4l2_clip32
{ {
...@@ -490,6 +493,7 @@ static inline int put_v4l2_input(struct v4l2_input *kp, struct v4l2_input __user ...@@ -490,6 +493,7 @@ static inline int put_v4l2_input(struct v4l2_input *kp, struct v4l2_input __user
return 0; return 0;
} }
#ifdef CONFIG_VIDEO_V4L1_COMPAT
struct video_code32 struct video_code32
{ {
char loadwhat[16]; /* name or tag of file being passed */ 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,6 +521,8 @@ static inline int microcode32(struct video_code *kp, struct video_code32 __user
#define VIDIOCSFREQ32 _IOW('v',15, u32) #define VIDIOCSFREQ32 _IOW('v',15, u32)
#define VIDIOCSMICROCODE32 _IOW('v',27, struct video_code32) #define VIDIOCSMICROCODE32 _IOW('v',27, struct video_code32)
#endif
/* VIDIOC_ENUMINPUT32 is VIDIOC_ENUMINPUT minus 4 bytes of padding alignement */ /* VIDIOC_ENUMINPUT32 is VIDIOC_ENUMINPUT minus 4 bytes of padding alignement */
#define VIDIOC_ENUMINPUT32 VIDIOC_ENUMINPUT - _IOC(0, 0, 0, 4) #define VIDIOC_ENUMINPUT32 VIDIOC_ENUMINPUT - _IOC(0, 0, 0, 4)
#define VIDIOC_G_FMT32 _IOWR ('V', 4, struct v4l2_format32) #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,6 +543,7 @@ static inline int microcode32(struct video_code *kp, struct video_code32 __user
#define VIDIOC_S_INPUT32 _IOWR ('V', 39, compat_int_t) #define VIDIOC_S_INPUT32 _IOWR ('V', 39, compat_int_t)
#define VIDIOC_TRY_FMT32 _IOWR ('V', 64, struct v4l2_format32) #define VIDIOC_TRY_FMT32 _IOWR ('V', 64, struct v4l2_format32)
#ifdef CONFIG_VIDEO_V4L1_COMPAT
enum { enum {
MaxClips = (~0U-sizeof(struct video_window))/sizeof(struct video_clip) MaxClips = (~0U-sizeof(struct video_window))/sizeof(struct video_clip)
}; };
...@@ -601,14 +608,17 @@ static int do_set_window(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -601,14 +608,17 @@ static int do_set_window(struct file *file, unsigned int cmd, unsigned long arg)
return native_ioctl(file, VIDIOCSWIN, (unsigned long)vw); return native_ioctl(file, VIDIOCSWIN, (unsigned long)vw);
} }
#endif
static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg) static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{ {
union { union {
#ifdef CONFIG_VIDEO_V4L1_COMPAT
struct video_tuner vt; struct video_tuner vt;
struct video_buffer vb; struct video_buffer vb;
struct video_window vw; struct video_window vw;
struct video_code vc; struct video_code vc;
#endif
struct v4l2_format v2f; struct v4l2_format v2f;
struct v4l2_buffer v2b; struct v4l2_buffer v2b;
struct v4l2_framebuffer v2fb; struct v4l2_framebuffer v2fb;
...@@ -624,6 +634,7 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg ...@@ -624,6 +634,7 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg
/* First, convert the command. */ /* First, convert the command. */
switch(cmd) { switch(cmd) {
#ifdef CONFIG_VIDEO_V4L1_COMPAT
case VIDIOCGTUNER32: cmd = VIDIOCGTUNER; break; case VIDIOCGTUNER32: cmd = VIDIOCGTUNER; break;
case VIDIOCSTUNER32: cmd = VIDIOCSTUNER; break; case VIDIOCSTUNER32: cmd = VIDIOCSTUNER; break;
case VIDIOCGWIN32: cmd = VIDIOCGWIN; break; case VIDIOCGWIN32: cmd = VIDIOCGWIN; break;
...@@ -631,6 +642,8 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg ...@@ -631,6 +642,8 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg
case VIDIOCSFBUF32: cmd = VIDIOCSFBUF; break; case VIDIOCSFBUF32: cmd = VIDIOCSFBUF; break;
case VIDIOCGFREQ32: cmd = VIDIOCGFREQ; break; case VIDIOCGFREQ32: cmd = VIDIOCGFREQ; break;
case VIDIOCSFREQ32: cmd = VIDIOCSFREQ; break; case VIDIOCSFREQ32: cmd = VIDIOCSFREQ; break;
case VIDIOCSMICROCODE32: cmd = VIDIOCSMICROCODE; break;
#endif
case VIDIOC_G_FMT32: cmd = VIDIOC_G_FMT; break; case VIDIOC_G_FMT32: cmd = VIDIOC_G_FMT; break;
case VIDIOC_S_FMT32: cmd = VIDIOC_S_FMT; break; case VIDIOC_S_FMT32: cmd = VIDIOC_S_FMT; break;
case VIDIOC_QUERYBUF32: cmd = VIDIOC_QUERYBUF; break; 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,10 +660,10 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg
case VIDIOC_G_INPUT32: cmd = VIDIOC_G_INPUT; break; case VIDIOC_G_INPUT32: cmd = VIDIOC_G_INPUT; break;
case VIDIOC_S_INPUT32: cmd = VIDIOC_S_INPUT; break; case VIDIOC_S_INPUT32: cmd = VIDIOC_S_INPUT; break;
case VIDIOC_TRY_FMT32: cmd = VIDIOC_TRY_FMT; break; case VIDIOC_TRY_FMT32: cmd = VIDIOC_TRY_FMT; break;
case VIDIOCSMICROCODE32: cmd = VIDIOCSMICROCODE; break;
}; };
switch(cmd) { switch(cmd) {
#ifdef CONFIG_VIDEO_V4L1_COMPAT
case VIDIOCSTUNER: case VIDIOCSTUNER:
case VIDIOCGTUNER: case VIDIOCGTUNER:
err = get_video_tuner32(&karg.vt, up); 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,6 +677,7 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg
break; break;
case VIDIOCSFREQ: case VIDIOCSFREQ:
#endif
case VIDIOC_S_INPUT: case VIDIOC_S_INPUT:
case VIDIOC_OVERLAY: case VIDIOC_OVERLAY:
case VIDIOC_STREAMON: case VIDIOC_STREAMON:
...@@ -717,18 +731,21 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg ...@@ -717,18 +731,21 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg
compatible_arg = 0; compatible_arg = 0;
break; break;
#ifdef CONFIG_VIDEO_V4L1_COMPAT
case VIDIOCGWIN: case VIDIOCGWIN:
case VIDIOCGFBUF: case VIDIOCGFBUF:
case VIDIOCGFREQ: case VIDIOCGFREQ:
#endif
case VIDIOC_G_FBUF: case VIDIOC_G_FBUF:
case VIDIOC_G_INPUT: case VIDIOC_G_INPUT:
compatible_arg = 0; compatible_arg = 0;
#ifdef CONFIG_VIDEO_V4L1_COMPAT
case VIDIOCSMICROCODE: case VIDIOCSMICROCODE:
err = microcode32(&karg.vc, up); err = microcode32(&karg.vc, up);
compatible_arg = 0; compatible_arg = 0;
break; break;
#endif
}; };
if(err) if(err)
goto out; goto out;
...@@ -743,6 +760,7 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg ...@@ -743,6 +760,7 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg
} }
if(err == 0) { if(err == 0) {
switch(cmd) { switch(cmd) {
#ifdef CONFIG_VIDEO_V4L1_COMPAT
case VIDIOCGTUNER: case VIDIOCGTUNER:
err = put_video_tuner32(&karg.vt, up); err = put_video_tuner32(&karg.vt, up);
break; break;
...@@ -754,7 +772,7 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg ...@@ -754,7 +772,7 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg
case VIDIOCGFBUF: case VIDIOCGFBUF:
err = put_video_buffer32(&karg.vb, up); err = put_video_buffer32(&karg.vb, up);
break; break;
#endif
case VIDIOC_G_FBUF: case VIDIOC_G_FBUF:
err = put_v4l2_framebuffer32(&karg.v2fb, up); err = put_v4l2_framebuffer32(&karg.v2fb, up);
break; break;
...@@ -792,7 +810,9 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg ...@@ -792,7 +810,9 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg
err = put_v4l2_input32(&karg.v2i, up); err = put_v4l2_input32(&karg.v2i, up);
break; break;
#ifdef CONFIG_VIDEO_V4L1_COMPAT
case VIDIOCGFREQ: case VIDIOCGFREQ:
#endif
case VIDIOC_G_INPUT: case VIDIOC_G_INPUT:
err = put_user(((u32)karg.vx), (u32 __user *)up); err = put_user(((u32)karg.vx), (u32 __user *)up);
break; break;
...@@ -810,6 +830,7 @@ long v4l_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -810,6 +830,7 @@ long v4l_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg)
return ret; return ret;
switch (cmd) { switch (cmd) {
#ifdef CONFIG_VIDEO_V4L1_COMPAT
case VIDIOCSWIN32: case VIDIOCSWIN32:
ret = do_set_window(file, cmd, arg); ret = do_set_window(file, cmd, arg);
break; break;
...@@ -820,6 +841,7 @@ long v4l_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -820,6 +841,7 @@ long v4l_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg)
case VIDIOCSFBUF32: case VIDIOCSFBUF32:
case VIDIOCGFREQ32: case VIDIOCGFREQ32:
case VIDIOCSFREQ32: case VIDIOCSFREQ32:
#endif
case VIDIOC_QUERYCAP: case VIDIOC_QUERYCAP:
case VIDIOC_ENUM_FMT: case VIDIOC_ENUM_FMT:
case VIDIOC_G_FMT32: case VIDIOC_G_FMT32:
...@@ -851,6 +873,7 @@ long v4l_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -851,6 +873,7 @@ long v4l_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg)
ret = do_video_ioctl(file, cmd, arg); ret = do_video_ioctl(file, cmd, arg);
break; break;
#ifdef CONFIG_VIDEO_V4L1_COMPAT
/* Little v, the video4linux ioctls (conflict?) */ /* Little v, the video4linux ioctls (conflict?) */
case VIDIOCGCAP: case VIDIOCGCAP:
case VIDIOCGCHAN: case VIDIOCGCHAN:
...@@ -879,6 +902,7 @@ long v4l_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -879,6 +902,7 @@ long v4l_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg)
case _IOR('v' , BASE_VIDIOCPRIVATE+7, int): case _IOR('v' , BASE_VIDIOCPRIVATE+7, int):
ret = native_ioctl(file, cmd, (unsigned long)compat_ptr(arg)); ret = native_ioctl(file, cmd, (unsigned long)compat_ptr(arg));
break; break;
#endif
default: default:
v4l_print_ioctl("compat_ioctl32", cmd); v4l_print_ioctl("compat_ioctl32", cmd);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment