aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/radio/miropcm20-radio.c1
-rw-r--r--drivers/media/radio/radio-aimslab.c1
-rw-r--r--drivers/media/radio/radio-aztech.c1
-rw-r--r--drivers/media/radio/radio-cadet.c1
-rw-r--r--drivers/media/radio/radio-gemtek-pci.c1
-rw-r--r--drivers/media/radio/radio-gemtek.c1
-rw-r--r--drivers/media/radio/radio-maestro.c1
-rw-r--r--drivers/media/radio/radio-maxiradio.c1
-rw-r--r--drivers/media/radio/radio-rtrack2.c1
-rw-r--r--drivers/media/radio/radio-sf16fmi.c1
-rw-r--r--drivers/media/radio/radio-sf16fmr2.c1
-rw-r--r--drivers/media/radio/radio-terratec.c1
-rw-r--r--drivers/media/radio/radio-trust.c1
-rw-r--r--drivers/media/radio/radio-typhoon.c1
-rw-r--r--drivers/media/radio/radio-zoltrix.c1
-rw-r--r--drivers/media/video/Makefile3
-rw-r--r--drivers/media/video/arv.c1
-rw-r--r--drivers/media/video/bttv-driver.c1
-rw-r--r--drivers/media/video/bw-qcam.c1
-rw-r--r--drivers/media/video/c-qcam.c1
-rw-r--r--drivers/media/video/compat_ioctl32.c318
-rw-r--r--drivers/media/video/cpia.c1
-rw-r--r--drivers/media/video/cx88/cx88-video.c2
-rw-r--r--drivers/media/video/meye.c1
-rw-r--r--drivers/media/video/pms.c1
-rw-r--r--drivers/media/video/saa5249.c1
-rw-r--r--drivers/media/video/saa7134/saa7134-video.c2
-rw-r--r--drivers/media/video/stradis.c1
-rw-r--r--drivers/media/video/w9966.c1
-rw-r--r--drivers/media/video/zoran_driver.c1
-rw-r--r--drivers/media/video/zr36120.c1
31 files changed, 351 insertions, 1 deletions
diff --git a/drivers/media/radio/miropcm20-radio.c b/drivers/media/radio/miropcm20-radio.c
index c2ebe8754a95..dc292da2605f 100644
--- a/drivers/media/radio/miropcm20-radio.c
+++ b/drivers/media/radio/miropcm20-radio.c
@@ -220,6 +220,7 @@ static struct file_operations pcm20_fops = {
220 .open = video_exclusive_open, 220 .open = video_exclusive_open,
221 .release = video_exclusive_release, 221 .release = video_exclusive_release,
222 .ioctl = pcm20_ioctl, 222 .ioctl = pcm20_ioctl,
223 .compat_ioctl = v4l_compat_ioctl32,
223 .llseek = no_llseek, 224 .llseek = no_llseek,
224}; 225};
225 226
diff --git a/drivers/media/radio/radio-aimslab.c b/drivers/media/radio/radio-aimslab.c
index 877c770558e9..914deab4e044 100644
--- a/drivers/media/radio/radio-aimslab.c
+++ b/drivers/media/radio/radio-aimslab.c
@@ -299,6 +299,7 @@ static struct file_operations rtrack_fops = {
299 .open = video_exclusive_open, 299 .open = video_exclusive_open,
300 .release = video_exclusive_release, 300 .release = video_exclusive_release,
301 .ioctl = rt_ioctl, 301 .ioctl = rt_ioctl,
302 .compat_ioctl = v4l_compat_ioctl32,
302 .llseek = no_llseek, 303 .llseek = no_llseek,
303}; 304};
304 305
diff --git a/drivers/media/radio/radio-aztech.c b/drivers/media/radio/radio-aztech.c
index 5319a9c9a979..523be820f9c6 100644
--- a/drivers/media/radio/radio-aztech.c
+++ b/drivers/media/radio/radio-aztech.c
@@ -256,6 +256,7 @@ static struct file_operations aztech_fops = {
256 .open = video_exclusive_open, 256 .open = video_exclusive_open,
257 .release = video_exclusive_release, 257 .release = video_exclusive_release,
258 .ioctl = az_ioctl, 258 .ioctl = az_ioctl,
259 .compat_ioctl = v4l_compat_ioctl32,
259 .llseek = no_llseek, 260 .llseek = no_llseek,
260}; 261};
261 262
diff --git a/drivers/media/radio/radio-cadet.c b/drivers/media/radio/radio-cadet.c
index 9b0406318f2d..f1b5ac81e9d2 100644
--- a/drivers/media/radio/radio-cadet.c
+++ b/drivers/media/radio/radio-cadet.c
@@ -490,6 +490,7 @@ static struct file_operations cadet_fops = {
490 .release = cadet_release, 490 .release = cadet_release,
491 .read = cadet_read, 491 .read = cadet_read,
492 .ioctl = cadet_ioctl, 492 .ioctl = cadet_ioctl,
493 .compat_ioctl = v4l_compat_ioctl32,
493 .llseek = no_llseek, 494 .llseek = no_llseek,
494}; 495};
495 496
diff --git a/drivers/media/radio/radio-gemtek-pci.c b/drivers/media/radio/radio-gemtek-pci.c
index 630cc786d0a4..42c8fce04aa2 100644
--- a/drivers/media/radio/radio-gemtek-pci.c
+++ b/drivers/media/radio/radio-gemtek-pci.c
@@ -301,6 +301,7 @@ static struct file_operations gemtek_pci_fops = {
301 .open = video_exclusive_open, 301 .open = video_exclusive_open,
302 .release = video_exclusive_release, 302 .release = video_exclusive_release,
303 .ioctl = gemtek_pci_ioctl, 303 .ioctl = gemtek_pci_ioctl,
304 .compat_ioctl = v4l_compat_ioctl32,
304 .llseek = no_llseek, 305 .llseek = no_llseek,
305}; 306};
306 307
diff --git a/drivers/media/radio/radio-gemtek.c b/drivers/media/radio/radio-gemtek.c
index 6418f03b9ce4..47173be97b9f 100644
--- a/drivers/media/radio/radio-gemtek.c
+++ b/drivers/media/radio/radio-gemtek.c
@@ -233,6 +233,7 @@ static struct file_operations gemtek_fops = {
233 .open = video_exclusive_open, 233 .open = video_exclusive_open,
234 .release = video_exclusive_release, 234 .release = video_exclusive_release,
235 .ioctl = gemtek_ioctl, 235 .ioctl = gemtek_ioctl,
236 .compat_ioctl = v4l_compat_ioctl32,
236 .llseek = no_llseek, 237 .llseek = no_llseek,
237}; 238};
238 239
diff --git a/drivers/media/radio/radio-maestro.c b/drivers/media/radio/radio-maestro.c
index e5e2021a7312..c30effdf711f 100644
--- a/drivers/media/radio/radio-maestro.c
+++ b/drivers/media/radio/radio-maestro.c
@@ -72,6 +72,7 @@ static struct file_operations maestro_fops = {
72 .open = video_exclusive_open, 72 .open = video_exclusive_open,
73 .release = video_exclusive_release, 73 .release = video_exclusive_release,
74 .ioctl = radio_ioctl, 74 .ioctl = radio_ioctl,
75 .compat_ioctl = v4l_compat_ioctl32,
75 .llseek = no_llseek, 76 .llseek = no_llseek,
76}; 77};
77 78
diff --git a/drivers/media/radio/radio-maxiradio.c b/drivers/media/radio/radio-maxiradio.c
index 02d39a50d5ed..30869308332a 100644
--- a/drivers/media/radio/radio-maxiradio.c
+++ b/drivers/media/radio/radio-maxiradio.c
@@ -80,6 +80,7 @@ static struct file_operations maxiradio_fops = {
80 .open = video_exclusive_open, 80 .open = video_exclusive_open,
81 .release = video_exclusive_release, 81 .release = video_exclusive_release,
82 .ioctl = radio_ioctl, 82 .ioctl = radio_ioctl,
83 .compat_ioctl = v4l_compat_ioctl32,
83 .llseek = no_llseek, 84 .llseek = no_llseek,
84}; 85};
85static struct video_device maxiradio_radio = 86static struct video_device maxiradio_radio =
diff --git a/drivers/media/radio/radio-rtrack2.c b/drivers/media/radio/radio-rtrack2.c
index b2256d675b44..28a47c9e7a81 100644
--- a/drivers/media/radio/radio-rtrack2.c
+++ b/drivers/media/radio/radio-rtrack2.c
@@ -199,6 +199,7 @@ static struct file_operations rtrack2_fops = {
199 .open = video_exclusive_open, 199 .open = video_exclusive_open,
200 .release = video_exclusive_release, 200 .release = video_exclusive_release,
201 .ioctl = rt_ioctl, 201 .ioctl = rt_ioctl,
202 .compat_ioctl = v4l_compat_ioctl32,
202 .llseek = no_llseek, 203 .llseek = no_llseek,
203}; 204};
204 205
diff --git a/drivers/media/radio/radio-sf16fmi.c b/drivers/media/radio/radio-sf16fmi.c
index 6f03ce4dd7b0..0229f792a059 100644
--- a/drivers/media/radio/radio-sf16fmi.c
+++ b/drivers/media/radio/radio-sf16fmi.c
@@ -225,6 +225,7 @@ static struct file_operations fmi_fops = {
225 .open = video_exclusive_open, 225 .open = video_exclusive_open,
226 .release = video_exclusive_release, 226 .release = video_exclusive_release,
227 .ioctl = fmi_ioctl, 227 .ioctl = fmi_ioctl,
228 .compat_ioctl = v4l_compat_ioctl32,
228 .llseek = no_llseek, 229 .llseek = no_llseek,
229}; 230};
230 231
diff --git a/drivers/media/radio/radio-sf16fmr2.c b/drivers/media/radio/radio-sf16fmr2.c
index 71971e9bb342..26632cead09a 100644
--- a/drivers/media/radio/radio-sf16fmr2.c
+++ b/drivers/media/radio/radio-sf16fmr2.c
@@ -356,6 +356,7 @@ static struct file_operations fmr2_fops = {
356 .open = video_exclusive_open, 356 .open = video_exclusive_open,
357 .release = video_exclusive_release, 357 .release = video_exclusive_release,
358 .ioctl = fmr2_ioctl, 358 .ioctl = fmr2_ioctl,
359 .compat_ioctl = v4l_compat_ioctl32,
359 .llseek = no_llseek, 360 .llseek = no_llseek,
360}; 361};
361 362
diff --git a/drivers/media/radio/radio-terratec.c b/drivers/media/radio/radio-terratec.c
index b03573c6840e..fcfde2e4f195 100644
--- a/drivers/media/radio/radio-terratec.c
+++ b/drivers/media/radio/radio-terratec.c
@@ -276,6 +276,7 @@ static struct file_operations terratec_fops = {
276 .open = video_exclusive_open, 276 .open = video_exclusive_open,
277 .release = video_exclusive_release, 277 .release = video_exclusive_release,
278 .ioctl = tt_ioctl, 278 .ioctl = tt_ioctl,
279 .compat_ioctl = v4l_compat_ioctl32,
279 .llseek = no_llseek, 280 .llseek = no_llseek,
280}; 281};
281 282
diff --git a/drivers/media/radio/radio-trust.c b/drivers/media/radio/radio-trust.c
index b300bedf7c74..5a099a50d4d0 100644
--- a/drivers/media/radio/radio-trust.c
+++ b/drivers/media/radio/radio-trust.c
@@ -255,6 +255,7 @@ static struct file_operations trust_fops = {
255 .open = video_exclusive_open, 255 .open = video_exclusive_open,
256 .release = video_exclusive_release, 256 .release = video_exclusive_release,
257 .ioctl = tr_ioctl, 257 .ioctl = tr_ioctl,
258 .compat_ioctl = v4l_compat_ioctl32,
258 .llseek = no_llseek, 259 .llseek = no_llseek,
259}; 260};
260 261
diff --git a/drivers/media/radio/radio-typhoon.c b/drivers/media/radio/radio-typhoon.c
index f304f3c14763..8ac9a8ef9094 100644
--- a/drivers/media/radio/radio-typhoon.c
+++ b/drivers/media/radio/radio-typhoon.c
@@ -261,6 +261,7 @@ static struct file_operations typhoon_fops = {
261 .open = video_exclusive_open, 261 .open = video_exclusive_open,
262 .release = video_exclusive_release, 262 .release = video_exclusive_release,
263 .ioctl = typhoon_ioctl, 263 .ioctl = typhoon_ioctl,
264 .compat_ioctl = v4l_compat_ioctl32,
264 .llseek = no_llseek, 265 .llseek = no_llseek,
265}; 266};
266 267
diff --git a/drivers/media/radio/radio-zoltrix.c b/drivers/media/radio/radio-zoltrix.c
index 4c6d6fb49034..d590e80c922e 100644
--- a/drivers/media/radio/radio-zoltrix.c
+++ b/drivers/media/radio/radio-zoltrix.c
@@ -313,6 +313,7 @@ static struct file_operations zoltrix_fops =
313 .open = video_exclusive_open, 313 .open = video_exclusive_open,
314 .release = video_exclusive_release, 314 .release = video_exclusive_release,
315 .ioctl = zol_ioctl, 315 .ioctl = zol_ioctl,
316 .compat_ioctl = v4l_compat_ioctl32,
316 .llseek = no_llseek, 317 .llseek = no_llseek,
317}; 318};
318 319
diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile
index 82060f9909d8..618a08ab940a 100644
--- a/drivers/media/video/Makefile
+++ b/drivers/media/video/Makefile
@@ -8,7 +8,8 @@ zoran-objs := zr36120.o zr36120_i2c.o zr36120_mem.o
8zr36067-objs := zoran_procfs.o zoran_device.o \ 8zr36067-objs := zoran_procfs.o zoran_device.o \
9 zoran_driver.o zoran_card.o 9 zoran_driver.o zoran_card.o
10tuner-objs := tuner-core.o tuner-simple.o mt20xx.o tda8290.o tea5767.o 10tuner-objs := tuner-core.o tuner-simple.o mt20xx.o tda8290.o tea5767.o
11obj-$(CONFIG_VIDEO_DEV) += videodev.o v4l2-common.o v4l1-compat.o 11
12obj-$(CONFIG_VIDEO_DEV) += videodev.o v4l2-common.o v4l1-compat.o compat_ioctl32.o
12 13
13obj-$(CONFIG_VIDEO_BT848) += bttv.o msp3400.o tvaudio.o \ 14obj-$(CONFIG_VIDEO_BT848) += bttv.o msp3400.o tvaudio.o \
14 tda7432.o tda9875.o ir-kbd-i2c.o ir-kbd-gpio.o 15 tda7432.o tda9875.o ir-kbd-i2c.o ir-kbd-gpio.o
diff --git a/drivers/media/video/arv.c b/drivers/media/video/arv.c
index 881cdcb1875d..7d5a068353f2 100644
--- a/drivers/media/video/arv.c
+++ b/drivers/media/video/arv.c
@@ -749,6 +749,7 @@ static struct file_operations ar_fops = {
749 .release = video_exclusive_release, 749 .release = video_exclusive_release,
750 .read = ar_read, 750 .read = ar_read,
751 .ioctl = ar_ioctl, 751 .ioctl = ar_ioctl,
752 .compat_ioctl = v4l_compat_ioctl32,
752 .llseek = no_llseek, 753 .llseek = no_llseek,
753}; 754};
754 755
diff --git a/drivers/media/video/bttv-driver.c b/drivers/media/video/bttv-driver.c
index 1ddf9ba613ef..03f925724ce9 100644
--- a/drivers/media/video/bttv-driver.c
+++ b/drivers/media/video/bttv-driver.c
@@ -3120,6 +3120,7 @@ static struct file_operations bttv_fops =
3120 .open = bttv_open, 3120 .open = bttv_open,
3121 .release = bttv_release, 3121 .release = bttv_release,
3122 .ioctl = bttv_ioctl, 3122 .ioctl = bttv_ioctl,
3123 .compat_ioctl = v4l_compat_ioctl32,
3123 .llseek = no_llseek, 3124 .llseek = no_llseek,
3124 .read = bttv_read, 3125 .read = bttv_read,
3125 .mmap = bttv_mmap, 3126 .mmap = bttv_mmap,
diff --git a/drivers/media/video/bw-qcam.c b/drivers/media/video/bw-qcam.c
index 0065d0c240d1..6bad93ef969f 100644
--- a/drivers/media/video/bw-qcam.c
+++ b/drivers/media/video/bw-qcam.c
@@ -875,6 +875,7 @@ static struct file_operations qcam_fops = {
875 .open = video_exclusive_open, 875 .open = video_exclusive_open,
876 .release = video_exclusive_release, 876 .release = video_exclusive_release,
877 .ioctl = qcam_ioctl, 877 .ioctl = qcam_ioctl,
878 .compat_ioctl = v4l_compat_ioctl32,
878 .read = qcam_read, 879 .read = qcam_read,
879 .llseek = no_llseek, 880 .llseek = no_llseek,
880}; 881};
diff --git a/drivers/media/video/c-qcam.c b/drivers/media/video/c-qcam.c
index 75442ec49f35..9976db4f6da8 100644
--- a/drivers/media/video/c-qcam.c
+++ b/drivers/media/video/c-qcam.c
@@ -687,6 +687,7 @@ static struct file_operations qcam_fops = {
687 .open = video_exclusive_open, 687 .open = video_exclusive_open,
688 .release = video_exclusive_release, 688 .release = video_exclusive_release,
689 .ioctl = qcam_ioctl, 689 .ioctl = qcam_ioctl,
690 .compat_ioctl = v4l_compat_ioctl32,
690 .read = qcam_read, 691 .read = qcam_read,
691 .llseek = no_llseek, 692 .llseek = no_llseek,
692}; 693};
diff --git a/drivers/media/video/compat_ioctl32.c b/drivers/media/video/compat_ioctl32.c
new file mode 100644
index 000000000000..42dc11c63c0d
--- /dev/null
+++ b/drivers/media/video/compat_ioctl32.c
@@ -0,0 +1,318 @@
1#include <linux/config.h>
2#include <linux/compat.h>
3#include <linux/videodev.h>
4
5#ifdef CONFIG_COMPAT
6struct video_tuner32 {
7 compat_int_t tuner;
8 char name[32];
9 compat_ulong_t rangelow, rangehigh;
10 u32 flags; /* It is really u32 in videodev.h */
11 u16 mode, signal;
12};
13
14static int get_video_tuner32(struct video_tuner *kp, struct video_tuner32 __user *up)
15{
16 int i;
17
18 if(get_user(kp->tuner, &up->tuner))
19 return -EFAULT;
20 for(i = 0; i < 32; i++)
21 __get_user(kp->name[i], &up->name[i]);
22 __get_user(kp->rangelow, &up->rangelow);
23 __get_user(kp->rangehigh, &up->rangehigh);
24 __get_user(kp->flags, &up->flags);
25 __get_user(kp->mode, &up->mode);
26 __get_user(kp->signal, &up->signal);
27 return 0;
28}
29
30static int put_video_tuner32(struct video_tuner *kp, struct video_tuner32 __user *up)
31{
32 int i;
33
34 if(put_user(kp->tuner, &up->tuner))
35 return -EFAULT;
36 for(i = 0; i < 32; i++)
37 __put_user(kp->name[i], &up->name[i]);
38 __put_user(kp->rangelow, &up->rangelow);
39 __put_user(kp->rangehigh, &up->rangehigh);
40 __put_user(kp->flags, &up->flags);
41 __put_user(kp->mode, &up->mode);
42 __put_user(kp->signal, &up->signal);
43 return 0;
44}
45
46struct video_buffer32 {
47 compat_caddr_t base;
48 compat_int_t height, width, depth, bytesperline;
49};
50
51static int get_video_buffer32(struct video_buffer *kp, struct video_buffer32 __user *up)
52{
53 u32 tmp;
54
55 if (get_user(tmp, &up->base))
56 return -EFAULT;
57
58 /* This is actually a physical address stored
59 * as a void pointer.
60 */
61 kp->base = (void *)(unsigned long) tmp;
62
63 __get_user(kp->height, &up->height);
64 __get_user(kp->width, &up->width);
65 __get_user(kp->depth, &up->depth);
66 __get_user(kp->bytesperline, &up->bytesperline);
67 return 0;
68}
69
70static int put_video_buffer32(struct video_buffer *kp, struct video_buffer32 __user *up)
71{
72 u32 tmp = (u32)((unsigned long)kp->base);
73
74 if(put_user(tmp, &up->base))
75 return -EFAULT;
76 __put_user(kp->height, &up->height);
77 __put_user(kp->width, &up->width);
78 __put_user(kp->depth, &up->depth);
79 __put_user(kp->bytesperline, &up->bytesperline);
80 return 0;
81}
82
83struct video_clip32 {
84 s32 x, y, width, height; /* Its really s32 in videodev.h */
85 compat_caddr_t next;
86};
87
88struct video_window32 {
89 u32 x, y, width, height, chromakey, flags;
90 compat_caddr_t clips;
91 compat_int_t clipcount;
92};
93
94static int native_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
95{
96 int ret = -ENOIOCTLCMD;
97
98 if (file->f_ops->unlocked_ioctl)
99 ret = file->f_ops->unlocked_ioctl(file, cmd, arg);
100 else if (file->f_ops->ioctl) {
101 lock_kernel();
102 ret = file->f_ops->ioctl(file->f_dentry->d_inode, file, cmd, arg);
103 unlock_kernel();
104 }
105
106 return ret;
107}
108
109
110/* You get back everything except the clips... */
111static int put_video_window32(struct video_window *kp, struct video_window32 __user *up)
112{
113 if(put_user(kp->x, &up->x))
114 return -EFAULT;
115 __put_user(kp->y, &up->y);
116 __put_user(kp->width, &up->width);
117 __put_user(kp->height, &up->height);
118 __put_user(kp->chromakey, &up->chromakey);
119 __put_user(kp->flags, &up->flags);
120 __put_user(kp->clipcount, &up->clipcount);
121 return 0;
122}
123
124#define VIDIOCGTUNER32 _IOWR('v',4, struct video_tuner32)
125#define VIDIOCSTUNER32 _IOW('v',5, struct video_tuner32)
126#define VIDIOCGWIN32 _IOR('v',9, struct video_window32)
127#define VIDIOCSWIN32 _IOW('v',10, struct video_window32)
128#define VIDIOCGFBUF32 _IOR('v',11, struct video_buffer32)
129#define VIDIOCSFBUF32 _IOW('v',12, struct video_buffer32)
130#define VIDIOCGFREQ32 _IOR('v',14, u32)
131#define VIDIOCSFREQ32 _IOW('v',15, u32)
132
133enum {
134 MaxClips = (~0U-sizeof(struct video_window))/sizeof(struct video_clip)
135};
136
137static int do_set_window(struct file *file, unsigned int cmd, unsigned long arg)
138{
139 struct video_window32 __user *up = compat_ptr(arg);
140 struct video_window __user *vw;
141 struct video_clip __user *p;
142 int nclips;
143 u32 n;
144
145 if (get_user(nclips, &up->clipcount))
146 return -EFAULT;
147
148 /* Peculiar interface... */
149 if (nclips < 0)
150 nclips = VIDEO_CLIPMAP_SIZE;
151
152 if (nclips > MaxClips)
153 return -ENOMEM;
154
155 vw = compat_alloc_user_space(sizeof(struct video_window) +
156 nclips * sizeof(struct video_clip));
157
158 p = nclips ? (struct video_clip __user *)(vw + 1) : NULL;
159
160 if (get_user(n, &up->x) || put_user(n, &vw->x) ||
161 get_user(n, &up->y) || put_user(n, &vw->y) ||
162 get_user(n, &up->width) || put_user(n, &vw->width) ||
163 get_user(n, &up->height) || put_user(n, &vw->height) ||
164 get_user(n, &up->chromakey) || put_user(n, &vw->chromakey) ||
165 get_user(n, &up->flags) || put_user(n, &vw->flags) ||
166 get_user(n, &up->clipcount) || put_user(n, &vw->clipcount) ||
167 get_user(n, &up->clips) || put_user(p, &vw->clips))
168 return -EFAULT;
169
170 if (nclips) {
171 struct video_clip32 __user *u = compat_ptr(n);
172 int i;
173 if (!u)
174 return -EINVAL;
175 for (i = 0; i < nclips; i++, u++, p++) {
176 s32 v;
177 if (get_user(v, &u->x) ||
178 put_user(v, &p->x) ||
179 get_user(v, &u->y) ||
180 put_user(v, &p->y) ||
181 get_user(v, &u->width) ||
182 put_user(v, &p->width) ||
183 get_user(v, &u->height) ||
184 put_user(v, &p->height) ||
185 put_user(NULL, &p->next))
186 return -EFAULT;
187 }
188 }
189
190 return native_ioctl(file, VIDIOCSWIN, (unsigned long)p);
191}
192
193static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
194{
195 union {
196 struct video_tuner vt;
197 struct video_buffer vb;
198 struct video_window vw;
199 unsigned long vx;
200 } karg;
201 mm_segment_t old_fs = get_fs();
202 void __user *up = compat_ptr(arg);
203 int err = 0;
204
205 /* First, convert the command. */
206 switch(cmd) {
207 case VIDIOCGTUNER32: cmd = VIDIOCGTUNER; break;
208 case VIDIOCSTUNER32: cmd = VIDIOCSTUNER; break;
209 case VIDIOCGWIN32: cmd = VIDIOCGWIN; break;
210 case VIDIOCGFBUF32: cmd = VIDIOCGFBUF; break;
211 case VIDIOCSFBUF32: cmd = VIDIOCSFBUF; break;
212 case VIDIOCGFREQ32: cmd = VIDIOCGFREQ; break;
213 case VIDIOCSFREQ32: cmd = VIDIOCSFREQ; break;
214 };
215
216 switch(cmd) {
217 case VIDIOCSTUNER:
218 case VIDIOCGTUNER:
219 err = get_video_tuner32(&karg.vt, up);
220 break;
221
222 case VIDIOCSFBUF:
223 err = get_video_buffer32(&karg.vb, up);
224 break;
225
226 case VIDIOCSFREQ:
227 err = get_user(karg.vx, (u32 __user *)up);
228 break;
229 };
230 if(err)
231 goto out;
232
233 set_fs(KERNEL_DS);
234 err = native_ioctl(file, cmd, (unsigned long)&karg);
235 set_fs(old_fs);
236
237 if(err == 0) {
238 switch(cmd) {
239 case VIDIOCGTUNER:
240 err = put_video_tuner32(&karg.vt, up);
241 break;
242
243 case VIDIOCGWIN:
244 err = put_video_window32(&karg.vw, up);
245 break;
246
247 case VIDIOCGFBUF:
248 err = put_video_buffer32(&karg.vb, up);
249 break;
250
251 case VIDIOCGFREQ:
252 err = put_user(((u32)karg.vx), (u32 __user *)up);
253 break;
254 };
255 }
256out:
257 return err;
258}
259
260long v4l_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg)
261{
262 int ret = -ENOIOCTLCMD;
263
264 if (!file->f_ops->ioctl)
265 return ret;
266
267 switch (cmd) {
268 case VIDIOCSWIN32:
269 ret = do_set_window(file, cmd, arg);
270 break;
271 case VIDIOCGTUNER32:
272 case VIDIOCSTUNER32:
273 case VIDIOCGWIN32:
274 case VIDIOCGFBUF32:
275 case VIDIOCSFBUF32:
276 case VIDIOCGFREQ32:
277 case VIDIOCSFREQ32
278 ret = do_video_ioctl(file, cmd, arg);
279 break;
280
281 /* Little v, the video4linux ioctls (conflict?) */
282 case VIDIOCGCAP:
283 case VIDIOCGCHAN:
284 case VIDIOCSCHAN:
285 case VIDIOCGPICT:
286 case VIDIOCSPICT:
287 case VIDIOCCAPTURE:
288 case VIDIOCKEY:
289 case VIDIOCGAUDIO:
290 case VIDIOCSAUDIO:
291 case VIDIOCSYNC:
292 case VIDIOCMCAPTURE:
293 case VIDIOCGMBUF:
294 case VIDIOCGUNIT:
295 case VIDIOCGCAPTURE:
296 case VIDIOCSCAPTURE:
297
298 /* BTTV specific... */
299 case _IOW('v', BASE_VIDIOCPRIVATE+0, char [256]):
300 case _IOR('v', BASE_VIDIOCPRIVATE+1, char [256]):
301 case _IOR('v' , BASE_VIDIOCPRIVATE+2, unsigned int):
302 case _IOW('v' , BASE_VIDIOCPRIVATE+3, char [16]): /* struct bttv_pll_info */
303 case _IOR('v' , BASE_VIDIOCPRIVATE+4, int):
304 case _IOR('v' , BASE_VIDIOCPRIVATE+5, int):
305 case _IOR('v' , BASE_VIDIOCPRIVATE+6, int):
306 case _IOR('v' , BASE_VIDIOCPRIVATE+7, int):
307 ret = native_ioctl(file, cmd, (unsigned long)compat_ptr(arg));
308 break;
309
310 return ret;
311}
312#else
313long v4l_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg)
314{
315 return -ENOIOCTLCMD;
316}
317#endif
318EXPORT_SYMBOL_GPL(v4l_compat_ioctl32);
diff --git a/drivers/media/video/cpia.c b/drivers/media/video/cpia.c
index b7ec9bf45085..9f59541155d9 100644
--- a/drivers/media/video/cpia.c
+++ b/drivers/media/video/cpia.c
@@ -3807,6 +3807,7 @@ static struct file_operations cpia_fops = {
3807 .read = cpia_read, 3807 .read = cpia_read,
3808 .mmap = cpia_mmap, 3808 .mmap = cpia_mmap,
3809 .ioctl = cpia_ioctl, 3809 .ioctl = cpia_ioctl,
3810 .compat_ioctl = v4l_compat_ioctl32,
3810 .llseek = no_llseek, 3811 .llseek = no_llseek,
3811}; 3812};
3812 3813
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c
index 24a48f8a48c1..bc025c46aedf 100644
--- a/drivers/media/video/cx88/cx88-video.c
+++ b/drivers/media/video/cx88/cx88-video.c
@@ -1740,6 +1740,7 @@ static struct file_operations video_fops =
1740 .poll = video_poll, 1740 .poll = video_poll,
1741 .mmap = video_mmap, 1741 .mmap = video_mmap,
1742 .ioctl = video_ioctl, 1742 .ioctl = video_ioctl,
1743 .compat_ioctl = v4l_compat_ioctl32,
1743 .llseek = no_llseek, 1744 .llseek = no_llseek,
1744}; 1745};
1745 1746
@@ -1767,6 +1768,7 @@ static struct file_operations radio_fops =
1767 .open = video_open, 1768 .open = video_open,
1768 .release = video_release, 1769 .release = video_release,
1769 .ioctl = radio_ioctl, 1770 .ioctl = radio_ioctl,
1771 .compat_ioctl = v4l_compat_ioctl32,
1770 .llseek = no_llseek, 1772 .llseek = no_llseek,
1771}; 1773};
1772 1774
diff --git a/drivers/media/video/meye.c b/drivers/media/video/meye.c
index 3f2a882bc20a..2869464aee0d 100644
--- a/drivers/media/video/meye.c
+++ b/drivers/media/video/meye.c
@@ -1754,6 +1754,7 @@ static struct file_operations meye_fops = {
1754 .release = meye_release, 1754 .release = meye_release,
1755 .mmap = meye_mmap, 1755 .mmap = meye_mmap,
1756 .ioctl = meye_ioctl, 1756 .ioctl = meye_ioctl,
1757 .compat_ioctl = v4l_compat_ioctl32,
1757 .poll = meye_poll, 1758 .poll = meye_poll,
1758 .llseek = no_llseek, 1759 .llseek = no_llseek,
1759}; 1760};
diff --git a/drivers/media/video/pms.c b/drivers/media/video/pms.c
index 2504207b2e3d..9e6448639480 100644
--- a/drivers/media/video/pms.c
+++ b/drivers/media/video/pms.c
@@ -883,6 +883,7 @@ static struct file_operations pms_fops = {
883 .open = video_exclusive_open, 883 .open = video_exclusive_open,
884 .release = video_exclusive_release, 884 .release = video_exclusive_release,
885 .ioctl = pms_ioctl, 885 .ioctl = pms_ioctl,
886 .compat_ioctl = v4l_compat_ioctl32,
886 .read = pms_read, 887 .read = pms_read,
887 .llseek = no_llseek, 888 .llseek = no_llseek,
888}; 889};
diff --git a/drivers/media/video/saa5249.c b/drivers/media/video/saa5249.c
index a51c7bd96618..73b4f0e2abf0 100644
--- a/drivers/media/video/saa5249.c
+++ b/drivers/media/video/saa5249.c
@@ -702,6 +702,7 @@ static struct file_operations saa_fops = {
702 .open = saa5249_open, 702 .open = saa5249_open,
703 .release = saa5249_release, 703 .release = saa5249_release,
704 .ioctl = saa5249_ioctl, 704 .ioctl = saa5249_ioctl,
705 .compat_ioctl = v4l_compat_ioctl32,
705 .llseek = no_llseek, 706 .llseek = no_llseek,
706}; 707};
707 708
diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c
index 45c852df13ed..9b9e1e7f05ef 100644
--- a/drivers/media/video/saa7134/saa7134-video.c
+++ b/drivers/media/video/saa7134/saa7134-video.c
@@ -2262,6 +2262,7 @@ static struct file_operations video_fops =
2262 .poll = video_poll, 2262 .poll = video_poll,
2263 .mmap = video_mmap, 2263 .mmap = video_mmap,
2264 .ioctl = video_ioctl, 2264 .ioctl = video_ioctl,
2265 .compat_ioctl = v4l_compat_ioctl32,
2265 .llseek = no_llseek, 2266 .llseek = no_llseek,
2266}; 2267};
2267 2268
@@ -2271,6 +2272,7 @@ static struct file_operations radio_fops =
2271 .open = video_open, 2272 .open = video_open,
2272 .release = video_release, 2273 .release = video_release,
2273 .ioctl = radio_ioctl, 2274 .ioctl = radio_ioctl,
2275 .compat_ioctl = v4l_compat_ioctl32,
2274 .llseek = no_llseek, 2276 .llseek = no_llseek,
2275}; 2277};
2276 2278
diff --git a/drivers/media/video/stradis.c b/drivers/media/video/stradis.c
index d4497dbae05c..6ee54a45411f 100644
--- a/drivers/media/video/stradis.c
+++ b/drivers/media/video/stradis.c
@@ -1974,6 +1974,7 @@ static struct file_operations saa_fops =
1974 .open = saa_open, 1974 .open = saa_open,
1975 .release = saa_release, 1975 .release = saa_release,
1976 .ioctl = saa_ioctl, 1976 .ioctl = saa_ioctl,
1977 .compat_ioctl = v4l_compat_ioctl32,
1977 .read = saa_read, 1978 .read = saa_read,
1978 .llseek = no_llseek, 1979 .llseek = no_llseek,
1979 .write = saa_write, 1980 .write = saa_write,
diff --git a/drivers/media/video/w9966.c b/drivers/media/video/w9966.c
index c318ba32fbaf..b7b0afffd214 100644
--- a/drivers/media/video/w9966.c
+++ b/drivers/media/video/w9966.c
@@ -187,6 +187,7 @@ static struct file_operations w9966_fops = {
187 .open = video_exclusive_open, 187 .open = video_exclusive_open,
188 .release = video_exclusive_release, 188 .release = video_exclusive_release,
189 .ioctl = w9966_v4l_ioctl, 189 .ioctl = w9966_v4l_ioctl,
190 .compat_ioctl = v4l_compat_ioctl32,
190 .read = w9966_v4l_read, 191 .read = w9966_v4l_read,
191 .llseek = no_llseek, 192 .llseek = no_llseek,
192}; 193};
diff --git a/drivers/media/video/zoran_driver.c b/drivers/media/video/zoran_driver.c
index 4034f1b45366..15283f44e79f 100644
--- a/drivers/media/video/zoran_driver.c
+++ b/drivers/media/video/zoran_driver.c
@@ -4678,6 +4678,7 @@ static struct file_operations zoran_fops = {
4678 .open = zoran_open, 4678 .open = zoran_open,
4679 .release = zoran_close, 4679 .release = zoran_close,
4680 .ioctl = zoran_ioctl, 4680 .ioctl = zoran_ioctl,
4681 .compat_ioctl = v4l_compat_ioctl32,
4681 .llseek = no_llseek, 4682 .llseek = no_llseek,
4682 .read = zoran_read, 4683 .read = zoran_read,
4683 .write = zoran_write, 4684 .write = zoran_write,
diff --git a/drivers/media/video/zr36120.c b/drivers/media/video/zr36120.c
index 07286816d7df..d4c633b8a7f5 100644
--- a/drivers/media/video/zr36120.c
+++ b/drivers/media/video/zr36120.c
@@ -1490,6 +1490,7 @@ static struct video_device zr36120_template=
1490 .write = zoran_write, 1490 .write = zoran_write,
1491 .poll = zoran_poll, 1491 .poll = zoran_poll,
1492 .ioctl = zoran_ioctl, 1492 .ioctl = zoran_ioctl,
1493 .compat_ioctl = v4l_compat_ioctl32,
1493 .mmap = zoran_mmap, 1494 .mmap = zoran_mmap,
1494 .minor = -1, 1495 .minor = -1,
1495}; 1496};