aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video')
-rw-r--r--drivers/media/video/Makefile5
-rw-r--r--drivers/media/video/arv.c14
-rw-r--r--drivers/media/video/bt8xx/bttv-driver.c30
-rw-r--r--drivers/media/video/bw-qcam.c14
-rw-r--r--drivers/media/video/c-qcam.c14
-rw-r--r--drivers/media/video/cafe_ccic.c16
-rw-r--r--drivers/media/video/cpia.c14
-rw-r--r--drivers/media/video/cpia2/cpia2_v4l.c16
-rw-r--r--drivers/media/video/cs5345.c13
-rw-r--r--drivers/media/video/cs53l32a.c2
-rw-r--r--drivers/media/video/cx18/cx18-fileops.c6
-rw-r--r--drivers/media/video/cx18/cx18-fileops.h4
-rw-r--r--drivers/media/video/cx18/cx18-i2c.c28
-rw-r--r--drivers/media/video/cx18/cx18-i2c.h1
-rw-r--r--drivers/media/video/cx18/cx18-ioctl.c49
-rw-r--r--drivers/media/video/cx18/cx18-ioctl.h2
-rw-r--r--drivers/media/video/cx18/cx18-streams.c13
-rw-r--r--drivers/media/video/cx23885/cx23885-417.c15
-rw-r--r--drivers/media/video/cx23885/cx23885-video.c22
-rw-r--r--drivers/media/video/cx25840/cx25840-core.c13
-rw-r--r--drivers/media/video/cx88/cx88-blackbird.c13
-rw-r--r--drivers/media/video/cx88/cx88-mpeg.c3
-rw-r--r--drivers/media/video/cx88/cx88-video.c27
-rw-r--r--drivers/media/video/cx88/cx88.h2
-rw-r--r--drivers/media/video/em28xx/em28xx-audio.c91
-rw-r--r--drivers/media/video/em28xx/em28xx-core.c3
-rw-r--r--drivers/media/video/em28xx/em28xx-reg.h2
-rw-r--r--drivers/media/video/em28xx/em28xx-video.c44
-rw-r--r--drivers/media/video/em28xx/em28xx.h4
-rw-r--r--drivers/media/video/et61x251/et61x251_core.c20
-rw-r--r--drivers/media/video/gspca/gspca.c12
-rw-r--r--drivers/media/video/hexium_gemini.c2
-rw-r--r--drivers/media/video/hexium_orion.c2
-rw-r--r--drivers/media/video/ivtv/ivtv-driver.c7
-rw-r--r--drivers/media/video/ivtv/ivtv-fileops.c4
-rw-r--r--drivers/media/video/ivtv/ivtv-fileops.h4
-rw-r--r--drivers/media/video/ivtv/ivtv-ioctl.c25
-rw-r--r--drivers/media/video/ivtv/ivtv-streams.c8
-rw-r--r--drivers/media/video/m52790.c13
-rw-r--r--drivers/media/video/meye.c12
-rw-r--r--drivers/media/video/msp3400-driver.c4
-rw-r--r--drivers/media/video/mt9m001.c19
-rw-r--r--drivers/media/video/mt9m111.c19
-rw-r--r--drivers/media/video/mt9t031.c18
-rw-r--r--drivers/media/video/mt9v022.c19
-rw-r--r--drivers/media/video/mxb.c2
-rw-r--r--drivers/media/video/omap24xxcam.c9
-rw-r--r--drivers/media/video/ov511.c16
-rw-r--r--drivers/media/video/ov7670.c2
-rw-r--r--drivers/media/video/ov772x.c7
-rw-r--r--drivers/media/video/pms.c14
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-hdw.c11
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-hdw.h4
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-v4l2.c29
-rw-r--r--drivers/media/video/pwc/pwc-ctrl.c4
-rw-r--r--drivers/media/video/pwc/pwc-if.c20
-rw-r--r--drivers/media/video/pwc/pwc-v4l.c2
-rw-r--r--drivers/media/video/pwc/pwc.h4
-rw-r--r--drivers/media/video/s2255drv.c12
-rw-r--r--drivers/media/video/saa5246a.c13
-rw-r--r--drivers/media/video/saa5249.c16
-rw-r--r--drivers/media/video/saa7115.c13
-rw-r--r--drivers/media/video/saa7127.c13
-rw-r--r--drivers/media/video/saa7134/saa6752hs.c2
-rw-r--r--drivers/media/video/saa7134/saa7134-cards.c44
-rw-r--r--drivers/media/video/saa7134/saa7134-dvb.c18
-rw-r--r--drivers/media/video/saa7134/saa7134-empress.c23
-rw-r--r--drivers/media/video/saa7134/saa7134-input.c1
-rw-r--r--drivers/media/video/saa7134/saa7134-video.c23
-rw-r--r--drivers/media/video/saa7134/saa7134.h1
-rw-r--r--drivers/media/video/saa717x.c9
-rw-r--r--drivers/media/video/se401.c14
-rw-r--r--drivers/media/video/sn9c102/sn9c102_core.c18
-rw-r--r--drivers/media/video/soc_camera.c13
-rw-r--r--drivers/media/video/stk-webcam.c10
-rw-r--r--drivers/media/video/stradis.c12
-rw-r--r--drivers/media/video/stv680.c14
-rw-r--r--drivers/media/video/tda9840.c2
-rw-r--r--drivers/media/video/tea6415c.c2
-rw-r--r--drivers/media/video/tea6420.c2
-rw-r--r--drivers/media/video/tuner-core.c2
-rw-r--r--drivers/media/video/tvaudio.c2
-rw-r--r--drivers/media/video/tvp5150.c13
-rw-r--r--drivers/media/video/tw9910.c6
-rw-r--r--drivers/media/video/upd64031a.c13
-rw-r--r--drivers/media/video/upd64083.c13
-rw-r--r--drivers/media/video/usbvideo/usbvideo.c20
-rw-r--r--drivers/media/video/usbvideo/vicam.c16
-rw-r--r--drivers/media/video/usbvision/usbvision-video.c37
-rw-r--r--drivers/media/video/uvc/uvc_v4l2.c14
-rw-r--r--drivers/media/video/uvc/uvcvideo.h2
-rw-r--r--drivers/media/video/v4l1-compat.c164
-rw-r--r--drivers/media/video/v4l2-common.c29
-rw-r--r--drivers/media/video/v4l2-compat-ioctl32.c27
-rw-r--r--drivers/media/video/v4l2-dev.c25
-rw-r--r--drivers/media/video/v4l2-ioctl.c36
-rw-r--r--drivers/media/video/v4l2-subdev.c2
-rw-r--r--drivers/media/video/vino.c13
-rw-r--r--drivers/media/video/vivi.c12
-rw-r--r--drivers/media/video/vp27smpx.c2
-rw-r--r--drivers/media/video/w9966.c16
-rw-r--r--drivers/media/video/w9968cf.c36
-rw-r--r--drivers/media/video/wm8739.c2
-rw-r--r--drivers/media/video/wm8775.c2
-rw-r--r--drivers/media/video/zc0301/zc0301_core.c18
-rw-r--r--drivers/media/video/zoran/zoran_driver.c25
-rw-r--r--drivers/media/video/zr364xx.c8
107 files changed, 744 insertions, 878 deletions
diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile
index 1611c33b1aee..72f6d03d2d8f 100644
--- a/drivers/media/video/Makefile
+++ b/drivers/media/video/Makefile
@@ -12,7 +12,10 @@ omap2cam-objs := omap24xxcam.o omap24xxcam-dma.o
12 12
13videodev-objs := v4l2-dev.o v4l2-ioctl.o v4l2-device.o v4l2-subdev.o 13videodev-objs := v4l2-dev.o v4l2-ioctl.o v4l2-device.o v4l2-subdev.o
14 14
15obj-$(CONFIG_VIDEO_DEV) += videodev.o v4l2-compat-ioctl32.o v4l2-int-device.o 15obj-$(CONFIG_VIDEO_DEV) += videodev.o v4l2-int-device.o
16ifeq ($(CONFIG_COMPAT),y)
17 obj-$(CONFIG_VIDEO_DEV) += v4l2-compat-ioctl32.o
18endif
16 19
17obj-$(CONFIG_VIDEO_V4L2_COMMON) += v4l2-common.o 20obj-$(CONFIG_VIDEO_V4L2_COMMON) += v4l2-common.o
18 21
diff --git a/drivers/media/video/arv.c b/drivers/media/video/arv.c
index 2ba6abd92b6f..d137bac84511 100644
--- a/drivers/media/video/arv.c
+++ b/drivers/media/video/arv.c
@@ -396,7 +396,7 @@ out_up:
396 return ret; 396 return ret;
397} 397}
398 398
399static int ar_do_ioctl(struct file *file, unsigned int cmd, void *arg) 399static long ar_do_ioctl(struct file *file, unsigned int cmd, void *arg)
400{ 400{
401 struct video_device *dev = video_devdata(file); 401 struct video_device *dev = video_devdata(file);
402 struct ar_device *ar = video_get_drvdata(dev); 402 struct ar_device *ar = video_get_drvdata(dev);
@@ -539,7 +539,7 @@ static int ar_do_ioctl(struct file *file, unsigned int cmd, void *arg)
539 return 0; 539 return 0;
540} 540}
541 541
542static int ar_ioctl(struct inode *inode, struct file *file, unsigned int cmd, 542static long ar_ioctl(struct file *file, unsigned int cmd,
543 unsigned long arg) 543 unsigned long arg)
544{ 544{
545 return video_usercopy(file, cmd, arg, ar_do_ioctl); 545 return video_usercopy(file, cmd, arg, ar_do_ioctl);
@@ -744,27 +744,23 @@ void ar_release(struct video_device *vfd)
744 ****************************************************************************/ 744 ****************************************************************************/
745static struct ar_device ardev; 745static struct ar_device ardev;
746 746
747static int ar_exclusive_open(struct inode *inode, struct file *file) 747static int ar_exclusive_open(struct file *file)
748{ 748{
749 return test_and_set_bit(0, &ardev.in_use) ? -EBUSY : 0; 749 return test_and_set_bit(0, &ardev.in_use) ? -EBUSY : 0;
750} 750}
751 751
752static int ar_exclusive_release(struct inode *inode, struct file *file) 752static int ar_exclusive_release(struct file *file)
753{ 753{
754 clear_bit(0, &ardev.in_use); 754 clear_bit(0, &ardev.in_use);
755 return 0; 755 return 0;
756} 756}
757 757
758static const struct file_operations ar_fops = { 758static const struct v4l2_file_operations ar_fops = {
759 .owner = THIS_MODULE, 759 .owner = THIS_MODULE,
760 .open = ar_exclusive_open, 760 .open = ar_exclusive_open,
761 .release = ar_exclusive_release, 761 .release = ar_exclusive_release,
762 .read = ar_read, 762 .read = ar_read,
763 .ioctl = ar_ioctl, 763 .ioctl = ar_ioctl,
764#ifdef CONFIG_COMPAT
765 .compat_ioctl = v4l_compat_ioctl32,
766#endif
767 .llseek = no_llseek,
768}; 764};
769 765
770static struct video_device ar_template = { 766static struct video_device ar_template = {
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c
index 9ec4cec2e52d..c71f394fc0ea 100644
--- a/drivers/media/video/bt8xx/bttv-driver.c
+++ b/drivers/media/video/bt8xx/bttv-driver.c
@@ -2039,7 +2039,7 @@ static int bttv_log_status(struct file *file, void *f)
2039 2039
2040#ifdef CONFIG_VIDEO_ADV_DEBUG 2040#ifdef CONFIG_VIDEO_ADV_DEBUG
2041static int bttv_g_register(struct file *file, void *f, 2041static int bttv_g_register(struct file *file, void *f,
2042 struct v4l2_register *reg) 2042 struct v4l2_dbg_register *reg)
2043{ 2043{
2044 struct bttv_fh *fh = f; 2044 struct bttv_fh *fh = f;
2045 struct bttv *btv = fh->btv; 2045 struct bttv *btv = fh->btv;
@@ -2047,18 +2047,19 @@ static int bttv_g_register(struct file *file, void *f,
2047 if (!capable(CAP_SYS_ADMIN)) 2047 if (!capable(CAP_SYS_ADMIN))
2048 return -EPERM; 2048 return -EPERM;
2049 2049
2050 if (!v4l2_chip_match_host(reg->match_type, reg->match_chip)) 2050 if (!v4l2_chip_match_host(&reg->match))
2051 return -EINVAL; 2051 return -EINVAL;
2052 2052
2053 /* bt848 has a 12-bit register space */ 2053 /* bt848 has a 12-bit register space */
2054 reg->reg &= 0xfff; 2054 reg->reg &= 0xfff;
2055 reg->val = btread(reg->reg); 2055 reg->val = btread(reg->reg);
2056 reg->size = 1;
2056 2057
2057 return 0; 2058 return 0;
2058} 2059}
2059 2060
2060static int bttv_s_register(struct file *file, void *f, 2061static int bttv_s_register(struct file *file, void *f,
2061 struct v4l2_register *reg) 2062 struct v4l2_dbg_register *reg)
2062{ 2063{
2063 struct bttv_fh *fh = f; 2064 struct bttv_fh *fh = f;
2064 struct bttv *btv = fh->btv; 2065 struct bttv *btv = fh->btv;
@@ -2066,7 +2067,7 @@ static int bttv_s_register(struct file *file, void *f,
2066 if (!capable(CAP_SYS_ADMIN)) 2067 if (!capable(CAP_SYS_ADMIN))
2067 return -EPERM; 2068 return -EPERM;
2068 2069
2069 if (!v4l2_chip_match_host(reg->match_type, reg->match_chip)) 2070 if (!v4l2_chip_match_host(&reg->match))
2070 return -EINVAL; 2071 return -EINVAL;
2071 2072
2072 /* bt848 has a 12-bit register space */ 2073 /* bt848 has a 12-bit register space */
@@ -3208,9 +3209,9 @@ err:
3208 return POLLERR; 3209 return POLLERR;
3209} 3210}
3210 3211
3211static int bttv_open(struct inode *inode, struct file *file) 3212static int bttv_open(struct file *file)
3212{ 3213{
3213 int minor = iminor(inode); 3214 int minor = video_devdata(file)->minor;
3214 struct bttv *btv = NULL; 3215 struct bttv *btv = NULL;
3215 struct bttv_fh *fh; 3216 struct bttv_fh *fh;
3216 enum v4l2_buf_type type = 0; 3217 enum v4l2_buf_type type = 0;
@@ -3291,7 +3292,7 @@ static int bttv_open(struct inode *inode, struct file *file)
3291 return 0; 3292 return 0;
3292} 3293}
3293 3294
3294static int bttv_release(struct inode *inode, struct file *file) 3295static int bttv_release(struct file *file)
3295{ 3296{
3296 struct bttv_fh *fh = file->private_data; 3297 struct bttv_fh *fh = file->private_data;
3297 struct bttv *btv = fh->btv; 3298 struct bttv *btv = fh->btv;
@@ -3346,14 +3347,12 @@ bttv_mmap(struct file *file, struct vm_area_struct *vma)
3346 return videobuf_mmap_mapper(bttv_queue(fh),vma); 3347 return videobuf_mmap_mapper(bttv_queue(fh),vma);
3347} 3348}
3348 3349
3349static const struct file_operations bttv_fops = 3350static const struct v4l2_file_operations bttv_fops =
3350{ 3351{
3351 .owner = THIS_MODULE, 3352 .owner = THIS_MODULE,
3352 .open = bttv_open, 3353 .open = bttv_open,
3353 .release = bttv_release, 3354 .release = bttv_release,
3354 .ioctl = video_ioctl2, 3355 .ioctl = video_ioctl2,
3355 .compat_ioctl = v4l_compat_ioctl32,
3356 .llseek = no_llseek,
3357 .read = bttv_read, 3356 .read = bttv_read,
3358 .mmap = bttv_mmap, 3357 .mmap = bttv_mmap,
3359 .poll = bttv_poll, 3358 .poll = bttv_poll,
@@ -3422,9 +3421,9 @@ static struct video_device bttv_video_template = {
3422/* ----------------------------------------------------------------------- */ 3421/* ----------------------------------------------------------------------- */
3423/* radio interface */ 3422/* radio interface */
3424 3423
3425static int radio_open(struct inode *inode, struct file *file) 3424static int radio_open(struct file *file)
3426{ 3425{
3427 int minor = iminor(inode); 3426 int minor = video_devdata(file)->minor;
3428 struct bttv *btv = NULL; 3427 struct bttv *btv = NULL;
3429 struct bttv_fh *fh; 3428 struct bttv_fh *fh;
3430 unsigned int i; 3429 unsigned int i;
@@ -3467,12 +3466,13 @@ static int radio_open(struct inode *inode, struct file *file)
3467 return 0; 3466 return 0;
3468} 3467}
3469 3468
3470static int radio_release(struct inode *inode, struct file *file) 3469static int radio_release(struct file *file)
3471{ 3470{
3472 struct bttv_fh *fh = file->private_data; 3471 struct bttv_fh *fh = file->private_data;
3473 struct bttv *btv = fh->btv; 3472 struct bttv *btv = fh->btv;
3474 struct rds_command cmd; 3473 struct rds_command cmd;
3475 3474
3475 v4l2_prio_close(&btv->prio,&fh->prio);
3476 file->private_data = NULL; 3476 file->private_data = NULL;
3477 kfree(fh); 3477 kfree(fh);
3478 3478
@@ -3633,15 +3633,13 @@ static unsigned int radio_poll(struct file *file, poll_table *wait)
3633 return cmd.result; 3633 return cmd.result;
3634} 3634}
3635 3635
3636static const struct file_operations radio_fops = 3636static const struct v4l2_file_operations radio_fops =
3637{ 3637{
3638 .owner = THIS_MODULE, 3638 .owner = THIS_MODULE,
3639 .open = radio_open, 3639 .open = radio_open,
3640 .read = radio_read, 3640 .read = radio_read,
3641 .release = radio_release, 3641 .release = radio_release,
3642 .compat_ioctl = v4l_compat_ioctl32,
3643 .ioctl = video_ioctl2, 3642 .ioctl = video_ioctl2,
3644 .llseek = no_llseek,
3645 .poll = radio_poll, 3643 .poll = radio_poll,
3646}; 3644};
3647 3645
diff --git a/drivers/media/video/bw-qcam.c b/drivers/media/video/bw-qcam.c
index 17f80d03f38e..10dbd4a11b30 100644
--- a/drivers/media/video/bw-qcam.c
+++ b/drivers/media/video/bw-qcam.c
@@ -706,7 +706,7 @@ static long qc_capture(struct qcam_device * q, char __user *buf, unsigned long l
706 * Video4linux interfacing 706 * Video4linux interfacing
707 */ 707 */
708 708
709static int qcam_do_ioctl(struct file *file, unsigned int cmd, void *arg) 709static long qcam_do_ioctl(struct file *file, unsigned int cmd, void *arg)
710{ 710{
711 struct video_device *dev = video_devdata(file); 711 struct video_device *dev = video_devdata(file);
712 struct qcam_device *qcam=(struct qcam_device *)dev; 712 struct qcam_device *qcam=(struct qcam_device *)dev;
@@ -863,7 +863,7 @@ static int qcam_do_ioctl(struct file *file, unsigned int cmd, void *arg)
863 return 0; 863 return 0;
864} 864}
865 865
866static int qcam_ioctl(struct inode *inode, struct file *file, 866static long qcam_ioctl(struct file *file,
867 unsigned int cmd, unsigned long arg) 867 unsigned int cmd, unsigned long arg)
868{ 868{
869 return video_usercopy(file, cmd, arg, qcam_do_ioctl); 869 return video_usercopy(file, cmd, arg, qcam_do_ioctl);
@@ -893,7 +893,7 @@ static ssize_t qcam_read(struct file *file, char __user *buf,
893 return len; 893 return len;
894} 894}
895 895
896static int qcam_exclusive_open(struct inode *inode, struct file *file) 896static int qcam_exclusive_open(struct file *file)
897{ 897{
898 struct video_device *dev = video_devdata(file); 898 struct video_device *dev = video_devdata(file);
899 struct qcam_device *qcam = (struct qcam_device *)dev; 899 struct qcam_device *qcam = (struct qcam_device *)dev;
@@ -901,7 +901,7 @@ static int qcam_exclusive_open(struct inode *inode, struct file *file)
901 return test_and_set_bit(0, &qcam->in_use) ? -EBUSY : 0; 901 return test_and_set_bit(0, &qcam->in_use) ? -EBUSY : 0;
902} 902}
903 903
904static int qcam_exclusive_release(struct inode *inode, struct file *file) 904static int qcam_exclusive_release(struct file *file)
905{ 905{
906 struct video_device *dev = video_devdata(file); 906 struct video_device *dev = video_devdata(file);
907 struct qcam_device *qcam = (struct qcam_device *)dev; 907 struct qcam_device *qcam = (struct qcam_device *)dev;
@@ -910,16 +910,12 @@ static int qcam_exclusive_release(struct inode *inode, struct file *file)
910 return 0; 910 return 0;
911} 911}
912 912
913static const struct file_operations qcam_fops = { 913static const struct v4l2_file_operations qcam_fops = {
914 .owner = THIS_MODULE, 914 .owner = THIS_MODULE,
915 .open = qcam_exclusive_open, 915 .open = qcam_exclusive_open,
916 .release = qcam_exclusive_release, 916 .release = qcam_exclusive_release,
917 .ioctl = qcam_ioctl, 917 .ioctl = qcam_ioctl,
918#ifdef CONFIG_COMPAT
919 .compat_ioctl = v4l_compat_ioctl32,
920#endif
921 .read = qcam_read, 918 .read = qcam_read,
922 .llseek = no_llseek,
923}; 919};
924static struct video_device qcam_template= 920static struct video_device qcam_template=
925{ 921{
diff --git a/drivers/media/video/c-qcam.c b/drivers/media/video/c-qcam.c
index 21c71eb085db..85cf1778827a 100644
--- a/drivers/media/video/c-qcam.c
+++ b/drivers/media/video/c-qcam.c
@@ -500,7 +500,7 @@ static long qc_capture(struct qcam_device *q, char __user *buf, unsigned long le
500 * Video4linux interfacing 500 * Video4linux interfacing
501 */ 501 */
502 502
503static int qcam_do_ioctl(struct file *file, unsigned int cmd, void *arg) 503static long qcam_do_ioctl(struct file *file, unsigned int cmd, void *arg)
504{ 504{
505 struct video_device *dev = video_devdata(file); 505 struct video_device *dev = video_devdata(file);
506 struct qcam_device *qcam=(struct qcam_device *)dev; 506 struct qcam_device *qcam=(struct qcam_device *)dev;
@@ -665,7 +665,7 @@ static int qcam_do_ioctl(struct file *file, unsigned int cmd, void *arg)
665 return 0; 665 return 0;
666} 666}
667 667
668static int qcam_ioctl(struct inode *inode, struct file *file, 668static long qcam_ioctl(struct file *file,
669 unsigned int cmd, unsigned long arg) 669 unsigned int cmd, unsigned long arg)
670{ 670{
671 return video_usercopy(file, cmd, arg, qcam_do_ioctl); 671 return video_usercopy(file, cmd, arg, qcam_do_ioctl);
@@ -687,7 +687,7 @@ static ssize_t qcam_read(struct file *file, char __user *buf,
687 return len; 687 return len;
688} 688}
689 689
690static int qcam_exclusive_open(struct inode *inode, struct file *file) 690static int qcam_exclusive_open(struct file *file)
691{ 691{
692 struct video_device *dev = video_devdata(file); 692 struct video_device *dev = video_devdata(file);
693 struct qcam_device *qcam = (struct qcam_device *)dev; 693 struct qcam_device *qcam = (struct qcam_device *)dev;
@@ -695,7 +695,7 @@ static int qcam_exclusive_open(struct inode *inode, struct file *file)
695 return test_and_set_bit(0, &qcam->in_use) ? -EBUSY : 0; 695 return test_and_set_bit(0, &qcam->in_use) ? -EBUSY : 0;
696} 696}
697 697
698static int qcam_exclusive_release(struct inode *inode, struct file *file) 698static int qcam_exclusive_release(struct file *file)
699{ 699{
700 struct video_device *dev = video_devdata(file); 700 struct video_device *dev = video_devdata(file);
701 struct qcam_device *qcam = (struct qcam_device *)dev; 701 struct qcam_device *qcam = (struct qcam_device *)dev;
@@ -705,16 +705,12 @@ static int qcam_exclusive_release(struct inode *inode, struct file *file)
705} 705}
706 706
707/* video device template */ 707/* video device template */
708static const struct file_operations qcam_fops = { 708static const struct v4l2_file_operations qcam_fops = {
709 .owner = THIS_MODULE, 709 .owner = THIS_MODULE,
710 .open = qcam_exclusive_open, 710 .open = qcam_exclusive_open,
711 .release = qcam_exclusive_release, 711 .release = qcam_exclusive_release,
712 .ioctl = qcam_ioctl, 712 .ioctl = qcam_ioctl,
713#ifdef CONFIG_COMPAT
714 .compat_ioctl = v4l_compat_ioctl32,
715#endif
716 .read = qcam_read, 713 .read = qcam_read,
717 .llseek = no_llseek,
718}; 714};
719 715
720static struct video_device qcam_template= 716static struct video_device qcam_template=
diff --git a/drivers/media/video/cafe_ccic.c b/drivers/media/video/cafe_ccic.c
index 1740b9ebdcef..34a39d2e4703 100644
--- a/drivers/media/video/cafe_ccic.c
+++ b/drivers/media/video/cafe_ccic.c
@@ -859,7 +859,7 @@ static int __cafe_cam_reset(struct cafe_camera *cam)
859 */ 859 */
860static int cafe_cam_init(struct cafe_camera *cam) 860static int cafe_cam_init(struct cafe_camera *cam)
861{ 861{
862 struct v4l2_chip_ident chip = { V4L2_CHIP_MATCH_I2C_ADDR, 0, 0, 0 }; 862 struct v4l2_dbg_chip_ident chip;
863 int ret; 863 int ret;
864 864
865 mutex_lock(&cam->s_mutex); 865 mutex_lock(&cam->s_mutex);
@@ -869,8 +869,9 @@ static int cafe_cam_init(struct cafe_camera *cam)
869 ret = __cafe_cam_reset(cam); 869 ret = __cafe_cam_reset(cam);
870 if (ret) 870 if (ret)
871 goto out; 871 goto out;
872 chip.match_chip = cam->sensor->addr; 872 chip.match.type = V4L2_CHIP_MATCH_I2C_ADDR;
873 ret = __cafe_cam_cmd(cam, VIDIOC_G_CHIP_IDENT, &chip); 873 chip.match.addr = cam->sensor->addr;
874 ret = __cafe_cam_cmd(cam, VIDIOC_DBG_G_CHIP_IDENT, &chip);
874 if (ret) 875 if (ret)
875 goto out; 876 goto out;
876 cam->sensor_type = chip.ident; 877 cam->sensor_type = chip.ident;
@@ -1472,11 +1473,11 @@ static int cafe_v4l_mmap(struct file *filp, struct vm_area_struct *vma)
1472 1473
1473 1474
1474 1475
1475static int cafe_v4l_open(struct inode *inode, struct file *filp) 1476static int cafe_v4l_open(struct file *filp)
1476{ 1477{
1477 struct cafe_camera *cam; 1478 struct cafe_camera *cam;
1478 1479
1479 cam = cafe_find_dev(iminor(inode)); 1480 cam = cafe_find_dev(video_devdata(filp)->minor);
1480 if (cam == NULL) 1481 if (cam == NULL)
1481 return -ENODEV; 1482 return -ENODEV;
1482 filp->private_data = cam; 1483 filp->private_data = cam;
@@ -1494,7 +1495,7 @@ static int cafe_v4l_open(struct inode *inode, struct file *filp)
1494} 1495}
1495 1496
1496 1497
1497static int cafe_v4l_release(struct inode *inode, struct file *filp) 1498static int cafe_v4l_release(struct file *filp)
1498{ 1499{
1499 struct cafe_camera *cam = filp->private_data; 1500 struct cafe_camera *cam = filp->private_data;
1500 1501
@@ -1759,7 +1760,7 @@ static void cafe_v4l_dev_release(struct video_device *vd)
1759 * clone it for specific real devices. 1760 * clone it for specific real devices.
1760 */ 1761 */
1761 1762
1762static const struct file_operations cafe_v4l_fops = { 1763static const struct v4l2_file_operations cafe_v4l_fops = {
1763 .owner = THIS_MODULE, 1764 .owner = THIS_MODULE,
1764 .open = cafe_v4l_open, 1765 .open = cafe_v4l_open,
1765 .release = cafe_v4l_release, 1766 .release = cafe_v4l_release,
@@ -1767,7 +1768,6 @@ static const struct file_operations cafe_v4l_fops = {
1767 .poll = cafe_v4l_poll, 1768 .poll = cafe_v4l_poll,
1768 .mmap = cafe_v4l_mmap, 1769 .mmap = cafe_v4l_mmap,
1769 .ioctl = video_ioctl2, 1770 .ioctl = video_ioctl2,
1770 .llseek = no_llseek,
1771}; 1771};
1772 1772
1773static const struct v4l2_ioctl_ops cafe_v4l_ioctl_ops = { 1773static const struct v4l2_ioctl_ops cafe_v4l_ioctl_ops = {
diff --git a/drivers/media/video/cpia.c b/drivers/media/video/cpia.c
index 028a400d2453..c3b0c8c63c76 100644
--- a/drivers/media/video/cpia.c
+++ b/drivers/media/video/cpia.c
@@ -3148,7 +3148,7 @@ static void put_cam(struct cpia_camera_ops* ops)
3148} 3148}
3149 3149
3150/* ------------------------- V4L interface --------------------- */ 3150/* ------------------------- V4L interface --------------------- */
3151static int cpia_open(struct inode *inode, struct file *file) 3151static int cpia_open(struct file *file)
3152{ 3152{
3153 struct video_device *dev = video_devdata(file); 3153 struct video_device *dev = video_devdata(file);
3154 struct cam_data *cam = video_get_drvdata(dev); 3154 struct cam_data *cam = video_get_drvdata(dev);
@@ -3225,7 +3225,7 @@ static int cpia_open(struct inode *inode, struct file *file)
3225 return err; 3225 return err;
3226} 3226}
3227 3227
3228static int cpia_close(struct inode *inode, struct file *file) 3228static int cpia_close(struct file *file)
3229{ 3229{
3230 struct video_device *dev = file->private_data; 3230 struct video_device *dev = file->private_data;
3231 struct cam_data *cam = video_get_drvdata(dev); 3231 struct cam_data *cam = video_get_drvdata(dev);
@@ -3333,7 +3333,7 @@ static ssize_t cpia_read(struct file *file, char __user *buf,
3333 return cam->decompressed_frame.count; 3333 return cam->decompressed_frame.count;
3334} 3334}
3335 3335
3336static int cpia_do_ioctl(struct file *file, unsigned int cmd, void *arg) 3336static long cpia_do_ioctl(struct file *file, unsigned int cmd, void *arg)
3337{ 3337{
3338 struct video_device *dev = file->private_data; 3338 struct video_device *dev = file->private_data;
3339 struct cam_data *cam = video_get_drvdata(dev); 3339 struct cam_data *cam = video_get_drvdata(dev);
@@ -3720,7 +3720,7 @@ static int cpia_do_ioctl(struct file *file, unsigned int cmd, void *arg)
3720 return retval; 3720 return retval;
3721} 3721}
3722 3722
3723static int cpia_ioctl(struct inode *inode, struct file *file, 3723static long cpia_ioctl(struct file *file,
3724 unsigned int cmd, unsigned long arg) 3724 unsigned int cmd, unsigned long arg)
3725{ 3725{
3726 return video_usercopy(file, cmd, arg, cpia_do_ioctl); 3726 return video_usercopy(file, cmd, arg, cpia_do_ioctl);
@@ -3780,17 +3780,13 @@ static int cpia_mmap(struct file *file, struct vm_area_struct *vma)
3780 return 0; 3780 return 0;
3781} 3781}
3782 3782
3783static const struct file_operations cpia_fops = { 3783static const struct v4l2_file_operations cpia_fops = {
3784 .owner = THIS_MODULE, 3784 .owner = THIS_MODULE,
3785 .open = cpia_open, 3785 .open = cpia_open,
3786 .release = cpia_close, 3786 .release = cpia_close,
3787 .read = cpia_read, 3787 .read = cpia_read,
3788 .mmap = cpia_mmap, 3788 .mmap = cpia_mmap,
3789 .ioctl = cpia_ioctl, 3789 .ioctl = cpia_ioctl,
3790#ifdef CONFIG_COMPAT
3791 .compat_ioctl = v4l_compat_ioctl32,
3792#endif
3793 .llseek = no_llseek,
3794}; 3790};
3795 3791
3796static struct video_device cpia_template = { 3792static struct video_device cpia_template = {
diff --git a/drivers/media/video/cpia2/cpia2_v4l.c b/drivers/media/video/cpia2/cpia2_v4l.c
index 3c2d7eac1197..9c25894fdd8e 100644
--- a/drivers/media/video/cpia2/cpia2_v4l.c
+++ b/drivers/media/video/cpia2/cpia2_v4l.c
@@ -239,7 +239,7 @@ static struct v4l2_queryctrl controls[] = {
239 * cpia2_open 239 * cpia2_open
240 * 240 *
241 *****************************************************************************/ 241 *****************************************************************************/
242static int cpia2_open(struct inode *inode, struct file *file) 242static int cpia2_open(struct file *file)
243{ 243{
244 struct camera_data *cam = video_drvdata(file); 244 struct camera_data *cam = video_drvdata(file);
245 int retval = 0; 245 int retval = 0;
@@ -302,7 +302,7 @@ err_return:
302 * cpia2_close 302 * cpia2_close
303 * 303 *
304 *****************************************************************************/ 304 *****************************************************************************/
305static int cpia2_close(struct inode *inode, struct file *file) 305static int cpia2_close(struct file *file)
306{ 306{
307 struct video_device *dev = video_devdata(file); 307 struct video_device *dev = video_devdata(file);
308 struct camera_data *cam = video_get_drvdata(dev); 308 struct camera_data *cam = video_get_drvdata(dev);
@@ -1572,10 +1572,10 @@ static int ioctl_dqbuf(void *arg,struct camera_data *cam, struct file *file)
1572 * cpia2_ioctl 1572 * cpia2_ioctl
1573 * 1573 *
1574 *****************************************************************************/ 1574 *****************************************************************************/
1575static int cpia2_do_ioctl(struct file *file, unsigned int cmd, void *arg) 1575static long cpia2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
1576{ 1576{
1577 struct camera_data *cam = video_drvdata(file); 1577 struct camera_data *cam = video_drvdata(file);
1578 int retval = 0; 1578 long retval = 0;
1579 1579
1580 if (!cam) 1580 if (!cam)
1581 return -ENOTTY; 1581 return -ENOTTY;
@@ -1841,7 +1841,7 @@ static int cpia2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
1841 return retval; 1841 return retval;
1842} 1842}
1843 1843
1844static int cpia2_ioctl(struct inode *inode, struct file *file, 1844static long cpia2_ioctl(struct file *file,
1845 unsigned int cmd, unsigned long arg) 1845 unsigned int cmd, unsigned long arg)
1846{ 1846{
1847 return video_usercopy(file, cmd, arg, cpia2_do_ioctl); 1847 return video_usercopy(file, cmd, arg, cpia2_do_ioctl);
@@ -1912,17 +1912,13 @@ static void reset_camera_struct_v4l(struct camera_data *cam)
1912/*** 1912/***
1913 * The v4l video device structure initialized for this device 1913 * The v4l video device structure initialized for this device
1914 ***/ 1914 ***/
1915static const struct file_operations fops_template = { 1915static const struct v4l2_file_operations fops_template = {
1916 .owner = THIS_MODULE, 1916 .owner = THIS_MODULE,
1917 .open = cpia2_open, 1917 .open = cpia2_open,
1918 .release = cpia2_close, 1918 .release = cpia2_close,
1919 .read = cpia2_v4l_read, 1919 .read = cpia2_v4l_read,
1920 .poll = cpia2_v4l_poll, 1920 .poll = cpia2_v4l_poll,
1921 .ioctl = cpia2_ioctl, 1921 .ioctl = cpia2_ioctl,
1922 .llseek = no_llseek,
1923#ifdef CONFIG_COMPAT
1924 .compat_ioctl = v4l_compat_ioctl32,
1925#endif
1926 .mmap = cpia2_mmap, 1922 .mmap = cpia2_mmap,
1927}; 1923};
1928 1924
diff --git a/drivers/media/video/cs5345.c b/drivers/media/video/cs5345.c
index 70fcd0d5de13..14bebf8a116f 100644
--- a/drivers/media/video/cs5345.c
+++ b/drivers/media/video/cs5345.c
@@ -95,25 +95,24 @@ static int cs5345_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
95} 95}
96 96
97#ifdef CONFIG_VIDEO_ADV_DEBUG 97#ifdef CONFIG_VIDEO_ADV_DEBUG
98static int cs5345_g_register(struct v4l2_subdev *sd, struct v4l2_register *reg) 98static int cs5345_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg)
99{ 99{
100 struct i2c_client *client = v4l2_get_subdevdata(sd); 100 struct i2c_client *client = v4l2_get_subdevdata(sd);
101 101
102 if (!v4l2_chip_match_i2c_client(client, 102 if (!v4l2_chip_match_i2c_client(client, &reg->match))
103 reg->match_type, reg->match_chip))
104 return -EINVAL; 103 return -EINVAL;
105 if (!capable(CAP_SYS_ADMIN)) 104 if (!capable(CAP_SYS_ADMIN))
106 return -EPERM; 105 return -EPERM;
106 reg->size = 1;
107 reg->val = cs5345_read(sd, reg->reg & 0x1f); 107 reg->val = cs5345_read(sd, reg->reg & 0x1f);
108 return 0; 108 return 0;
109} 109}
110 110
111static int cs5345_s_register(struct v4l2_subdev *sd, struct v4l2_register *reg) 111static int cs5345_s_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg)
112{ 112{
113 struct i2c_client *client = v4l2_get_subdevdata(sd); 113 struct i2c_client *client = v4l2_get_subdevdata(sd);
114 114
115 if (!v4l2_chip_match_i2c_client(client, 115 if (!v4l2_chip_match_i2c_client(client, &reg->match))
116 reg->match_type, reg->match_chip))
117 return -EINVAL; 116 return -EINVAL;
118 if (!capable(CAP_SYS_ADMIN)) 117 if (!capable(CAP_SYS_ADMIN))
119 return -EPERM; 118 return -EPERM;
@@ -122,7 +121,7 @@ static int cs5345_s_register(struct v4l2_subdev *sd, struct v4l2_register *reg)
122} 121}
123#endif 122#endif
124 123
125static int cs5345_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_chip_ident *chip) 124static int cs5345_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip)
126{ 125{
127 struct i2c_client *client = v4l2_get_subdevdata(sd); 126 struct i2c_client *client = v4l2_get_subdevdata(sd);
128 127
diff --git a/drivers/media/video/cs53l32a.c b/drivers/media/video/cs53l32a.c
index cb65d519cf78..7292a6316e63 100644
--- a/drivers/media/video/cs53l32a.c
+++ b/drivers/media/video/cs53l32a.c
@@ -102,7 +102,7 @@ static int cs53l32a_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
102 return 0; 102 return 0;
103} 103}
104 104
105static int cs53l32a_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_chip_ident *chip) 105static int cs53l32a_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip)
106{ 106{
107 struct i2c_client *client = v4l2_get_subdevdata(sd); 107 struct i2c_client *client = v4l2_get_subdevdata(sd);
108 108
diff --git a/drivers/media/video/cx18/cx18-fileops.c b/drivers/media/video/cx18/cx18-fileops.c
index 425271a29517..055f6e004b2d 100644
--- a/drivers/media/video/cx18/cx18-fileops.c
+++ b/drivers/media/video/cx18/cx18-fileops.c
@@ -552,7 +552,7 @@ void cx18_stop_capture(struct cx18_open_id *id, int gop_end)
552 } 552 }
553} 553}
554 554
555int cx18_v4l2_close(struct inode *inode, struct file *filp) 555int cx18_v4l2_close(struct file *filp)
556{ 556{
557 struct cx18_open_id *id = filp->private_data; 557 struct cx18_open_id *id = filp->private_data;
558 struct cx18 *cx = id->cx; 558 struct cx18 *cx = id->cx;
@@ -650,12 +650,12 @@ static int cx18_serialized_open(struct cx18_stream *s, struct file *filp)
650 return 0; 650 return 0;
651} 651}
652 652
653int cx18_v4l2_open(struct inode *inode, struct file *filp) 653int cx18_v4l2_open(struct file *filp)
654{ 654{
655 int res, x, y = 0; 655 int res, x, y = 0;
656 struct cx18 *cx = NULL; 656 struct cx18 *cx = NULL;
657 struct cx18_stream *s = NULL; 657 struct cx18_stream *s = NULL;
658 int minor = iminor(inode); 658 int minor = video_devdata(filp)->minor;
659 659
660 /* Find which card this open was on */ 660 /* Find which card this open was on */
661 spin_lock(&cx18_cards_lock); 661 spin_lock(&cx18_cards_lock);
diff --git a/drivers/media/video/cx18/cx18-fileops.h b/drivers/media/video/cx18/cx18-fileops.h
index 46da0282fc7d..92e2d5dab936 100644
--- a/drivers/media/video/cx18/cx18-fileops.h
+++ b/drivers/media/video/cx18/cx18-fileops.h
@@ -22,12 +22,12 @@
22 */ 22 */
23 23
24/* Testing/Debugging */ 24/* Testing/Debugging */
25int cx18_v4l2_open(struct inode *inode, struct file *filp); 25int cx18_v4l2_open(struct file *filp);
26ssize_t cx18_v4l2_read(struct file *filp, char __user *buf, size_t count, 26ssize_t cx18_v4l2_read(struct file *filp, char __user *buf, size_t count,
27 loff_t *pos); 27 loff_t *pos);
28ssize_t cx18_v4l2_write(struct file *filp, const char __user *buf, size_t count, 28ssize_t cx18_v4l2_write(struct file *filp, const char __user *buf, size_t count,
29 loff_t *pos); 29 loff_t *pos);
30int cx18_v4l2_close(struct inode *inode, struct file *filp); 30int cx18_v4l2_close(struct file *filp);
31unsigned int cx18_v4l2_enc_poll(struct file *filp, poll_table *wait); 31unsigned int cx18_v4l2_enc_poll(struct file *filp, poll_table *wait);
32int cx18_start_capture(struct cx18_open_id *id); 32int cx18_start_capture(struct cx18_open_id *id);
33void cx18_stop_capture(struct cx18_open_id *id, int gop_end); 33void cx18_stop_capture(struct cx18_open_id *id, int gop_end);
diff --git a/drivers/media/video/cx18/cx18-i2c.c b/drivers/media/video/cx18/cx18-i2c.c
index 8941f58bed7f..83e1c6333126 100644
--- a/drivers/media/video/cx18/cx18-i2c.c
+++ b/drivers/media/video/cx18/cx18-i2c.c
@@ -242,7 +242,7 @@ int cx18_call_i2c_client(struct cx18 *cx, int addr, unsigned cmd, void *arg)
242 return retval; 242 return retval;
243 } 243 }
244 } 244 }
245 if (cmd != VIDIOC_G_CHIP_IDENT) 245 if (cmd != VIDIOC_DBG_G_CHIP_IDENT)
246 CX18_ERR("i2c addr 0x%02x not found for cmd 0x%x!\n", 246 CX18_ERR("i2c addr 0x%02x not found for cmd 0x%x!\n",
247 addr, cmd); 247 addr, cmd);
248 return -ENODEV; 248 return -ENODEV;
@@ -268,17 +268,6 @@ static int cx18_i2c_id_addr(struct cx18 *cx, u32 id)
268 return retval; 268 return retval;
269} 269}
270 270
271/* Find the i2c device name matching the DRIVERID */
272static const char *cx18_i2c_id_name(u32 id)
273{
274 int i;
275
276 for (i = 0; i < ARRAY_SIZE(hw_driverids); i++)
277 if (hw_driverids[i] == id)
278 return hw_devicenames[i];
279 return "unknown device";
280}
281
282/* Find the i2c device name matching the CX18_HW_ flag */ 271/* Find the i2c device name matching the CX18_HW_ flag */
283static const char *cx18_i2c_hw_name(u32 hw) 272static const char *cx18_i2c_hw_name(u32 hw)
284{ 273{
@@ -326,21 +315,6 @@ int cx18_i2c_hw(struct cx18 *cx, u32 hw, unsigned int cmd, void *arg)
326 return cx18_call_i2c_client(cx, addr, cmd, arg); 315 return cx18_call_i2c_client(cx, addr, cmd, arg);
327} 316}
328 317
329/* Calls i2c device based on I2C driver ID. */
330int cx18_i2c_id(struct cx18 *cx, u32 id, unsigned int cmd, void *arg)
331{
332 int addr;
333
334 addr = cx18_i2c_id_addr(cx, id);
335 if (addr < 0) {
336 if (cmd != VIDIOC_G_CHIP_IDENT)
337 CX18_ERR("i2c ID 0x%08x (%s) not found for cmd 0x%x!\n",
338 id, cx18_i2c_id_name(id), cmd);
339 return addr;
340 }
341 return cx18_call_i2c_client(cx, addr, cmd, arg);
342}
343
344/* broadcast cmd for all I2C clients and for the gpio subsystem */ 318/* broadcast cmd for all I2C clients and for the gpio subsystem */
345void cx18_call_i2c_clients(struct cx18 *cx, unsigned int cmd, void *arg) 319void cx18_call_i2c_clients(struct cx18 *cx, unsigned int cmd, void *arg)
346{ 320{
diff --git a/drivers/media/video/cx18/cx18-i2c.h b/drivers/media/video/cx18/cx18-i2c.h
index 113c3f9a2cc0..4869739013bd 100644
--- a/drivers/media/video/cx18/cx18-i2c.h
+++ b/drivers/media/video/cx18/cx18-i2c.h
@@ -23,7 +23,6 @@
23 23
24int cx18_i2c_hw_addr(struct cx18 *cx, u32 hw); 24int cx18_i2c_hw_addr(struct cx18 *cx, u32 hw);
25int cx18_i2c_hw(struct cx18 *cx, u32 hw, unsigned int cmd, void *arg); 25int cx18_i2c_hw(struct cx18 *cx, u32 hw, unsigned int cmd, void *arg);
26int cx18_i2c_id(struct cx18 *cx, u32 id, unsigned int cmd, void *arg);
27int cx18_call_i2c_client(struct cx18 *cx, int addr, unsigned cmd, void *arg); 26int cx18_call_i2c_client(struct cx18 *cx, int addr, unsigned cmd, void *arg);
28void cx18_call_i2c_clients(struct cx18 *cx, unsigned int cmd, void *arg); 27void cx18_call_i2c_clients(struct cx18 *cx, unsigned int cmd, void *arg);
29int cx18_i2c_register(struct cx18 *cx, unsigned idx); 28int cx18_i2c_register(struct cx18 *cx, unsigned idx);
diff --git a/drivers/media/video/cx18/cx18-ioctl.c b/drivers/media/video/cx18/cx18-ioctl.c
index e6087486f889..7086aaba77d6 100644
--- a/drivers/media/video/cx18/cx18-ioctl.c
+++ b/drivers/media/video/cx18/cx18-ioctl.c
@@ -254,30 +254,24 @@ static int cx18_s_fmt_sliced_vbi_cap(struct file *file, void *fh,
254} 254}
255 255
256static int cx18_g_chip_ident(struct file *file, void *fh, 256static int cx18_g_chip_ident(struct file *file, void *fh,
257 struct v4l2_chip_ident *chip) 257 struct v4l2_dbg_chip_ident *chip)
258{ 258{
259 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; 259 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
260 260
261 chip->ident = V4L2_IDENT_NONE; 261 chip->ident = V4L2_IDENT_NONE;
262 chip->revision = 0; 262 chip->revision = 0;
263 if (chip->match_type == V4L2_CHIP_MATCH_HOST) { 263 if (v4l2_chip_match_host(&chip->match)) {
264 if (v4l2_chip_match_host(chip->match_type, chip->match_chip)) 264 chip->ident = V4L2_IDENT_CX23418;
265 chip->ident = V4L2_IDENT_CX23418;
266 return 0; 265 return 0;
267 } 266 }
268 if (chip->match_type == V4L2_CHIP_MATCH_I2C_DRIVER) 267 cx18_call_i2c_clients(cx, VIDIOC_DBG_G_CHIP_IDENT, chip);
269 return cx18_i2c_id(cx, chip->match_chip, VIDIOC_G_CHIP_IDENT, 268 return 0;
270 chip);
271 if (chip->match_type == V4L2_CHIP_MATCH_I2C_ADDR)
272 return cx18_call_i2c_client(cx, chip->match_chip,
273 VIDIOC_G_CHIP_IDENT, chip);
274 return -EINVAL;
275} 269}
276 270
277#ifdef CONFIG_VIDEO_ADV_DEBUG 271#ifdef CONFIG_VIDEO_ADV_DEBUG
278static int cx18_cxc(struct cx18 *cx, unsigned int cmd, void *arg) 272static int cx18_cxc(struct cx18 *cx, unsigned int cmd, void *arg)
279{ 273{
280 struct v4l2_register *regs = arg; 274 struct v4l2_dbg_register *regs = arg;
281 unsigned long flags; 275 unsigned long flags;
282 276
283 if (!capable(CAP_SYS_ADMIN)) 277 if (!capable(CAP_SYS_ADMIN))
@@ -286,6 +280,7 @@ static int cx18_cxc(struct cx18 *cx, unsigned int cmd, void *arg)
286 return -EINVAL; 280 return -EINVAL;
287 281
288 spin_lock_irqsave(&cx18_cards_lock, flags); 282 spin_lock_irqsave(&cx18_cards_lock, flags);
283 regs->size = 4;
289 if (cmd == VIDIOC_DBG_G_REGISTER) 284 if (cmd == VIDIOC_DBG_G_REGISTER)
290 regs->val = cx18_read_enc(cx, regs->reg); 285 regs->val = cx18_read_enc(cx, regs->reg);
291 else 286 else
@@ -295,31 +290,25 @@ static int cx18_cxc(struct cx18 *cx, unsigned int cmd, void *arg)
295} 290}
296 291
297static int cx18_g_register(struct file *file, void *fh, 292static int cx18_g_register(struct file *file, void *fh,
298 struct v4l2_register *reg) 293 struct v4l2_dbg_register *reg)
299{ 294{
300 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; 295 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
301 296
302 if (v4l2_chip_match_host(reg->match_type, reg->match_chip)) 297 if (v4l2_chip_match_host(&reg->match))
303 return cx18_cxc(cx, VIDIOC_DBG_G_REGISTER, reg); 298 return cx18_cxc(cx, VIDIOC_DBG_G_REGISTER, reg);
304 if (reg->match_type == V4L2_CHIP_MATCH_I2C_DRIVER) 299 cx18_call_i2c_clients(cx, VIDIOC_DBG_G_REGISTER, reg);
305 return cx18_i2c_id(cx, reg->match_chip, VIDIOC_DBG_G_REGISTER, 300 return 0;
306 reg);
307 return cx18_call_i2c_client(cx, reg->match_chip, VIDIOC_DBG_G_REGISTER,
308 reg);
309} 301}
310 302
311static int cx18_s_register(struct file *file, void *fh, 303static int cx18_s_register(struct file *file, void *fh,
312 struct v4l2_register *reg) 304 struct v4l2_dbg_register *reg)
313{ 305{
314 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; 306 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
315 307
316 if (v4l2_chip_match_host(reg->match_type, reg->match_chip)) 308 if (v4l2_chip_match_host(&reg->match))
317 return cx18_cxc(cx, VIDIOC_DBG_S_REGISTER, reg); 309 return cx18_cxc(cx, VIDIOC_DBG_S_REGISTER, reg);
318 if (reg->match_type == V4L2_CHIP_MATCH_I2C_DRIVER) 310 cx18_call_i2c_clients(cx, VIDIOC_DBG_S_REGISTER, reg);
319 return cx18_i2c_id(cx, reg->match_chip, VIDIOC_DBG_S_REGISTER, 311 return 0;
320 reg);
321 return cx18_call_i2c_client(cx, reg->match_chip, VIDIOC_DBG_S_REGISTER,
322 reg);
323} 312}
324#endif 313#endif
325 314
@@ -755,7 +744,7 @@ static int cx18_log_status(struct file *file, void *fh)
755 return 0; 744 return 0;
756} 745}
757 746
758static int cx18_default(struct file *file, void *fh, int cmd, void *arg) 747static long cx18_default(struct file *file, void *fh, int cmd, void *arg)
759{ 748{
760 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; 749 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
761 750
@@ -783,19 +772,19 @@ static int cx18_default(struct file *file, void *fh, int cmd, void *arg)
783 return 0; 772 return 0;
784} 773}
785 774
786int cx18_v4l2_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, 775long cx18_v4l2_ioctl(struct file *filp, unsigned int cmd,
787 unsigned long arg) 776 unsigned long arg)
788{ 777{
789 struct video_device *vfd = video_devdata(filp); 778 struct video_device *vfd = video_devdata(filp);
790 struct cx18_open_id *id = (struct cx18_open_id *)filp->private_data; 779 struct cx18_open_id *id = (struct cx18_open_id *)filp->private_data;
791 struct cx18 *cx = id->cx; 780 struct cx18 *cx = id->cx;
792 int res; 781 long res;
793 782
794 mutex_lock(&cx->serialize_lock); 783 mutex_lock(&cx->serialize_lock);
795 784
796 if (cx18_debug & CX18_DBGFLG_IOCTL) 785 if (cx18_debug & CX18_DBGFLG_IOCTL)
797 vfd->debug = V4L2_DEBUG_IOCTL | V4L2_DEBUG_IOCTL_ARG; 786 vfd->debug = V4L2_DEBUG_IOCTL | V4L2_DEBUG_IOCTL_ARG;
798 res = video_ioctl2(inode, filp, cmd, arg); 787 res = video_ioctl2(filp, cmd, arg);
799 vfd->debug = 0; 788 vfd->debug = 0;
800 mutex_unlock(&cx->serialize_lock); 789 mutex_unlock(&cx->serialize_lock);
801 return res; 790 return res;
diff --git a/drivers/media/video/cx18/cx18-ioctl.h b/drivers/media/video/cx18/cx18-ioctl.h
index 08fe24e9510e..e2ca0d152116 100644
--- a/drivers/media/video/cx18/cx18-ioctl.h
+++ b/drivers/media/video/cx18/cx18-ioctl.h
@@ -29,5 +29,5 @@ void cx18_set_funcs(struct video_device *vdev);
29int cx18_s_std(struct file *file, void *fh, v4l2_std_id *std); 29int cx18_s_std(struct file *file, void *fh, v4l2_std_id *std);
30int cx18_s_frequency(struct file *file, void *fh, struct v4l2_frequency *vf); 30int cx18_s_frequency(struct file *file, void *fh, struct v4l2_frequency *vf);
31int cx18_s_input(struct file *file, void *fh, unsigned int inp); 31int cx18_s_input(struct file *file, void *fh, unsigned int inp);
32int cx18_v4l2_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, 32long cx18_v4l2_ioctl(struct file *filp, unsigned int cmd,
33 unsigned long arg); 33 unsigned long arg);
diff --git a/drivers/media/video/cx18/cx18-streams.c b/drivers/media/video/cx18/cx18-streams.c
index 63c336c95ff5..89c1ec94f335 100644
--- a/drivers/media/video/cx18/cx18-streams.c
+++ b/drivers/media/video/cx18/cx18-streams.c
@@ -37,13 +37,12 @@
37 37
38#define CX18_DSP0_INTERRUPT_MASK 0xd0004C 38#define CX18_DSP0_INTERRUPT_MASK 0xd0004C
39 39
40static struct file_operations cx18_v4l2_enc_fops = { 40static struct v4l2_file_operations cx18_v4l2_enc_fops = {
41 .owner = THIS_MODULE, 41 .owner = THIS_MODULE,
42 .read = cx18_v4l2_read, 42 .read = cx18_v4l2_read,
43 .open = cx18_v4l2_open, 43 .open = cx18_v4l2_open,
44 /* FIXME change to video_ioctl2 if serialization lock can be removed */ 44 /* FIXME change to video_ioctl2 if serialization lock can be removed */
45 .ioctl = cx18_v4l2_ioctl, 45 .ioctl = cx18_v4l2_ioctl,
46 .compat_ioctl = v4l_compat_ioctl32,
47 .release = cx18_v4l2_close, 46 .release = cx18_v4l2_close,
48 .poll = cx18_v4l2_enc_poll, 47 .poll = cx18_v4l2_enc_poll,
49}; 48};
@@ -61,49 +60,41 @@ static struct {
61 int num_offset; 60 int num_offset;
62 int dma; 61 int dma;
63 enum v4l2_buf_type buf_type; 62 enum v4l2_buf_type buf_type;
64 struct file_operations *fops;
65} cx18_stream_info[] = { 63} cx18_stream_info[] = {
66 { /* CX18_ENC_STREAM_TYPE_MPG */ 64 { /* CX18_ENC_STREAM_TYPE_MPG */
67 "encoder MPEG", 65 "encoder MPEG",
68 VFL_TYPE_GRABBER, 0, 66 VFL_TYPE_GRABBER, 0,
69 PCI_DMA_FROMDEVICE, V4L2_BUF_TYPE_VIDEO_CAPTURE, 67 PCI_DMA_FROMDEVICE, V4L2_BUF_TYPE_VIDEO_CAPTURE,
70 &cx18_v4l2_enc_fops
71 }, 68 },
72 { /* CX18_ENC_STREAM_TYPE_TS */ 69 { /* CX18_ENC_STREAM_TYPE_TS */
73 "TS", 70 "TS",
74 VFL_TYPE_GRABBER, -1, 71 VFL_TYPE_GRABBER, -1,
75 PCI_DMA_FROMDEVICE, V4L2_BUF_TYPE_VIDEO_CAPTURE, 72 PCI_DMA_FROMDEVICE, V4L2_BUF_TYPE_VIDEO_CAPTURE,
76 &cx18_v4l2_enc_fops
77 }, 73 },
78 { /* CX18_ENC_STREAM_TYPE_YUV */ 74 { /* CX18_ENC_STREAM_TYPE_YUV */
79 "encoder YUV", 75 "encoder YUV",
80 VFL_TYPE_GRABBER, CX18_V4L2_ENC_YUV_OFFSET, 76 VFL_TYPE_GRABBER, CX18_V4L2_ENC_YUV_OFFSET,
81 PCI_DMA_FROMDEVICE, V4L2_BUF_TYPE_VIDEO_CAPTURE, 77 PCI_DMA_FROMDEVICE, V4L2_BUF_TYPE_VIDEO_CAPTURE,
82 &cx18_v4l2_enc_fops
83 }, 78 },
84 { /* CX18_ENC_STREAM_TYPE_VBI */ 79 { /* CX18_ENC_STREAM_TYPE_VBI */
85 "encoder VBI", 80 "encoder VBI",
86 VFL_TYPE_VBI, 0, 81 VFL_TYPE_VBI, 0,
87 PCI_DMA_FROMDEVICE, V4L2_BUF_TYPE_VBI_CAPTURE, 82 PCI_DMA_FROMDEVICE, V4L2_BUF_TYPE_VBI_CAPTURE,
88 &cx18_v4l2_enc_fops
89 }, 83 },
90 { /* CX18_ENC_STREAM_TYPE_PCM */ 84 { /* CX18_ENC_STREAM_TYPE_PCM */
91 "encoder PCM audio", 85 "encoder PCM audio",
92 VFL_TYPE_GRABBER, CX18_V4L2_ENC_PCM_OFFSET, 86 VFL_TYPE_GRABBER, CX18_V4L2_ENC_PCM_OFFSET,
93 PCI_DMA_FROMDEVICE, V4L2_BUF_TYPE_PRIVATE, 87 PCI_DMA_FROMDEVICE, V4L2_BUF_TYPE_PRIVATE,
94 &cx18_v4l2_enc_fops
95 }, 88 },
96 { /* CX18_ENC_STREAM_TYPE_IDX */ 89 { /* CX18_ENC_STREAM_TYPE_IDX */
97 "encoder IDX", 90 "encoder IDX",
98 VFL_TYPE_GRABBER, -1, 91 VFL_TYPE_GRABBER, -1,
99 PCI_DMA_FROMDEVICE, V4L2_BUF_TYPE_VIDEO_CAPTURE, 92 PCI_DMA_FROMDEVICE, V4L2_BUF_TYPE_VIDEO_CAPTURE,
100 &cx18_v4l2_enc_fops
101 }, 93 },
102 { /* CX18_ENC_STREAM_TYPE_RAD */ 94 { /* CX18_ENC_STREAM_TYPE_RAD */
103 "encoder radio", 95 "encoder radio",
104 VFL_TYPE_RADIO, 0, 96 VFL_TYPE_RADIO, 0,
105 PCI_DMA_NONE, V4L2_BUF_TYPE_PRIVATE, 97 PCI_DMA_NONE, V4L2_BUF_TYPE_PRIVATE,
106 &cx18_v4l2_enc_fops
107 }, 98 },
108}; 99};
109 100
@@ -184,7 +175,7 @@ static int cx18_prep_dev(struct cx18 *cx, int type)
184 175
185 s->v4l2dev->num = num; 176 s->v4l2dev->num = num;
186 s->v4l2dev->parent = &cx->dev->dev; 177 s->v4l2dev->parent = &cx->dev->dev;
187 s->v4l2dev->fops = cx18_stream_info[type].fops; 178 s->v4l2dev->fops = &cx18_v4l2_enc_fops;
188 s->v4l2dev->release = video_device_release; 179 s->v4l2dev->release = video_device_release;
189 s->v4l2dev->tvnorms = V4L2_STD_ALL; 180 s->v4l2dev->tvnorms = V4L2_STD_ALL;
190 cx18_set_funcs(s->v4l2dev); 181 cx18_set_funcs(s->v4l2dev);
diff --git a/drivers/media/video/cx23885/cx23885-417.c b/drivers/media/video/cx23885/cx23885-417.c
index 798d24024353..8f1db57bd1dd 100644
--- a/drivers/media/video/cx23885/cx23885-417.c
+++ b/drivers/media/video/cx23885/cx23885-417.c
@@ -1027,12 +1027,13 @@ static int cx23885_initialize_codec(struct cx23885_dev *dev)
1027 printk(KERN_ERR "%s() f/w load failed\n", __func__); 1027 printk(KERN_ERR "%s() f/w load failed\n", __func__);
1028 return retval; 1028 return retval;
1029 } 1029 }
1030 dev->cx23417_mailbox = cx23885_find_mailbox(dev); 1030 retval = cx23885_find_mailbox(dev);
1031 if (dev->cx23417_mailbox < 0) { 1031 if (retval < 0) {
1032 printk(KERN_ERR "%s() mailbox < 0, error\n", 1032 printk(KERN_ERR "%s() mailbox < 0, error\n",
1033 __func__); 1033 __func__);
1034 return -1; 1034 return -1;
1035 } 1035 }
1036 dev->cx23417_mailbox = retval;
1036 retval = cx23885_api_cmd(dev, CX2341X_ENC_PING_FW, 0, 0); 1037 retval = cx23885_api_cmd(dev, CX2341X_ENC_PING_FW, 0, 0);
1037 if (retval < 0) { 1038 if (retval < 0) {
1038 printk(KERN_ERR 1039 printk(KERN_ERR
@@ -1573,9 +1574,9 @@ static int vidioc_queryctrl(struct file *file, void *priv,
1573 return cx23885_queryctrl(dev, c); 1574 return cx23885_queryctrl(dev, c);
1574} 1575}
1575 1576
1576static int mpeg_open(struct inode *inode, struct file *file) 1577static int mpeg_open(struct file *file)
1577{ 1578{
1578 int minor = iminor(inode); 1579 int minor = video_devdata(file)->minor;
1579 struct cx23885_dev *h, *dev = NULL; 1580 struct cx23885_dev *h, *dev = NULL;
1580 struct list_head *list; 1581 struct list_head *list;
1581 struct cx23885_fh *fh; 1582 struct cx23885_fh *fh;
@@ -1617,7 +1618,7 @@ static int mpeg_open(struct inode *inode, struct file *file)
1617 return 0; 1618 return 0;
1618} 1619}
1619 1620
1620static int mpeg_release(struct inode *inode, struct file *file) 1621static int mpeg_release(struct file *file)
1621{ 1622{
1622 struct cx23885_fh *fh = file->private_data; 1623 struct cx23885_fh *fh = file->private_data;
1623 struct cx23885_dev *dev = fh->dev; 1624 struct cx23885_dev *dev = fh->dev;
@@ -1694,15 +1695,13 @@ static int mpeg_mmap(struct file *file, struct vm_area_struct *vma)
1694 return videobuf_mmap_mapper(&fh->mpegq, vma); 1695 return videobuf_mmap_mapper(&fh->mpegq, vma);
1695} 1696}
1696 1697
1697static struct file_operations mpeg_fops = { 1698static struct v4l2_file_operations mpeg_fops = {
1698 .owner = THIS_MODULE, 1699 .owner = THIS_MODULE,
1699 .open = mpeg_open, 1700 .open = mpeg_open,
1700 .release = mpeg_release, 1701 .release = mpeg_release,
1701 .read = mpeg_read, 1702 .read = mpeg_read,
1702 .poll = mpeg_poll, 1703 .poll = mpeg_poll,
1703 .mmap = mpeg_mmap, 1704 .mmap = mpeg_mmap,
1704 .ioctl = video_ioctl2,
1705 .llseek = no_llseek,
1706}; 1705};
1707 1706
1708static const struct v4l2_ioctl_ops mpeg_ioctl_ops = { 1707static const struct v4l2_ioctl_ops mpeg_ioctl_ops = {
diff --git a/drivers/media/video/cx23885/cx23885-video.c b/drivers/media/video/cx23885/cx23885-video.c
index c742a10be5cb..2d81c4d04340 100644
--- a/drivers/media/video/cx23885/cx23885-video.c
+++ b/drivers/media/video/cx23885/cx23885-video.c
@@ -718,9 +718,9 @@ static int get_resource(struct cx23885_fh *fh)
718 } 718 }
719} 719}
720 720
721static int video_open(struct inode *inode, struct file *file) 721static int video_open(struct file *file)
722{ 722{
723 int minor = iminor(inode); 723 int minor = video_devdata(file)->minor;
724 struct cx23885_dev *h, *dev = NULL; 724 struct cx23885_dev *h, *dev = NULL;
725 struct cx23885_fh *fh; 725 struct cx23885_fh *fh;
726 struct list_head *list; 726 struct list_head *list;
@@ -834,7 +834,7 @@ static unsigned int video_poll(struct file *file,
834 return 0; 834 return 0;
835} 835}
836 836
837static int video_release(struct inode *inode, struct file *file) 837static int video_release(struct file *file)
838{ 838{
839 struct cx23885_fh *fh = file->private_data; 839 struct cx23885_fh *fh = file->private_data;
840 struct cx23885_dev *dev = fh->dev; 840 struct cx23885_dev *dev = fh->dev;
@@ -1326,11 +1326,11 @@ static int vidioc_s_frequency(struct file *file, void *priv,
1326 1326
1327#ifdef CONFIG_VIDEO_ADV_DEBUG 1327#ifdef CONFIG_VIDEO_ADV_DEBUG
1328static int vidioc_g_register(struct file *file, void *fh, 1328static int vidioc_g_register(struct file *file, void *fh,
1329 struct v4l2_register *reg) 1329 struct v4l2_dbg_register *reg)
1330{ 1330{
1331 struct cx23885_dev *dev = ((struct cx23885_fh *)fh)->dev; 1331 struct cx23885_dev *dev = ((struct cx23885_fh *)fh)->dev;
1332 1332
1333 if (!v4l2_chip_match_host(reg->match_type, reg->match_chip)) 1333 if (!v4l2_chip_match_host(&reg->match))
1334 return -EINVAL; 1334 return -EINVAL;
1335 1335
1336 cx23885_call_i2c_clients(&dev->i2c_bus[2], VIDIOC_DBG_G_REGISTER, reg); 1336 cx23885_call_i2c_clients(&dev->i2c_bus[2], VIDIOC_DBG_G_REGISTER, reg);
@@ -1339,11 +1339,11 @@ static int vidioc_g_register(struct file *file, void *fh,
1339} 1339}
1340 1340
1341static int vidioc_s_register(struct file *file, void *fh, 1341static int vidioc_s_register(struct file *file, void *fh,
1342 struct v4l2_register *reg) 1342 struct v4l2_dbg_register *reg)
1343{ 1343{
1344 struct cx23885_dev *dev = ((struct cx23885_fh *)fh)->dev; 1344 struct cx23885_dev *dev = ((struct cx23885_fh *)fh)->dev;
1345 1345
1346 if (!v4l2_chip_match_host(reg->match_type, reg->match_chip)) 1346 if (!v4l2_chip_match_host(&reg->match))
1347 return -EINVAL; 1347 return -EINVAL;
1348 1348
1349 cx23885_call_i2c_clients(&dev->i2c_bus[2], VIDIOC_DBG_S_REGISTER, reg); 1349 cx23885_call_i2c_clients(&dev->i2c_bus[2], VIDIOC_DBG_S_REGISTER, reg);
@@ -1422,7 +1422,7 @@ int cx23885_video_irq(struct cx23885_dev *dev, u32 status)
1422/* ----------------------------------------------------------- */ 1422/* ----------------------------------------------------------- */
1423/* exported stuff */ 1423/* exported stuff */
1424 1424
1425static const struct file_operations video_fops = { 1425static const struct v4l2_file_operations video_fops = {
1426 .owner = THIS_MODULE, 1426 .owner = THIS_MODULE,
1427 .open = video_open, 1427 .open = video_open,
1428 .release = video_release, 1428 .release = video_release,
@@ -1430,8 +1430,6 @@ static const struct file_operations video_fops = {
1430 .poll = video_poll, 1430 .poll = video_poll,
1431 .mmap = video_mmap, 1431 .mmap = video_mmap,
1432 .ioctl = video_ioctl2, 1432 .ioctl = video_ioctl2,
1433 .compat_ioctl = v4l_compat_ioctl32,
1434 .llseek = no_llseek,
1435}; 1433};
1436 1434
1437static const struct v4l2_ioctl_ops video_ioctl_ops = { 1435static const struct v4l2_ioctl_ops video_ioctl_ops = {
@@ -1479,13 +1477,11 @@ static struct video_device cx23885_video_template = {
1479 .current_norm = V4L2_STD_NTSC_M, 1477 .current_norm = V4L2_STD_NTSC_M,
1480}; 1478};
1481 1479
1482static const struct file_operations radio_fops = { 1480static const struct v4l2_file_operations radio_fops = {
1483 .owner = THIS_MODULE, 1481 .owner = THIS_MODULE,
1484 .open = video_open, 1482 .open = video_open,
1485 .release = video_release, 1483 .release = video_release,
1486 .ioctl = video_ioctl2, 1484 .ioctl = video_ioctl2,
1487 .compat_ioctl = v4l_compat_ioctl32,
1488 .llseek = no_llseek,
1489}; 1485};
1490 1486
1491 1487
diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c
index 2ad277189da8..88f2fd32bfe3 100644
--- a/drivers/media/video/cx25840/cx25840-core.c
+++ b/drivers/media/video/cx25840/cx25840-core.c
@@ -1120,25 +1120,24 @@ static int cx25840_init(struct v4l2_subdev *sd, u32 val)
1120} 1120}
1121 1121
1122#ifdef CONFIG_VIDEO_ADV_DEBUG 1122#ifdef CONFIG_VIDEO_ADV_DEBUG
1123static int cx25840_g_register(struct v4l2_subdev *sd, struct v4l2_register *reg) 1123static int cx25840_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg)
1124{ 1124{
1125 struct i2c_client *client = v4l2_get_subdevdata(sd); 1125 struct i2c_client *client = v4l2_get_subdevdata(sd);
1126 1126
1127 if (!v4l2_chip_match_i2c_client(client, 1127 if (!v4l2_chip_match_i2c_client(client, &reg->match))
1128 reg->match_type, reg->match_chip))
1129 return -EINVAL; 1128 return -EINVAL;
1130 if (!capable(CAP_SYS_ADMIN)) 1129 if (!capable(CAP_SYS_ADMIN))
1131 return -EPERM; 1130 return -EPERM;
1131 reg->size = 1;
1132 reg->val = cx25840_read(client, reg->reg & 0x0fff); 1132 reg->val = cx25840_read(client, reg->reg & 0x0fff);
1133 return 0; 1133 return 0;
1134} 1134}
1135 1135
1136static int cx25840_s_register(struct v4l2_subdev *sd, struct v4l2_register *reg) 1136static int cx25840_s_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg)
1137{ 1137{
1138 struct i2c_client *client = v4l2_get_subdevdata(sd); 1138 struct i2c_client *client = v4l2_get_subdevdata(sd);
1139 1139
1140 if (!v4l2_chip_match_i2c_client(client, 1140 if (!v4l2_chip_match_i2c_client(client, &reg->match))
1141 reg->match_type, reg->match_chip))
1142 return -EINVAL; 1141 return -EINVAL;
1143 if (!capable(CAP_SYS_ADMIN)) 1142 if (!capable(CAP_SYS_ADMIN))
1144 return -EPERM; 1143 return -EPERM;
@@ -1362,7 +1361,7 @@ static int cx25840_reset(struct v4l2_subdev *sd, u32 val)
1362 return 0; 1361 return 0;
1363} 1362}
1364 1363
1365static int cx25840_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_chip_ident *chip) 1364static int cx25840_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip)
1366{ 1365{
1367 struct cx25840_state *state = to_state(sd); 1366 struct cx25840_state *state = to_state(sd);
1368 struct i2c_client *client = v4l2_get_subdevdata(sd); 1367 struct i2c_client *client = v4l2_get_subdevdata(sd);
diff --git a/drivers/media/video/cx88/cx88-blackbird.c b/drivers/media/video/cx88/cx88-blackbird.c
index e162a70748c5..7f5b8bfd08ac 100644
--- a/drivers/media/video/cx88/cx88-blackbird.c
+++ b/drivers/media/video/cx88/cx88-blackbird.c
@@ -1049,16 +1049,16 @@ static int vidioc_s_std (struct file *file, void *priv, v4l2_std_id *id)
1049 1049
1050/* FIXME: cx88_ioctl_hook not implemented */ 1050/* FIXME: cx88_ioctl_hook not implemented */
1051 1051
1052static int mpeg_open(struct inode *inode, struct file *file) 1052static int mpeg_open(struct file *file)
1053{ 1053{
1054 int minor = iminor(inode); 1054 int minor = video_devdata(file)->minor;
1055 struct cx8802_dev *dev = NULL; 1055 struct cx8802_dev *dev = NULL;
1056 struct cx8802_fh *fh; 1056 struct cx8802_fh *fh;
1057 struct cx8802_driver *drv = NULL; 1057 struct cx8802_driver *drv = NULL;
1058 int err; 1058 int err;
1059 1059
1060 lock_kernel(); 1060 lock_kernel();
1061 dev = cx8802_get_device(inode); 1061 dev = cx8802_get_device(minor);
1062 1062
1063 dprintk( 1, "%s\n", __func__); 1063 dprintk( 1, "%s\n", __func__);
1064 1064
@@ -1114,7 +1114,7 @@ static int mpeg_open(struct inode *inode, struct file *file)
1114 return 0; 1114 return 0;
1115} 1115}
1116 1116
1117static int mpeg_release(struct inode *inode, struct file *file) 1117static int mpeg_release(struct file *file)
1118{ 1118{
1119 struct cx8802_fh *fh = file->private_data; 1119 struct cx8802_fh *fh = file->private_data;
1120 struct cx8802_dev *dev = fh->dev; 1120 struct cx8802_dev *dev = fh->dev;
@@ -1132,7 +1132,7 @@ static int mpeg_release(struct inode *inode, struct file *file)
1132 kfree(fh); 1132 kfree(fh);
1133 1133
1134 /* Make sure we release the hardware */ 1134 /* Make sure we release the hardware */
1135 dev = cx8802_get_device(inode); 1135 dev = cx8802_get_device(video_devdata(file)->minor);
1136 if (dev == NULL) 1136 if (dev == NULL)
1137 return -ENODEV; 1137 return -ENODEV;
1138 1138
@@ -1178,7 +1178,7 @@ mpeg_mmap(struct file *file, struct vm_area_struct * vma)
1178 return videobuf_mmap_mapper(&fh->mpegq, vma); 1178 return videobuf_mmap_mapper(&fh->mpegq, vma);
1179} 1179}
1180 1180
1181static const struct file_operations mpeg_fops = 1181static const struct v4l2_file_operations mpeg_fops =
1182{ 1182{
1183 .owner = THIS_MODULE, 1183 .owner = THIS_MODULE,
1184 .open = mpeg_open, 1184 .open = mpeg_open,
@@ -1187,7 +1187,6 @@ static const struct file_operations mpeg_fops =
1187 .poll = mpeg_poll, 1187 .poll = mpeg_poll,
1188 .mmap = mpeg_mmap, 1188 .mmap = mpeg_mmap,
1189 .ioctl = video_ioctl2, 1189 .ioctl = video_ioctl2,
1190 .llseek = no_llseek,
1191}; 1190};
1192 1191
1193static const struct v4l2_ioctl_ops mpeg_ioctl_ops = { 1192static const struct v4l2_ioctl_ops mpeg_ioctl_ops = {
diff --git a/drivers/media/video/cx88/cx88-mpeg.c b/drivers/media/video/cx88/cx88-mpeg.c
index a04fee235db6..59164fc94f5f 100644
--- a/drivers/media/video/cx88/cx88-mpeg.c
+++ b/drivers/media/video/cx88/cx88-mpeg.c
@@ -578,9 +578,8 @@ static int cx8802_resume_common(struct pci_dev *pci_dev)
578 578
579#if defined(CONFIG_VIDEO_CX88_BLACKBIRD) || \ 579#if defined(CONFIG_VIDEO_CX88_BLACKBIRD) || \
580 defined(CONFIG_VIDEO_CX88_BLACKBIRD_MODULE) 580 defined(CONFIG_VIDEO_CX88_BLACKBIRD_MODULE)
581struct cx8802_dev * cx8802_get_device(struct inode *inode) 581struct cx8802_dev *cx8802_get_device(int minor)
582{ 582{
583 int minor = iminor(inode);
584 struct cx8802_dev *dev; 583 struct cx8802_dev *dev;
585 584
586 list_for_each_entry(dev, &cx8802_devlist, devlist) 585 list_for_each_entry(dev, &cx8802_devlist, devlist)
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c
index b96ce991d968..791e69d804f9 100644
--- a/drivers/media/video/cx88/cx88-video.c
+++ b/drivers/media/video/cx88/cx88-video.c
@@ -757,9 +757,9 @@ static int get_ressource(struct cx8800_fh *fh)
757 } 757 }
758} 758}
759 759
760static int video_open(struct inode *inode, struct file *file) 760static int video_open(struct file *file)
761{ 761{
762 int minor = iminor(inode); 762 int minor = video_devdata(file)->minor;
763 struct cx8800_dev *h,*dev = NULL; 763 struct cx8800_dev *h,*dev = NULL;
764 struct cx88_core *core; 764 struct cx88_core *core;
765 struct cx8800_fh *fh; 765 struct cx8800_fh *fh;
@@ -904,7 +904,7 @@ video_poll(struct file *file, struct poll_table_struct *wait)
904 return 0; 904 return 0;
905} 905}
906 906
907static int video_release(struct inode *inode, struct file *file) 907static int video_release(struct file *file)
908{ 908{
909 struct cx8800_fh *fh = file->private_data; 909 struct cx8800_fh *fh = file->private_data;
910 struct cx8800_dev *dev = fh->dev; 910 struct cx8800_dev *dev = fh->dev;
@@ -1447,25 +1447,26 @@ static int vidioc_s_frequency (struct file *file, void *priv,
1447 1447
1448#ifdef CONFIG_VIDEO_ADV_DEBUG 1448#ifdef CONFIG_VIDEO_ADV_DEBUG
1449static int vidioc_g_register (struct file *file, void *fh, 1449static int vidioc_g_register (struct file *file, void *fh,
1450 struct v4l2_register *reg) 1450 struct v4l2_dbg_register *reg)
1451{ 1451{
1452 struct cx88_core *core = ((struct cx8800_fh*)fh)->dev->core; 1452 struct cx88_core *core = ((struct cx8800_fh*)fh)->dev->core;
1453 1453
1454 if (!v4l2_chip_match_host(reg->match_type, reg->match_chip)) 1454 if (!v4l2_chip_match_host(&reg->match))
1455 return -EINVAL; 1455 return -EINVAL;
1456 /* cx2388x has a 24-bit register space */ 1456 /* cx2388x has a 24-bit register space */
1457 reg->val = cx_read(reg->reg&0xffffff); 1457 reg->val = cx_read(reg->reg & 0xffffff);
1458 reg->size = 4;
1458 return 0; 1459 return 0;
1459} 1460}
1460 1461
1461static int vidioc_s_register (struct file *file, void *fh, 1462static int vidioc_s_register (struct file *file, void *fh,
1462 struct v4l2_register *reg) 1463 struct v4l2_dbg_register *reg)
1463{ 1464{
1464 struct cx88_core *core = ((struct cx8800_fh*)fh)->dev->core; 1465 struct cx88_core *core = ((struct cx8800_fh*)fh)->dev->core;
1465 1466
1466 if (!v4l2_chip_match_host(reg->match_type, reg->match_chip)) 1467 if (!v4l2_chip_match_host(&reg->match))
1467 return -EINVAL; 1468 return -EINVAL;
1468 cx_write(reg->reg&0xffffff, reg->val); 1469 cx_write(reg->reg & 0xffffff, reg->val);
1469 return 0; 1470 return 0;
1470} 1471}
1471#endif 1472#endif
@@ -1693,7 +1694,7 @@ static irqreturn_t cx8800_irq(int irq, void *dev_id)
1693/* ----------------------------------------------------------- */ 1694/* ----------------------------------------------------------- */
1694/* exported stuff */ 1695/* exported stuff */
1695 1696
1696static const struct file_operations video_fops = 1697static const struct v4l2_file_operations video_fops =
1697{ 1698{
1698 .owner = THIS_MODULE, 1699 .owner = THIS_MODULE,
1699 .open = video_open, 1700 .open = video_open,
@@ -1702,8 +1703,6 @@ static const struct file_operations video_fops =
1702 .poll = video_poll, 1703 .poll = video_poll,
1703 .mmap = video_mmap, 1704 .mmap = video_mmap,
1704 .ioctl = video_ioctl2, 1705 .ioctl = video_ioctl2,
1705 .compat_ioctl = v4l_compat_ioctl32,
1706 .llseek = no_llseek,
1707}; 1706};
1708 1707
1709static const struct v4l2_ioctl_ops video_ioctl_ops = { 1708static const struct v4l2_ioctl_ops video_ioctl_ops = {
@@ -1752,14 +1751,12 @@ static struct video_device cx8800_video_template = {
1752 .current_norm = V4L2_STD_NTSC_M, 1751 .current_norm = V4L2_STD_NTSC_M,
1753}; 1752};
1754 1753
1755static const struct file_operations radio_fops = 1754static const struct v4l2_file_operations radio_fops =
1756{ 1755{
1757 .owner = THIS_MODULE, 1756 .owner = THIS_MODULE,
1758 .open = video_open, 1757 .open = video_open,
1759 .release = video_release, 1758 .release = video_release,
1760 .ioctl = video_ioctl2, 1759 .ioctl = video_ioctl2,
1761 .compat_ioctl = v4l_compat_ioctl32,
1762 .llseek = no_llseek,
1763}; 1760};
1764 1761
1765static const struct v4l2_ioctl_ops radio_ioctl_ops = { 1762static const struct v4l2_ioctl_ops radio_ioctl_ops = {
diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h
index 20649b25f7ba..eb9ce30dc5e6 100644
--- a/drivers/media/video/cx88/cx88.h
+++ b/drivers/media/video/cx88/cx88.h
@@ -643,7 +643,7 @@ int cx88_audio_thread(void *data);
643 643
644int cx8802_register_driver(struct cx8802_driver *drv); 644int cx8802_register_driver(struct cx8802_driver *drv);
645int cx8802_unregister_driver(struct cx8802_driver *drv); 645int cx8802_unregister_driver(struct cx8802_driver *drv);
646struct cx8802_dev * cx8802_get_device(struct inode *inode); 646struct cx8802_dev *cx8802_get_device(int minor);
647struct cx8802_driver * cx8802_get_driver(struct cx8802_dev *dev, enum cx88_board_type btype); 647struct cx8802_driver * cx8802_get_driver(struct cx8802_dev *dev, enum cx88_board_type btype);
648 648
649/* ----------------------------------------------------------- */ 649/* ----------------------------------------------------------- */
diff --git a/drivers/media/video/em28xx/em28xx-audio.c b/drivers/media/video/em28xx/em28xx-audio.c
index 15c03f0e69ad..94378ccb7505 100644
--- a/drivers/media/video/em28xx/em28xx-audio.c
+++ b/drivers/media/video/em28xx/em28xx-audio.c
@@ -62,9 +62,9 @@ static int em28xx_isoc_audio_deinit(struct em28xx *dev)
62 62
63 dprintk("Stopping isoc\n"); 63 dprintk("Stopping isoc\n");
64 for (i = 0; i < EM28XX_AUDIO_BUFS; i++) { 64 for (i = 0; i < EM28XX_AUDIO_BUFS; i++) {
65 usb_unlink_urb(dev->adev->urb[i]); 65 usb_unlink_urb(dev->adev.urb[i]);
66 usb_free_urb(dev->adev->urb[i]); 66 usb_free_urb(dev->adev.urb[i]);
67 dev->adev->urb[i] = NULL; 67 dev->adev.urb[i] = NULL;
68 } 68 }
69 69
70 return 0; 70 return 0;
@@ -81,8 +81,8 @@ static void em28xx_audio_isocirq(struct urb *urb)
81 unsigned int stride; 81 unsigned int stride;
82 struct snd_pcm_substream *substream; 82 struct snd_pcm_substream *substream;
83 struct snd_pcm_runtime *runtime; 83 struct snd_pcm_runtime *runtime;
84 if (dev->adev->capture_pcm_substream) { 84 if (dev->adev.capture_pcm_substream) {
85 substream = dev->adev->capture_pcm_substream; 85 substream = dev->adev.capture_pcm_substream;
86 runtime = substream->runtime; 86 runtime = substream->runtime;
87 stride = runtime->frame_bits >> 3; 87 stride = runtime->frame_bits >> 3;
88 88
@@ -95,7 +95,7 @@ static void em28xx_audio_isocirq(struct urb *urb)
95 if (!length) 95 if (!length)
96 continue; 96 continue;
97 97
98 oldptr = dev->adev->hwptr_done_capture; 98 oldptr = dev->adev.hwptr_done_capture;
99 if (oldptr + length >= runtime->buffer_size) { 99 if (oldptr + length >= runtime->buffer_size) {
100 unsigned int cnt = 100 unsigned int cnt =
101 runtime->buffer_size - oldptr; 101 runtime->buffer_size - oldptr;
@@ -110,16 +110,16 @@ static void em28xx_audio_isocirq(struct urb *urb)
110 110
111 snd_pcm_stream_lock(substream); 111 snd_pcm_stream_lock(substream);
112 112
113 dev->adev->hwptr_done_capture += length; 113 dev->adev.hwptr_done_capture += length;
114 if (dev->adev->hwptr_done_capture >= 114 if (dev->adev.hwptr_done_capture >=
115 runtime->buffer_size) 115 runtime->buffer_size)
116 dev->adev->hwptr_done_capture -= 116 dev->adev.hwptr_done_capture -=
117 runtime->buffer_size; 117 runtime->buffer_size;
118 118
119 dev->adev->capture_transfer_done += length; 119 dev->adev.capture_transfer_done += length;
120 if (dev->adev->capture_transfer_done >= 120 if (dev->adev.capture_transfer_done >=
121 runtime->period_size) { 121 runtime->period_size) {
122 dev->adev->capture_transfer_done -= 122 dev->adev.capture_transfer_done -=
123 runtime->period_size; 123 runtime->period_size;
124 period_elapsed = 1; 124 period_elapsed = 1;
125 } 125 }
@@ -131,7 +131,7 @@ static void em28xx_audio_isocirq(struct urb *urb)
131 } 131 }
132 urb->status = 0; 132 urb->status = 0;
133 133
134 if (dev->adev->shutdown) 134 if (dev->adev.shutdown)
135 return; 135 return;
136 136
137 status = usb_submit_urb(urb, GFP_ATOMIC); 137 status = usb_submit_urb(urb, GFP_ATOMIC);
@@ -154,17 +154,17 @@ static int em28xx_init_audio_isoc(struct em28xx *dev)
154 struct urb *urb; 154 struct urb *urb;
155 int j, k; 155 int j, k;
156 156
157 dev->adev->transfer_buffer[i] = kmalloc(sb_size, GFP_ATOMIC); 157 dev->adev.transfer_buffer[i] = kmalloc(sb_size, GFP_ATOMIC);
158 if (!dev->adev->transfer_buffer[i]) 158 if (!dev->adev.transfer_buffer[i])
159 return -ENOMEM; 159 return -ENOMEM;
160 160
161 memset(dev->adev->transfer_buffer[i], 0x80, sb_size); 161 memset(dev->adev.transfer_buffer[i], 0x80, sb_size);
162 urb = usb_alloc_urb(EM28XX_NUM_AUDIO_PACKETS, GFP_ATOMIC); 162 urb = usb_alloc_urb(EM28XX_NUM_AUDIO_PACKETS, GFP_ATOMIC);
163 if (!urb) { 163 if (!urb) {
164 em28xx_errdev("usb_alloc_urb failed!\n"); 164 em28xx_errdev("usb_alloc_urb failed!\n");
165 for (j = 0; j < i; j++) { 165 for (j = 0; j < i; j++) {
166 usb_free_urb(dev->adev->urb[j]); 166 usb_free_urb(dev->adev.urb[j]);
167 kfree(dev->adev->transfer_buffer[j]); 167 kfree(dev->adev.transfer_buffer[j]);
168 } 168 }
169 return -ENOMEM; 169 return -ENOMEM;
170 } 170 }
@@ -173,7 +173,7 @@ static int em28xx_init_audio_isoc(struct em28xx *dev)
173 urb->context = dev; 173 urb->context = dev;
174 urb->pipe = usb_rcvisocpipe(dev->udev, 0x83); 174 urb->pipe = usb_rcvisocpipe(dev->udev, 0x83);
175 urb->transfer_flags = URB_ISO_ASAP; 175 urb->transfer_flags = URB_ISO_ASAP;
176 urb->transfer_buffer = dev->adev->transfer_buffer[i]; 176 urb->transfer_buffer = dev->adev.transfer_buffer[i];
177 urb->interval = 1; 177 urb->interval = 1;
178 urb->complete = em28xx_audio_isocirq; 178 urb->complete = em28xx_audio_isocirq;
179 urb->number_of_packets = EM28XX_NUM_AUDIO_PACKETS; 179 urb->number_of_packets = EM28XX_NUM_AUDIO_PACKETS;
@@ -185,11 +185,11 @@ static int em28xx_init_audio_isoc(struct em28xx *dev)
185 urb->iso_frame_desc[j].length = 185 urb->iso_frame_desc[j].length =
186 EM28XX_AUDIO_MAX_PACKET_SIZE; 186 EM28XX_AUDIO_MAX_PACKET_SIZE;
187 } 187 }
188 dev->adev->urb[i] = urb; 188 dev->adev.urb[i] = urb;
189 } 189 }
190 190
191 for (i = 0; i < EM28XX_AUDIO_BUFS; i++) { 191 for (i = 0; i < EM28XX_AUDIO_BUFS; i++) {
192 errCode = usb_submit_urb(dev->adev->urb[i], GFP_ATOMIC); 192 errCode = usb_submit_urb(dev->adev.urb[i], GFP_ATOMIC);
193 if (errCode) { 193 if (errCode) {
194 em28xx_isoc_audio_deinit(dev); 194 em28xx_isoc_audio_deinit(dev);
195 195
@@ -202,16 +202,16 @@ static int em28xx_init_audio_isoc(struct em28xx *dev)
202 202
203static int em28xx_cmd(struct em28xx *dev, int cmd, int arg) 203static int em28xx_cmd(struct em28xx *dev, int cmd, int arg)
204{ 204{
205 dprintk("%s transfer\n", (dev->adev->capture_stream == STREAM_ON)? 205 dprintk("%s transfer\n", (dev->adev.capture_stream == STREAM_ON) ?
206 "stop" : "start"); 206 "stop" : "start");
207 207
208 switch (cmd) { 208 switch (cmd) {
209 case EM28XX_CAPTURE_STREAM_EN: 209 case EM28XX_CAPTURE_STREAM_EN:
210 if (dev->adev->capture_stream == STREAM_OFF && arg == 1) { 210 if (dev->adev.capture_stream == STREAM_OFF && arg == 1) {
211 dev->adev->capture_stream = STREAM_ON; 211 dev->adev.capture_stream = STREAM_ON;
212 em28xx_init_audio_isoc(dev); 212 em28xx_init_audio_isoc(dev);
213 } else if (dev->adev->capture_stream == STREAM_ON && arg == 0) { 213 } else if (dev->adev.capture_stream == STREAM_ON && arg == 0) {
214 dev->adev->capture_stream = STREAM_OFF; 214 dev->adev.capture_stream = STREAM_OFF;
215 em28xx_isoc_audio_deinit(dev); 215 em28xx_isoc_audio_deinit(dev);
216 } else { 216 } else {
217 printk(KERN_ERR "An underrun very likely occurred. " 217 printk(KERN_ERR "An underrun very likely occurred. "
@@ -289,17 +289,17 @@ static int snd_em28xx_capture_open(struct snd_pcm_substream *substream)
289 goto err; 289 goto err;
290 290
291 runtime->hw = snd_em28xx_hw_capture; 291 runtime->hw = snd_em28xx_hw_capture;
292 if (dev->alt == 0 && dev->adev->users == 0) { 292 if (dev->alt == 0 && dev->adev.users == 0) {
293 int errCode; 293 int errCode;
294 dev->alt = 7; 294 dev->alt = 7;
295 errCode = usb_set_interface(dev->udev, 0, 7); 295 errCode = usb_set_interface(dev->udev, 0, 7);
296 dprintk("changing alternate number to 7\n"); 296 dprintk("changing alternate number to 7\n");
297 } 297 }
298 298
299 dev->adev->users++; 299 dev->adev.users++;
300 300
301 snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS); 301 snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS);
302 dev->adev->capture_pcm_substream = substream; 302 dev->adev.capture_pcm_substream = substream;
303 runtime->private_data = dev; 303 runtime->private_data = dev;
304 304
305 return 0; 305 return 0;
@@ -311,7 +311,7 @@ err:
311static int snd_em28xx_pcm_close(struct snd_pcm_substream *substream) 311static int snd_em28xx_pcm_close(struct snd_pcm_substream *substream)
312{ 312{
313 struct em28xx *dev = snd_pcm_substream_chip(substream); 313 struct em28xx *dev = snd_pcm_substream_chip(substream);
314 dev->adev->users--; 314 dev->adev.users--;
315 315
316 dprintk("closing device\n"); 316 dprintk("closing device\n");
317 317
@@ -320,10 +320,10 @@ static int snd_em28xx_pcm_close(struct snd_pcm_substream *substream)
320 em28xx_audio_analog_set(dev); 320 em28xx_audio_analog_set(dev);
321 mutex_unlock(&dev->lock); 321 mutex_unlock(&dev->lock);
322 322
323 if (dev->adev->users == 0 && dev->adev->shutdown == 1) { 323 if (dev->adev.users == 0 && dev->adev.shutdown == 1) {
324 dprintk("audio users: %d\n", dev->adev->users); 324 dprintk("audio users: %d\n", dev->adev.users);
325 dprintk("disabling audio stream!\n"); 325 dprintk("disabling audio stream!\n");
326 dev->adev->shutdown = 0; 326 dev->adev.shutdown = 0;
327 dprintk("released lock\n"); 327 dprintk("released lock\n");
328 em28xx_cmd(dev, EM28XX_CAPTURE_STREAM_EN, 0); 328 em28xx_cmd(dev, EM28XX_CAPTURE_STREAM_EN, 0);
329 } 329 }
@@ -356,7 +356,7 @@ static int snd_em28xx_hw_capture_free(struct snd_pcm_substream *substream)
356 356
357 dprintk("Stop capture, if needed\n"); 357 dprintk("Stop capture, if needed\n");
358 358
359 if (dev->adev->capture_stream == STREAM_ON) 359 if (dev->adev.capture_stream == STREAM_ON)
360 em28xx_cmd(dev, EM28XX_CAPTURE_STREAM_EN, 0); 360 em28xx_cmd(dev, EM28XX_CAPTURE_STREAM_EN, 0);
361 361
362 return 0; 362 return 0;
@@ -379,7 +379,7 @@ static int snd_em28xx_capture_trigger(struct snd_pcm_substream *substream,
379 em28xx_cmd(dev, EM28XX_CAPTURE_STREAM_EN, 1); 379 em28xx_cmd(dev, EM28XX_CAPTURE_STREAM_EN, 1);
380 return 0; 380 return 0;
381 case SNDRV_PCM_TRIGGER_STOP: 381 case SNDRV_PCM_TRIGGER_STOP:
382 dev->adev->shutdown = 1; 382 dev->adev.shutdown = 1;
383 return 0; 383 return 0;
384 default: 384 default:
385 return -EINVAL; 385 return -EINVAL;
@@ -393,7 +393,7 @@ static snd_pcm_uframes_t snd_em28xx_capture_pointer(struct snd_pcm_substream
393 393
394 snd_pcm_uframes_t hwptr_done; 394 snd_pcm_uframes_t hwptr_done;
395 dev = snd_pcm_substream_chip(substream); 395 dev = snd_pcm_substream_chip(substream);
396 hwptr_done = dev->adev->hwptr_done_capture; 396 hwptr_done = dev->adev.hwptr_done_capture;
397 397
398 return hwptr_done; 398 return hwptr_done;
399} 399}
@@ -420,7 +420,7 @@ static struct snd_pcm_ops snd_em28xx_pcm_capture = {
420 420
421static int em28xx_audio_init(struct em28xx *dev) 421static int em28xx_audio_init(struct em28xx *dev)
422{ 422{
423 struct em28xx_audio *adev; 423 struct em28xx_audio *adev = &dev->adev;
424 struct snd_pcm *pcm; 424 struct snd_pcm *pcm;
425 struct snd_card *card; 425 struct snd_card *card;
426 static int devnr; 426 static int devnr;
@@ -438,16 +438,9 @@ static int em28xx_audio_init(struct em28xx *dev)
438 printk(KERN_INFO "em28xx-audio.c: Copyright (C) 2006 Markus " 438 printk(KERN_INFO "em28xx-audio.c: Copyright (C) 2006 Markus "
439 "Rechberger\n"); 439 "Rechberger\n");
440 440
441 adev = kzalloc(sizeof(*adev), GFP_KERNEL);
442 if (!adev) {
443 printk(KERN_ERR "em28xx-audio.c: out of memory\n");
444 return -1;
445 }
446 card = snd_card_new(index[devnr], "Em28xx Audio", THIS_MODULE, 0); 441 card = snd_card_new(index[devnr], "Em28xx Audio", THIS_MODULE, 0);
447 if (card == NULL) { 442 if (card == NULL)
448 kfree(adev);
449 return -ENOMEM; 443 return -ENOMEM;
450 }
451 444
452 spin_lock_init(&adev->slock); 445 spin_lock_init(&adev->slock);
453 err = snd_pcm_new(card, "Em28xx Audio", 0, 0, 1, &pcm); 446 err = snd_pcm_new(card, "Em28xx Audio", 0, 0, 1, &pcm);
@@ -471,7 +464,6 @@ static int em28xx_audio_init(struct em28xx *dev)
471 } 464 }
472 adev->sndcard = card; 465 adev->sndcard = card;
473 adev->udev = dev->udev; 466 adev->udev = dev->udev;
474 dev->adev = adev;
475 467
476 return 0; 468 return 0;
477} 469}
@@ -488,10 +480,9 @@ static int em28xx_audio_fini(struct em28xx *dev)
488 return 0; 480 return 0;
489 } 481 }
490 482
491 if (dev->adev) { 483 if (dev->adev.sndcard) {
492 snd_card_free(dev->adev->sndcard); 484 snd_card_free(dev->adev.sndcard);
493 kfree(dev->adev); 485 dev->adev.sndcard = NULL;
494 dev->adev = NULL;
495 } 486 }
496 487
497 return 0; 488 return 0;
diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c
index f8504518586a..819cceaa6ef4 100644
--- a/drivers/media/video/em28xx/em28xx-core.c
+++ b/drivers/media/video/em28xx/em28xx-core.c
@@ -1000,12 +1000,11 @@ void em28xx_wake_i2c(struct em28xx *dev)
1000static LIST_HEAD(em28xx_devlist); 1000static LIST_HEAD(em28xx_devlist);
1001static DEFINE_MUTEX(em28xx_devlist_mutex); 1001static DEFINE_MUTEX(em28xx_devlist_mutex);
1002 1002
1003struct em28xx *em28xx_get_device(struct inode *inode, 1003struct em28xx *em28xx_get_device(int minor,
1004 enum v4l2_buf_type *fh_type, 1004 enum v4l2_buf_type *fh_type,
1005 int *has_radio) 1005 int *has_radio)
1006{ 1006{
1007 struct em28xx *h, *dev = NULL; 1007 struct em28xx *h, *dev = NULL;
1008 int minor = iminor(inode);
1009 1008
1010 *fh_type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 1009 *fh_type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
1011 *has_radio = 0; 1010 *has_radio = 0;
diff --git a/drivers/media/video/em28xx/em28xx-reg.h b/drivers/media/video/em28xx/em28xx-reg.h
index 65dcb91bdcc2..24e39c56811e 100644
--- a/drivers/media/video/em28xx/em28xx-reg.h
+++ b/drivers/media/video/em28xx/em28xx-reg.h
@@ -160,7 +160,7 @@
160 160
161/* FIXME: Need to be populated with the other chip ID's */ 161/* FIXME: Need to be populated with the other chip ID's */
162enum em28xx_chip_id { 162enum em28xx_chip_id {
163 CHIP_ID_EM2820 = 18, 163 CHIP_ID_EM2820 = 18, /* Also used by em2710 */
164 CHIP_ID_EM2840 = 20, 164 CHIP_ID_EM2840 = 20,
165 CHIP_ID_EM2750 = 33, 165 CHIP_ID_EM2750 = 33,
166 CHIP_ID_EM2860 = 34, 166 CHIP_ID_EM2860 = 34,
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c
index 53527536481e..416b691c33c1 100644
--- a/drivers/media/video/em28xx/em28xx-video.c
+++ b/drivers/media/video/em28xx/em28xx-video.c
@@ -1154,7 +1154,7 @@ static int em28xx_reg_len(int reg)
1154} 1154}
1155 1155
1156static int vidioc_g_chip_ident(struct file *file, void *priv, 1156static int vidioc_g_chip_ident(struct file *file, void *priv,
1157 struct v4l2_chip_ident *chip) 1157 struct v4l2_dbg_chip_ident *chip)
1158{ 1158{
1159 struct em28xx_fh *fh = priv; 1159 struct em28xx_fh *fh = priv;
1160 struct em28xx *dev = fh->dev; 1160 struct em28xx *dev = fh->dev;
@@ -1162,20 +1162,20 @@ static int vidioc_g_chip_ident(struct file *file, void *priv,
1162 chip->ident = V4L2_IDENT_NONE; 1162 chip->ident = V4L2_IDENT_NONE;
1163 chip->revision = 0; 1163 chip->revision = 0;
1164 1164
1165 em28xx_i2c_call_clients(dev, VIDIOC_G_CHIP_IDENT, chip); 1165 em28xx_i2c_call_clients(dev, VIDIOC_DBG_G_CHIP_IDENT, chip);
1166 1166
1167 return 0; 1167 return 0;
1168} 1168}
1169 1169
1170 1170
1171static int vidioc_g_register(struct file *file, void *priv, 1171static int vidioc_g_register(struct file *file, void *priv,
1172 struct v4l2_register *reg) 1172 struct v4l2_dbg_register *reg)
1173{ 1173{
1174 struct em28xx_fh *fh = priv; 1174 struct em28xx_fh *fh = priv;
1175 struct em28xx *dev = fh->dev; 1175 struct em28xx *dev = fh->dev;
1176 int ret; 1176 int ret;
1177 1177
1178 switch (reg->match_type) { 1178 switch (reg->match.type) {
1179 case V4L2_CHIP_MATCH_AC97: 1179 case V4L2_CHIP_MATCH_AC97:
1180 mutex_lock(&dev->lock); 1180 mutex_lock(&dev->lock);
1181 ret = em28xx_read_ac97(dev, reg->reg); 1181 ret = em28xx_read_ac97(dev, reg->reg);
@@ -1184,6 +1184,7 @@ static int vidioc_g_register(struct file *file, void *priv,
1184 return ret; 1184 return ret;
1185 1185
1186 reg->val = ret; 1186 reg->val = ret;
1187 reg->size = 1;
1187 return 0; 1188 return 0;
1188 case V4L2_CHIP_MATCH_I2C_DRIVER: 1189 case V4L2_CHIP_MATCH_I2C_DRIVER:
1189 em28xx_i2c_call_clients(dev, VIDIOC_DBG_G_REGISTER, reg); 1190 em28xx_i2c_call_clients(dev, VIDIOC_DBG_G_REGISTER, reg);
@@ -1192,12 +1193,13 @@ static int vidioc_g_register(struct file *file, void *priv,
1192 /* Not supported yet */ 1193 /* Not supported yet */
1193 return -EINVAL; 1194 return -EINVAL;
1194 default: 1195 default:
1195 if (!v4l2_chip_match_host(reg->match_type, reg->match_chip)) 1196 if (!v4l2_chip_match_host(&reg->match))
1196 return -EINVAL; 1197 return -EINVAL;
1197 } 1198 }
1198 1199
1199 /* Match host */ 1200 /* Match host */
1200 if (em28xx_reg_len(reg->reg) == 1) { 1201 reg->size = em28xx_reg_len(reg->reg);
1202 if (reg->size == 1) {
1201 mutex_lock(&dev->lock); 1203 mutex_lock(&dev->lock);
1202 ret = em28xx_read_reg(dev, reg->reg); 1204 ret = em28xx_read_reg(dev, reg->reg);
1203 mutex_unlock(&dev->lock); 1205 mutex_unlock(&dev->lock);
@@ -1207,7 +1209,7 @@ static int vidioc_g_register(struct file *file, void *priv,
1207 1209
1208 reg->val = ret; 1210 reg->val = ret;
1209 } else { 1211 } else {
1210 __le64 val = 0; 1212 __le16 val = 0;
1211 mutex_lock(&dev->lock); 1213 mutex_lock(&dev->lock);
1212 ret = em28xx_read_reg_req_len(dev, USB_REQ_GET_STATUS, 1214 ret = em28xx_read_reg_req_len(dev, USB_REQ_GET_STATUS,
1213 reg->reg, (char *)&val, 2); 1215 reg->reg, (char *)&val, 2);
@@ -1215,21 +1217,21 @@ static int vidioc_g_register(struct file *file, void *priv,
1215 if (ret < 0) 1217 if (ret < 0)
1216 return ret; 1218 return ret;
1217 1219
1218 reg->val = le64_to_cpu(val); 1220 reg->val = le16_to_cpu(val);
1219 } 1221 }
1220 1222
1221 return 0; 1223 return 0;
1222} 1224}
1223 1225
1224static int vidioc_s_register(struct file *file, void *priv, 1226static int vidioc_s_register(struct file *file, void *priv,
1225 struct v4l2_register *reg) 1227 struct v4l2_dbg_register *reg)
1226{ 1228{
1227 struct em28xx_fh *fh = priv; 1229 struct em28xx_fh *fh = priv;
1228 struct em28xx *dev = fh->dev; 1230 struct em28xx *dev = fh->dev;
1229 __le64 buf; 1231 __le16 buf;
1230 int rc; 1232 int rc;
1231 1233
1232 switch (reg->match_type) { 1234 switch (reg->match.type) {
1233 case V4L2_CHIP_MATCH_AC97: 1235 case V4L2_CHIP_MATCH_AC97:
1234 mutex_lock(&dev->lock); 1236 mutex_lock(&dev->lock);
1235 rc = em28xx_write_ac97(dev, reg->reg, reg->val); 1237 rc = em28xx_write_ac97(dev, reg->reg, reg->val);
@@ -1243,12 +1245,12 @@ static int vidioc_s_register(struct file *file, void *priv,
1243 /* Not supported yet */ 1245 /* Not supported yet */
1244 return -EINVAL; 1246 return -EINVAL;
1245 default: 1247 default:
1246 if (!v4l2_chip_match_host(reg->match_type, reg->match_chip)) 1248 if (!v4l2_chip_match_host(&reg->match))
1247 return -EINVAL; 1249 return -EINVAL;
1248 } 1250 }
1249 1251
1250 /* Match host */ 1252 /* Match host */
1251 buf = cpu_to_le64(reg->val); 1253 buf = cpu_to_le16(reg->val);
1252 1254
1253 mutex_lock(&dev->lock); 1255 mutex_lock(&dev->lock);
1254 rc = em28xx_write_regs(dev, reg->reg, (char *)&buf, 1256 rc = em28xx_write_regs(dev, reg->reg, (char *)&buf,
@@ -1582,15 +1584,15 @@ static int radio_queryctrl(struct file *file, void *priv,
1582 * em28xx_v4l2_open() 1584 * em28xx_v4l2_open()
1583 * inits the device and starts isoc transfer 1585 * inits the device and starts isoc transfer
1584 */ 1586 */
1585static int em28xx_v4l2_open(struct inode *inode, struct file *filp) 1587static int em28xx_v4l2_open(struct file *filp)
1586{ 1588{
1587 int minor = iminor(inode); 1589 int minor = video_devdata(filp)->minor;
1588 int errCode = 0, radio; 1590 int errCode = 0, radio;
1589 struct em28xx *dev; 1591 struct em28xx *dev;
1590 enum v4l2_buf_type fh_type; 1592 enum v4l2_buf_type fh_type;
1591 struct em28xx_fh *fh; 1593 struct em28xx_fh *fh;
1592 1594
1593 dev = em28xx_get_device(inode, &fh_type, &radio); 1595 dev = em28xx_get_device(minor, &fh_type, &radio);
1594 1596
1595 if (NULL == dev) 1597 if (NULL == dev)
1596 return -ENODEV; 1598 return -ENODEV;
@@ -1686,7 +1688,7 @@ void em28xx_release_analog_resources(struct em28xx *dev)
1686 * stops streaming and deallocates all resources allocated by the v4l2 1688 * stops streaming and deallocates all resources allocated by the v4l2
1687 * calls and ioctls 1689 * calls and ioctls
1688 */ 1690 */
1689static int em28xx_v4l2_close(struct inode *inode, struct file *filp) 1691static int em28xx_v4l2_close(struct file *filp)
1690{ 1692{
1691 struct em28xx_fh *fh = filp->private_data; 1693 struct em28xx_fh *fh = filp->private_data;
1692 struct em28xx *dev = fh->dev; 1694 struct em28xx *dev = fh->dev;
@@ -1826,7 +1828,7 @@ static int em28xx_v4l2_mmap(struct file *filp, struct vm_area_struct *vma)
1826 return rc; 1828 return rc;
1827} 1829}
1828 1830
1829static const struct file_operations em28xx_v4l_fops = { 1831static const struct v4l2_file_operations em28xx_v4l_fops = {
1830 .owner = THIS_MODULE, 1832 .owner = THIS_MODULE,
1831 .open = em28xx_v4l2_open, 1833 .open = em28xx_v4l2_open,
1832 .release = em28xx_v4l2_close, 1834 .release = em28xx_v4l2_close,
@@ -1834,8 +1836,6 @@ static const struct file_operations em28xx_v4l_fops = {
1834 .poll = em28xx_v4l2_poll, 1836 .poll = em28xx_v4l2_poll,
1835 .mmap = em28xx_v4l2_mmap, 1837 .mmap = em28xx_v4l2_mmap,
1836 .ioctl = video_ioctl2, 1838 .ioctl = video_ioctl2,
1837 .llseek = no_llseek,
1838 .compat_ioctl = v4l_compat_ioctl32,
1839}; 1839};
1840 1840
1841static const struct v4l2_ioctl_ops video_ioctl_ops = { 1841static const struct v4l2_ioctl_ops video_ioctl_ops = {
@@ -1890,13 +1890,11 @@ static const struct video_device em28xx_video_template = {
1890 .current_norm = V4L2_STD_PAL, 1890 .current_norm = V4L2_STD_PAL,
1891}; 1891};
1892 1892
1893static const struct file_operations radio_fops = { 1893static const struct v4l2_file_operations radio_fops = {
1894 .owner = THIS_MODULE, 1894 .owner = THIS_MODULE,
1895 .open = em28xx_v4l2_open, 1895 .open = em28xx_v4l2_open,
1896 .release = em28xx_v4l2_close, 1896 .release = em28xx_v4l2_close,
1897 .ioctl = video_ioctl2, 1897 .ioctl = video_ioctl2,
1898 .compat_ioctl = v4l_compat_ioctl32,
1899 .llseek = no_llseek,
1900}; 1898};
1901 1899
1902static const struct v4l2_ioctl_ops radio_ioctl_ops = { 1900static const struct v4l2_ioctl_ops radio_ioctl_ops = {
diff --git a/drivers/media/video/em28xx/em28xx.h b/drivers/media/video/em28xx/em28xx.h
index b5eddc26388e..6c6b94aa05b2 100644
--- a/drivers/media/video/em28xx/em28xx.h
+++ b/drivers/media/video/em28xx/em28xx.h
@@ -473,7 +473,7 @@ struct em28xx {
473 unsigned long i2c_hash; /* i2c devicelist hash - 473 unsigned long i2c_hash; /* i2c devicelist hash -
474 for boards with generic ID */ 474 for boards with generic ID */
475 475
476 struct em28xx_audio *adev; 476 struct em28xx_audio adev;
477 477
478 /* states */ 478 /* states */
479 enum em28xx_dev_state state; 479 enum em28xx_dev_state state;
@@ -583,7 +583,7 @@ int em28xx_gpio_set(struct em28xx *dev, struct em28xx_reg_seq *gpio);
583void em28xx_wake_i2c(struct em28xx *dev); 583void em28xx_wake_i2c(struct em28xx *dev);
584void em28xx_remove_from_devlist(struct em28xx *dev); 584void em28xx_remove_from_devlist(struct em28xx *dev);
585void em28xx_add_into_devlist(struct em28xx *dev); 585void em28xx_add_into_devlist(struct em28xx *dev);
586struct em28xx *em28xx_get_device(struct inode *inode, 586struct em28xx *em28xx_get_device(int minor,
587 enum v4l2_buf_type *fh_type, 587 enum v4l2_buf_type *fh_type,
588 int *has_radio); 588 int *has_radio);
589int em28xx_register_extension(struct em28xx_ops *dev); 589int em28xx_register_extension(struct em28xx_ops *dev);
diff --git a/drivers/media/video/et61x251/et61x251_core.c b/drivers/media/video/et61x251/et61x251_core.c
index 83c07112c59d..d1c1e457f0b9 100644
--- a/drivers/media/video/et61x251/et61x251_core.c
+++ b/drivers/media/video/et61x251/et61x251_core.c
@@ -1206,7 +1206,7 @@ static void et61x251_release_resources(struct kref *kref)
1206} 1206}
1207 1207
1208 1208
1209static int et61x251_open(struct inode* inode, struct file* filp) 1209static int et61x251_open(struct file *filp)
1210{ 1210{
1211 struct et61x251_device* cam; 1211 struct et61x251_device* cam;
1212 int err = 0; 1212 int err = 0;
@@ -1291,7 +1291,7 @@ out:
1291} 1291}
1292 1292
1293 1293
1294static int et61x251_release(struct inode* inode, struct file* filp) 1294static int et61x251_release(struct file *filp)
1295{ 1295{
1296 struct et61x251_device* cam; 1296 struct et61x251_device* cam;
1297 1297
@@ -2392,8 +2392,8 @@ et61x251_vidioc_s_parm(struct et61x251_device* cam, void __user * arg)
2392} 2392}
2393 2393
2394 2394
2395static int et61x251_ioctl_v4l2(struct inode* inode, struct file* filp, 2395static long et61x251_ioctl_v4l2(struct file *filp,
2396 unsigned int cmd, void __user * arg) 2396 unsigned int cmd, void __user *arg)
2397{ 2397{
2398 struct et61x251_device *cam = video_drvdata(filp); 2398 struct et61x251_device *cam = video_drvdata(filp);
2399 2399
@@ -2487,11 +2487,11 @@ static int et61x251_ioctl_v4l2(struct inode* inode, struct file* filp,
2487} 2487}
2488 2488
2489 2489
2490static int et61x251_ioctl(struct inode* inode, struct file* filp, 2490static long et61x251_ioctl(struct file *filp,
2491 unsigned int cmd, unsigned long arg) 2491 unsigned int cmd, unsigned long arg)
2492{ 2492{
2493 struct et61x251_device *cam = video_drvdata(filp); 2493 struct et61x251_device *cam = video_drvdata(filp);
2494 int err = 0; 2494 long err = 0;
2495 2495
2496 if (mutex_lock_interruptible(&cam->fileop_mutex)) 2496 if (mutex_lock_interruptible(&cam->fileop_mutex))
2497 return -ERESTARTSYS; 2497 return -ERESTARTSYS;
@@ -2511,7 +2511,7 @@ static int et61x251_ioctl(struct inode* inode, struct file* filp,
2511 2511
2512 V4LDBG(3, "et61x251", cmd); 2512 V4LDBG(3, "et61x251", cmd);
2513 2513
2514 err = et61x251_ioctl_v4l2(inode, filp, cmd, (void __user *)arg); 2514 err = et61x251_ioctl_v4l2(filp, cmd, (void __user *)arg);
2515 2515
2516 mutex_unlock(&cam->fileop_mutex); 2516 mutex_unlock(&cam->fileop_mutex);
2517 2517
@@ -2519,18 +2519,14 @@ static int et61x251_ioctl(struct inode* inode, struct file* filp,
2519} 2519}
2520 2520
2521 2521
2522static const struct file_operations et61x251_fops = { 2522static const struct v4l2_file_operations et61x251_fops = {
2523 .owner = THIS_MODULE, 2523 .owner = THIS_MODULE,
2524 .open = et61x251_open, 2524 .open = et61x251_open,
2525 .release = et61x251_release, 2525 .release = et61x251_release,
2526 .ioctl = et61x251_ioctl, 2526 .ioctl = et61x251_ioctl,
2527#ifdef CONFIG_COMPAT
2528 .compat_ioctl = v4l_compat_ioctl32,
2529#endif
2530 .read = et61x251_read, 2527 .read = et61x251_read,
2531 .poll = et61x251_poll, 2528 .poll = et61x251_poll,
2532 .mmap = et61x251_mmap, 2529 .mmap = et61x251_mmap,
2533 .llseek = no_llseek,
2534}; 2530};
2535 2531
2536/*****************************************************************************/ 2532/*****************************************************************************/
diff --git a/drivers/media/video/gspca/gspca.c b/drivers/media/video/gspca/gspca.c
index 8b9f3bde5740..5e36b9a4ae3e 100644
--- a/drivers/media/video/gspca/gspca.c
+++ b/drivers/media/video/gspca/gspca.c
@@ -875,7 +875,7 @@ static void gspca_release(struct video_device *vfd)
875 kfree(gspca_dev); 875 kfree(gspca_dev);
876} 876}
877 877
878static int dev_open(struct inode *inode, struct file *file) 878static int dev_open(struct file *file)
879{ 879{
880 struct gspca_dev *gspca_dev; 880 struct gspca_dev *gspca_dev;
881 int ret; 881 int ret;
@@ -922,7 +922,7 @@ out:
922 return ret; 922 return ret;
923} 923}
924 924
925static int dev_close(struct inode *inode, struct file *file) 925static int dev_close(struct file *file)
926{ 926{
927 struct gspca_dev *gspca_dev = file->private_data; 927 struct gspca_dev *gspca_dev = file->private_data;
928 928
@@ -1802,17 +1802,13 @@ out:
1802 return ret; 1802 return ret;
1803} 1803}
1804 1804
1805static struct file_operations dev_fops = { 1805static struct v4l2_file_operations dev_fops = {
1806 .owner = THIS_MODULE, 1806 .owner = THIS_MODULE,
1807 .open = dev_open, 1807 .open = dev_open,
1808 .release = dev_close, 1808 .release = dev_close,
1809 .read = dev_read, 1809 .read = dev_read,
1810 .mmap = dev_mmap, 1810 .mmap = dev_mmap,
1811 .unlocked_ioctl = __video_ioctl2, 1811 .unlocked_ioctl = video_ioctl2,
1812#ifdef CONFIG_COMPAT
1813 .compat_ioctl = v4l_compat_ioctl32,
1814#endif
1815 .llseek = no_llseek,
1816 .poll = dev_poll, 1812 .poll = dev_poll,
1817}; 1813};
1818 1814
diff --git a/drivers/media/video/hexium_gemini.c b/drivers/media/video/hexium_gemini.c
index 352f84d440fb..79393d1772e4 100644
--- a/drivers/media/video/hexium_gemini.c
+++ b/drivers/media/video/hexium_gemini.c
@@ -306,7 +306,7 @@ static int hexium_detach(struct saa7146_dev *dev)
306 return 0; 306 return 0;
307} 307}
308 308
309static int hexium_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg) 309static long hexium_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
310{ 310{
311 struct saa7146_dev *dev = fh->dev; 311 struct saa7146_dev *dev = fh->dev;
312 struct hexium *hexium = (struct hexium *) dev->ext_priv; 312 struct hexium *hexium = (struct hexium *) dev->ext_priv;
diff --git a/drivers/media/video/hexium_orion.c b/drivers/media/video/hexium_orion.c
index 8d3c1482e7ea..074bec711fe0 100644
--- a/drivers/media/video/hexium_orion.c
+++ b/drivers/media/video/hexium_orion.c
@@ -370,7 +370,7 @@ static int hexium_detach(struct saa7146_dev *dev)
370 return 0; 370 return 0;
371} 371}
372 372
373static int hexium_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg) 373static long hexium_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
374{ 374{
375 struct saa7146_dev *dev = fh->dev; 375 struct saa7146_dev *dev = fh->dev;
376 struct hexium *hexium = (struct hexium *) dev->ext_priv; 376 struct hexium *hexium = (struct hexium *) dev->ext_priv;
diff --git a/drivers/media/video/ivtv/ivtv-driver.c b/drivers/media/video/ivtv/ivtv-driver.c
index 08b762951759..e8e5921cdc34 100644
--- a/drivers/media/video/ivtv/ivtv-driver.c
+++ b/drivers/media/video/ivtv/ivtv-driver.c
@@ -902,18 +902,19 @@ static void ivtv_load_and_init_modules(struct ivtv *itv)
902 } 902 }
903 903
904 if (hw & IVTV_HW_SAA711X) { 904 if (hw & IVTV_HW_SAA711X) {
905 struct v4l2_chip_ident v = { V4L2_CHIP_MATCH_I2C_DRIVER, I2C_DRIVERID_SAA711X }; 905 struct v4l2_dbg_chip_ident v;
906 906
907 /* determine the exact saa711x model */ 907 /* determine the exact saa711x model */
908 itv->hw_flags &= ~IVTV_HW_SAA711X; 908 itv->hw_flags &= ~IVTV_HW_SAA711X;
909 909
910 v.match.type = V4L2_CHIP_MATCH_I2C_DRIVER;
911 strlcpy(v.match.name, "saa7115", sizeof(v.match.name));
910 ivtv_call_hw(itv, IVTV_HW_SAA711X, core, g_chip_ident, &v); 912 ivtv_call_hw(itv, IVTV_HW_SAA711X, core, g_chip_ident, &v);
911 if (v.ident == V4L2_IDENT_SAA7114) { 913 if (v.ident == V4L2_IDENT_SAA7114) {
912 itv->hw_flags |= IVTV_HW_SAA7114; 914 itv->hw_flags |= IVTV_HW_SAA7114;
913 /* VBI is not yet supported by the saa7114 driver. */ 915 /* VBI is not yet supported by the saa7114 driver. */
914 itv->v4l2_cap &= ~(V4L2_CAP_SLICED_VBI_CAPTURE|V4L2_CAP_VBI_CAPTURE); 916 itv->v4l2_cap &= ~(V4L2_CAP_SLICED_VBI_CAPTURE|V4L2_CAP_VBI_CAPTURE);
915 } 917 } else {
916 else {
917 itv->hw_flags |= IVTV_HW_SAA7115; 918 itv->hw_flags |= IVTV_HW_SAA7115;
918 } 919 }
919 itv->vbi.raw_decoder_line_size = 1443; 920 itv->vbi.raw_decoder_line_size = 1443;
diff --git a/drivers/media/video/ivtv/ivtv-fileops.c b/drivers/media/video/ivtv/ivtv-fileops.c
index 5eb587592e9d..d594bc29f07f 100644
--- a/drivers/media/video/ivtv/ivtv-fileops.c
+++ b/drivers/media/video/ivtv/ivtv-fileops.c
@@ -831,7 +831,7 @@ static void ivtv_stop_decoding(struct ivtv_open_id *id, int flags, u64 pts)
831 ivtv_release_stream(s); 831 ivtv_release_stream(s);
832} 832}
833 833
834int ivtv_v4l2_close(struct inode *inode, struct file *filp) 834int ivtv_v4l2_close(struct file *filp)
835{ 835{
836 struct ivtv_open_id *id = filp->private_data; 836 struct ivtv_open_id *id = filp->private_data;
837 struct ivtv *itv = id->itv; 837 struct ivtv *itv = id->itv;
@@ -978,7 +978,7 @@ static int ivtv_serialized_open(struct ivtv_stream *s, struct file *filp)
978 return 0; 978 return 0;
979} 979}
980 980
981int ivtv_v4l2_open(struct inode *inode, struct file *filp) 981int ivtv_v4l2_open(struct file *filp)
982{ 982{
983 int res; 983 int res;
984 struct ivtv *itv = NULL; 984 struct ivtv *itv = NULL;
diff --git a/drivers/media/video/ivtv/ivtv-fileops.h b/drivers/media/video/ivtv/ivtv-fileops.h
index df81e790147f..049a2923965d 100644
--- a/drivers/media/video/ivtv/ivtv-fileops.h
+++ b/drivers/media/video/ivtv/ivtv-fileops.h
@@ -22,12 +22,12 @@
22#define IVTV_FILEOPS_H 22#define IVTV_FILEOPS_H
23 23
24/* Testing/Debugging */ 24/* Testing/Debugging */
25int ivtv_v4l2_open(struct inode *inode, struct file *filp); 25int ivtv_v4l2_open(struct file *filp);
26ssize_t ivtv_v4l2_read(struct file *filp, char __user *buf, size_t count, 26ssize_t ivtv_v4l2_read(struct file *filp, char __user *buf, size_t count,
27 loff_t * pos); 27 loff_t * pos);
28ssize_t ivtv_v4l2_write(struct file *filp, const char __user *buf, size_t count, 28ssize_t ivtv_v4l2_write(struct file *filp, const char __user *buf, size_t count,
29 loff_t * pos); 29 loff_t * pos);
30int ivtv_v4l2_close(struct inode *inode, struct file *filp); 30int ivtv_v4l2_close(struct file *filp);
31unsigned int ivtv_v4l2_enc_poll(struct file *filp, poll_table * wait); 31unsigned int ivtv_v4l2_enc_poll(struct file *filp, poll_table * wait);
32unsigned int ivtv_v4l2_dec_poll(struct file *filp, poll_table * wait); 32unsigned int ivtv_v4l2_dec_poll(struct file *filp, poll_table * wait);
33int ivtv_start_capture(struct ivtv_open_id *id); 33int ivtv_start_capture(struct ivtv_open_id *id);
diff --git a/drivers/media/video/ivtv/ivtv-ioctl.c b/drivers/media/video/ivtv/ivtv-ioctl.c
index cd990a4b81a9..f6b3ef6e691b 100644
--- a/drivers/media/video/ivtv/ivtv-ioctl.c
+++ b/drivers/media/video/ivtv/ivtv-ioctl.c
@@ -674,19 +674,19 @@ static int ivtv_s_fmt_vid_out_overlay(struct file *file, void *fh, struct v4l2_f
674 return ret; 674 return ret;
675} 675}
676 676
677static int ivtv_g_chip_ident(struct file *file, void *fh, struct v4l2_chip_ident *chip) 677static int ivtv_g_chip_ident(struct file *file, void *fh, struct v4l2_dbg_chip_ident *chip)
678{ 678{
679 struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; 679 struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv;
680 680
681 chip->ident = V4L2_IDENT_NONE; 681 chip->ident = V4L2_IDENT_NONE;
682 chip->revision = 0; 682 chip->revision = 0;
683 if (chip->match_type == V4L2_CHIP_MATCH_HOST) { 683 if (chip->match.type == V4L2_CHIP_MATCH_HOST) {
684 if (v4l2_chip_match_host(chip->match_type, chip->match_chip)) 684 if (v4l2_chip_match_host(&chip->match))
685 chip->ident = itv->has_cx23415 ? V4L2_IDENT_CX23415 : V4L2_IDENT_CX23416; 685 chip->ident = itv->has_cx23415 ? V4L2_IDENT_CX23415 : V4L2_IDENT_CX23416;
686 return 0; 686 return 0;
687 } 687 }
688 if (chip->match_type != V4L2_CHIP_MATCH_I2C_DRIVER && 688 if (chip->match.type != V4L2_CHIP_MATCH_I2C_DRIVER &&
689 chip->match_type != V4L2_CHIP_MATCH_I2C_ADDR) 689 chip->match.type != V4L2_CHIP_MATCH_I2C_ADDR)
690 return -EINVAL; 690 return -EINVAL;
691 /* TODO: is this correct? */ 691 /* TODO: is this correct? */
692 return ivtv_call_all_err(itv, core, g_chip_ident, chip); 692 return ivtv_call_all_err(itv, core, g_chip_ident, chip);
@@ -695,7 +695,7 @@ static int ivtv_g_chip_ident(struct file *file, void *fh, struct v4l2_chip_ident
695#ifdef CONFIG_VIDEO_ADV_DEBUG 695#ifdef CONFIG_VIDEO_ADV_DEBUG
696static int ivtv_itvc(struct ivtv *itv, unsigned int cmd, void *arg) 696static int ivtv_itvc(struct ivtv *itv, unsigned int cmd, void *arg)
697{ 697{
698 struct v4l2_register *regs = arg; 698 struct v4l2_dbg_register *regs = arg;
699 volatile u8 __iomem *reg_start; 699 volatile u8 __iomem *reg_start;
700 700
701 if (!capable(CAP_SYS_ADMIN)) 701 if (!capable(CAP_SYS_ADMIN))
@@ -710,6 +710,7 @@ static int ivtv_itvc(struct ivtv *itv, unsigned int cmd, void *arg)
710 else 710 else
711 return -EINVAL; 711 return -EINVAL;
712 712
713 regs->size = 4;
713 if (cmd == VIDIOC_DBG_G_REGISTER) 714 if (cmd == VIDIOC_DBG_G_REGISTER)
714 regs->val = readl(regs->reg + reg_start); 715 regs->val = readl(regs->reg + reg_start);
715 else 716 else
@@ -717,11 +718,11 @@ static int ivtv_itvc(struct ivtv *itv, unsigned int cmd, void *arg)
717 return 0; 718 return 0;
718} 719}
719 720
720static int ivtv_g_register(struct file *file, void *fh, struct v4l2_register *reg) 721static int ivtv_g_register(struct file *file, void *fh, struct v4l2_dbg_register *reg)
721{ 722{
722 struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; 723 struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv;
723 724
724 if (v4l2_chip_match_host(reg->match_type, reg->match_chip)) 725 if (v4l2_chip_match_host(&reg->match))
725 return ivtv_itvc(itv, VIDIOC_DBG_G_REGISTER, reg); 726 return ivtv_itvc(itv, VIDIOC_DBG_G_REGISTER, reg);
726 /* TODO: subdev errors should not be ignored, this should become a 727 /* TODO: subdev errors should not be ignored, this should become a
727 subdev helper function. */ 728 subdev helper function. */
@@ -729,11 +730,11 @@ static int ivtv_g_register(struct file *file, void *fh, struct v4l2_register *re
729 return 0; 730 return 0;
730} 731}
731 732
732static int ivtv_s_register(struct file *file, void *fh, struct v4l2_register *reg) 733static int ivtv_s_register(struct file *file, void *fh, struct v4l2_dbg_register *reg)
733{ 734{
734 struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; 735 struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv;
735 736
736 if (v4l2_chip_match_host(reg->match_type, reg->match_chip)) 737 if (v4l2_chip_match_host(&reg->match))
737 return ivtv_itvc(itv, VIDIOC_DBG_S_REGISTER, reg); 738 return ivtv_itvc(itv, VIDIOC_DBG_S_REGISTER, reg);
738 /* TODO: subdev errors should not be ignored, this should become a 739 /* TODO: subdev errors should not be ignored, this should become a
739 subdev helper function. */ 740 subdev helper function. */
@@ -1725,7 +1726,7 @@ static int ivtv_decoder_ioctls(struct file *filp, unsigned int cmd, void *arg)
1725 return 0; 1726 return 0;
1726} 1727}
1727 1728
1728static int ivtv_default(struct file *file, void *fh, int cmd, void *arg) 1729static long ivtv_default(struct file *file, void *fh, int cmd, void *arg)
1729{ 1730{
1730 struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; 1731 struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv;
1731 1732
@@ -1827,7 +1828,7 @@ static long ivtv_serialized_ioctl(struct ivtv *itv, struct file *filp,
1827 1828
1828 if (ivtv_debug & IVTV_DBGFLG_IOCTL) 1829 if (ivtv_debug & IVTV_DBGFLG_IOCTL)
1829 vfd->debug = V4L2_DEBUG_IOCTL | V4L2_DEBUG_IOCTL_ARG; 1830 vfd->debug = V4L2_DEBUG_IOCTL | V4L2_DEBUG_IOCTL_ARG;
1830 ret = __video_ioctl2(filp, cmd, arg); 1831 ret = video_ioctl2(filp, cmd, arg);
1831 vfd->debug = 0; 1832 vfd->debug = 0;
1832 return ret; 1833 return ret;
1833} 1834}
diff --git a/drivers/media/video/ivtv/ivtv-streams.c b/drivers/media/video/ivtv/ivtv-streams.c
index f77d764707b2..854a950af78c 100644
--- a/drivers/media/video/ivtv/ivtv-streams.c
+++ b/drivers/media/video/ivtv/ivtv-streams.c
@@ -43,24 +43,22 @@
43#include "ivtv-cards.h" 43#include "ivtv-cards.h"
44#include "ivtv-streams.h" 44#include "ivtv-streams.h"
45 45
46static const struct file_operations ivtv_v4l2_enc_fops = { 46static const struct v4l2_file_operations ivtv_v4l2_enc_fops = {
47 .owner = THIS_MODULE, 47 .owner = THIS_MODULE,
48 .read = ivtv_v4l2_read, 48 .read = ivtv_v4l2_read,
49 .write = ivtv_v4l2_write, 49 .write = ivtv_v4l2_write,
50 .open = ivtv_v4l2_open, 50 .open = ivtv_v4l2_open,
51 .unlocked_ioctl = ivtv_v4l2_ioctl, 51 .unlocked_ioctl = ivtv_v4l2_ioctl,
52 .compat_ioctl = v4l_compat_ioctl32,
53 .release = ivtv_v4l2_close, 52 .release = ivtv_v4l2_close,
54 .poll = ivtv_v4l2_enc_poll, 53 .poll = ivtv_v4l2_enc_poll,
55}; 54};
56 55
57static const struct file_operations ivtv_v4l2_dec_fops = { 56static const struct v4l2_file_operations ivtv_v4l2_dec_fops = {
58 .owner = THIS_MODULE, 57 .owner = THIS_MODULE,
59 .read = ivtv_v4l2_read, 58 .read = ivtv_v4l2_read,
60 .write = ivtv_v4l2_write, 59 .write = ivtv_v4l2_write,
61 .open = ivtv_v4l2_open, 60 .open = ivtv_v4l2_open,
62 .unlocked_ioctl = ivtv_v4l2_ioctl, 61 .unlocked_ioctl = ivtv_v4l2_ioctl,
63 .compat_ioctl = v4l_compat_ioctl32,
64 .release = ivtv_v4l2_close, 62 .release = ivtv_v4l2_close,
65 .poll = ivtv_v4l2_dec_poll, 63 .poll = ivtv_v4l2_dec_poll,
66}; 64};
@@ -78,7 +76,7 @@ static struct {
78 int num_offset; 76 int num_offset;
79 int dma, pio; 77 int dma, pio;
80 enum v4l2_buf_type buf_type; 78 enum v4l2_buf_type buf_type;
81 const struct file_operations *fops; 79 const struct v4l2_file_operations *fops;
82} ivtv_stream_info[] = { 80} ivtv_stream_info[] = {
83 { /* IVTV_ENC_STREAM_TYPE_MPG */ 81 { /* IVTV_ENC_STREAM_TYPE_MPG */
84 "encoder MPG", 82 "encoder MPG",
diff --git a/drivers/media/video/m52790.c b/drivers/media/video/m52790.c
index 07be14a9fe7b..de397ef57b44 100644
--- a/drivers/media/video/m52790.c
+++ b/drivers/media/video/m52790.c
@@ -80,29 +80,28 @@ static int m52790_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing *r
80} 80}
81 81
82#ifdef CONFIG_VIDEO_ADV_DEBUG 82#ifdef CONFIG_VIDEO_ADV_DEBUG
83static int m52790_g_register(struct v4l2_subdev *sd, struct v4l2_register *reg) 83static int m52790_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg)
84{ 84{
85 struct m52790_state *state = to_state(sd); 85 struct m52790_state *state = to_state(sd);
86 struct i2c_client *client = v4l2_get_subdevdata(sd); 86 struct i2c_client *client = v4l2_get_subdevdata(sd);
87 87
88 if (!v4l2_chip_match_i2c_client(client, 88 if (!v4l2_chip_match_i2c_client(client, &reg->match))
89 reg->match_type, reg->match_chip))
90 return -EINVAL; 89 return -EINVAL;
91 if (!capable(CAP_SYS_ADMIN)) 90 if (!capable(CAP_SYS_ADMIN))
92 return -EPERM; 91 return -EPERM;
93 if (reg->reg != 0) 92 if (reg->reg != 0)
94 return -EINVAL; 93 return -EINVAL;
94 reg->size = 1;
95 reg->val = state->input | state->output; 95 reg->val = state->input | state->output;
96 return 0; 96 return 0;
97} 97}
98 98
99static int m52790_s_register(struct v4l2_subdev *sd, struct v4l2_register *reg) 99static int m52790_s_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg)
100{ 100{
101 struct m52790_state *state = to_state(sd); 101 struct m52790_state *state = to_state(sd);
102 struct i2c_client *client = v4l2_get_subdevdata(sd); 102 struct i2c_client *client = v4l2_get_subdevdata(sd);
103 103
104 if (!v4l2_chip_match_i2c_client(client, 104 if (!v4l2_chip_match_i2c_client(client, &reg->match))
105 reg->match_type, reg->match_chip))
106 return -EINVAL; 105 return -EINVAL;
107 if (!capable(CAP_SYS_ADMIN)) 106 if (!capable(CAP_SYS_ADMIN))
108 return -EPERM; 107 return -EPERM;
@@ -115,7 +114,7 @@ static int m52790_s_register(struct v4l2_subdev *sd, struct v4l2_register *reg)
115} 114}
116#endif 115#endif
117 116
118static int m52790_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_chip_ident *chip) 117static int m52790_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip)
119{ 118{
120 struct i2c_client *client = v4l2_get_subdevdata(sd); 119 struct i2c_client *client = v4l2_get_subdevdata(sd);
121 120
diff --git a/drivers/media/video/meye.c b/drivers/media/video/meye.c
index 6418f4a78f2a..b76e33d5c867 100644
--- a/drivers/media/video/meye.c
+++ b/drivers/media/video/meye.c
@@ -841,7 +841,7 @@ again:
841/* video4linux integration */ 841/* video4linux integration */
842/****************************************************************************/ 842/****************************************************************************/
843 843
844static int meye_open(struct inode *inode, struct file *file) 844static int meye_open(struct file *file)
845{ 845{
846 int i; 846 int i;
847 847
@@ -863,7 +863,7 @@ static int meye_open(struct inode *inode, struct file *file)
863 return 0; 863 return 0;
864} 864}
865 865
866static int meye_release(struct inode *inode, struct file *file) 866static int meye_release(struct file *file)
867{ 867{
868 mchip_hic_stop(); 868 mchip_hic_stop();
869 mchip_dma_free(); 869 mchip_dma_free();
@@ -1577,7 +1577,7 @@ static int vidioc_streamoff(struct file *file, void *fh, enum v4l2_buf_type i)
1577 return 0; 1577 return 0;
1578} 1578}
1579 1579
1580static int vidioc_default(struct file *file, void *fh, int cmd, void *arg) 1580static long vidioc_default(struct file *file, void *fh, int cmd, void *arg)
1581{ 1581{
1582 switch (cmd) { 1582 switch (cmd) {
1583 case MEYEIOC_G_PARAMS: 1583 case MEYEIOC_G_PARAMS:
@@ -1684,17 +1684,13 @@ static int meye_mmap(struct file *file, struct vm_area_struct *vma)
1684 return 0; 1684 return 0;
1685} 1685}
1686 1686
1687static const struct file_operations meye_fops = { 1687static const struct v4l2_file_operations meye_fops = {
1688 .owner = THIS_MODULE, 1688 .owner = THIS_MODULE,
1689 .open = meye_open, 1689 .open = meye_open,
1690 .release = meye_release, 1690 .release = meye_release,
1691 .mmap = meye_mmap, 1691 .mmap = meye_mmap,
1692 .ioctl = video_ioctl2, 1692 .ioctl = video_ioctl2,
1693#ifdef CONFIG_COMPAT
1694 .compat_ioctl = v4l_compat_ioctl32,
1695#endif
1696 .poll = meye_poll, 1693 .poll = meye_poll,
1697 .llseek = no_llseek,
1698}; 1694};
1699 1695
1700static const struct v4l2_ioctl_ops meye_ioctl_ops = { 1696static const struct v4l2_ioctl_ops meye_ioctl_ops = {
diff --git a/drivers/media/video/msp3400-driver.c b/drivers/media/video/msp3400-driver.c
index a622dbb72ed8..4d7a91852117 100644
--- a/drivers/media/video/msp3400-driver.c
+++ b/drivers/media/video/msp3400-driver.c
@@ -483,7 +483,7 @@ static int msp_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
483} 483}
484 484
485#ifdef CONFIG_VIDEO_ALLOW_V4L1 485#ifdef CONFIG_VIDEO_ALLOW_V4L1
486static int msp_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg) 486static long msp_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
487{ 487{
488 struct msp_state *state = to_state(sd); 488 struct msp_state *state = to_state(sd);
489 struct i2c_client *client = v4l2_get_subdevdata(sd); 489 struct i2c_client *client = v4l2_get_subdevdata(sd);
@@ -733,7 +733,7 @@ static int msp_queryctrl(struct v4l2_subdev *sd, struct v4l2_queryctrl *qc)
733 return 0; 733 return 0;
734} 734}
735 735
736static int msp_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_chip_ident *chip) 736static int msp_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip)
737{ 737{
738 struct msp_state *state = to_state(sd); 738 struct msp_state *state = to_state(sd);
739 struct i2c_client *client = v4l2_get_subdevdata(sd); 739 struct i2c_client *client = v4l2_get_subdevdata(sd);
diff --git a/drivers/media/video/mt9m001.c b/drivers/media/video/mt9m001.c
index 1a1a12453672..c1bf75ef2741 100644
--- a/drivers/media/video/mt9m001.c
+++ b/drivers/media/video/mt9m001.c
@@ -343,14 +343,14 @@ static int mt9m001_try_fmt(struct soc_camera_device *icd,
343} 343}
344 344
345static int mt9m001_get_chip_id(struct soc_camera_device *icd, 345static int mt9m001_get_chip_id(struct soc_camera_device *icd,
346 struct v4l2_chip_ident *id) 346 struct v4l2_dbg_chip_ident *id)
347{ 347{
348 struct mt9m001 *mt9m001 = container_of(icd, struct mt9m001, icd); 348 struct mt9m001 *mt9m001 = container_of(icd, struct mt9m001, icd);
349 349
350 if (id->match_type != V4L2_CHIP_MATCH_I2C_ADDR) 350 if (id->match.type != V4L2_CHIP_MATCH_I2C_ADDR)
351 return -EINVAL; 351 return -EINVAL;
352 352
353 if (id->match_chip != mt9m001->client->addr) 353 if (id->match.addr != mt9m001->client->addr)
354 return -ENODEV; 354 return -ENODEV;
355 355
356 id->ident = mt9m001->model; 356 id->ident = mt9m001->model;
@@ -361,16 +361,17 @@ static int mt9m001_get_chip_id(struct soc_camera_device *icd,
361 361
362#ifdef CONFIG_VIDEO_ADV_DEBUG 362#ifdef CONFIG_VIDEO_ADV_DEBUG
363static int mt9m001_get_register(struct soc_camera_device *icd, 363static int mt9m001_get_register(struct soc_camera_device *icd,
364 struct v4l2_register *reg) 364 struct v4l2_dbg_register *reg)
365{ 365{
366 struct mt9m001 *mt9m001 = container_of(icd, struct mt9m001, icd); 366 struct mt9m001 *mt9m001 = container_of(icd, struct mt9m001, icd);
367 367
368 if (reg->match_type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0xff) 368 if (reg->match.type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0xff)
369 return -EINVAL; 369 return -EINVAL;
370 370
371 if (reg->match_chip != mt9m001->client->addr) 371 if (reg->match.addr != mt9m001->client->addr)
372 return -ENODEV; 372 return -ENODEV;
373 373
374 reg->size = 2;
374 reg->val = reg_read(icd, reg->reg); 375 reg->val = reg_read(icd, reg->reg);
375 376
376 if (reg->val > 0xffff) 377 if (reg->val > 0xffff)
@@ -380,14 +381,14 @@ static int mt9m001_get_register(struct soc_camera_device *icd,
380} 381}
381 382
382static int mt9m001_set_register(struct soc_camera_device *icd, 383static int mt9m001_set_register(struct soc_camera_device *icd,
383 struct v4l2_register *reg) 384 struct v4l2_dbg_register *reg)
384{ 385{
385 struct mt9m001 *mt9m001 = container_of(icd, struct mt9m001, icd); 386 struct mt9m001 *mt9m001 = container_of(icd, struct mt9m001, icd);
386 387
387 if (reg->match_type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0xff) 388 if (reg->match.type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0xff)
388 return -EINVAL; 389 return -EINVAL;
389 390
390 if (reg->match_chip != mt9m001->client->addr) 391 if (reg->match.addr != mt9m001->client->addr)
391 return -ENODEV; 392 return -ENODEV;
392 393
393 if (reg_write(icd, reg->reg, reg->val) < 0) 394 if (reg_write(icd, reg->reg, reg->val) < 0)
diff --git a/drivers/media/video/mt9m111.c b/drivers/media/video/mt9m111.c
index c89ea41fe259..5b8e20979cce 100644
--- a/drivers/media/video/mt9m111.c
+++ b/drivers/media/video/mt9m111.c
@@ -514,14 +514,14 @@ static int mt9m111_try_fmt(struct soc_camera_device *icd,
514} 514}
515 515
516static int mt9m111_get_chip_id(struct soc_camera_device *icd, 516static int mt9m111_get_chip_id(struct soc_camera_device *icd,
517 struct v4l2_chip_ident *id) 517 struct v4l2_dbg_chip_ident *id)
518{ 518{
519 struct mt9m111 *mt9m111 = container_of(icd, struct mt9m111, icd); 519 struct mt9m111 *mt9m111 = container_of(icd, struct mt9m111, icd);
520 520
521 if (id->match_type != V4L2_CHIP_MATCH_I2C_ADDR) 521 if (id->match.type != V4L2_CHIP_MATCH_I2C_ADDR)
522 return -EINVAL; 522 return -EINVAL;
523 523
524 if (id->match_chip != mt9m111->client->addr) 524 if (id->match.addr != mt9m111->client->addr)
525 return -ENODEV; 525 return -ENODEV;
526 526
527 id->ident = mt9m111->model; 527 id->ident = mt9m111->model;
@@ -532,18 +532,19 @@ static int mt9m111_get_chip_id(struct soc_camera_device *icd,
532 532
533#ifdef CONFIG_VIDEO_ADV_DEBUG 533#ifdef CONFIG_VIDEO_ADV_DEBUG
534static int mt9m111_get_register(struct soc_camera_device *icd, 534static int mt9m111_get_register(struct soc_camera_device *icd,
535 struct v4l2_register *reg) 535 struct v4l2_dbg_register *reg)
536{ 536{
537 int val; 537 int val;
538 538
539 struct mt9m111 *mt9m111 = container_of(icd, struct mt9m111, icd); 539 struct mt9m111 *mt9m111 = container_of(icd, struct mt9m111, icd);
540 540
541 if (reg->match_type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0x2ff) 541 if (reg->match.type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0x2ff)
542 return -EINVAL; 542 return -EINVAL;
543 if (reg->match_chip != mt9m111->client->addr) 543 if (reg->match.addr != mt9m111->client->addr)
544 return -ENODEV; 544 return -ENODEV;
545 545
546 val = mt9m111_reg_read(icd, reg->reg); 546 val = mt9m111_reg_read(icd, reg->reg);
547 reg->size = 2;
547 reg->val = (u64)val; 548 reg->val = (u64)val;
548 549
549 if (reg->val > 0xffff) 550 if (reg->val > 0xffff)
@@ -553,14 +554,14 @@ static int mt9m111_get_register(struct soc_camera_device *icd,
553} 554}
554 555
555static int mt9m111_set_register(struct soc_camera_device *icd, 556static int mt9m111_set_register(struct soc_camera_device *icd,
556 struct v4l2_register *reg) 557 struct v4l2_dbg_register *reg)
557{ 558{
558 struct mt9m111 *mt9m111 = container_of(icd, struct mt9m111, icd); 559 struct mt9m111 *mt9m111 = container_of(icd, struct mt9m111, icd);
559 560
560 if (reg->match_type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0x2ff) 561 if (reg->match.type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0x2ff)
561 return -EINVAL; 562 return -EINVAL;
562 563
563 if (reg->match_chip != mt9m111->client->addr) 564 if (reg->match.addr != mt9m111->client->addr)
564 return -ENODEV; 565 return -ENODEV;
565 566
566 if (mt9m111_reg_write(icd, reg->reg, reg->val) < 0) 567 if (mt9m111_reg_write(icd, reg->reg, reg->val) < 0)
diff --git a/drivers/media/video/mt9t031.c b/drivers/media/video/mt9t031.c
index 1a9d53966d06..349d8e365530 100644
--- a/drivers/media/video/mt9t031.c
+++ b/drivers/media/video/mt9t031.c
@@ -326,14 +326,14 @@ static int mt9t031_try_fmt(struct soc_camera_device *icd,
326} 326}
327 327
328static int mt9t031_get_chip_id(struct soc_camera_device *icd, 328static int mt9t031_get_chip_id(struct soc_camera_device *icd,
329 struct v4l2_chip_ident *id) 329 struct v4l2_dbg_chip_ident *id)
330{ 330{
331 struct mt9t031 *mt9t031 = container_of(icd, struct mt9t031, icd); 331 struct mt9t031 *mt9t031 = container_of(icd, struct mt9t031, icd);
332 332
333 if (id->match_type != V4L2_CHIP_MATCH_I2C_ADDR) 333 if (id->match.type != V4L2_CHIP_MATCH_I2C_ADDR)
334 return -EINVAL; 334 return -EINVAL;
335 335
336 if (id->match_chip != mt9t031->client->addr) 336 if (id->match.addr != mt9t031->client->addr)
337 return -ENODEV; 337 return -ENODEV;
338 338
339 id->ident = mt9t031->model; 339 id->ident = mt9t031->model;
@@ -344,14 +344,14 @@ static int mt9t031_get_chip_id(struct soc_camera_device *icd,
344 344
345#ifdef CONFIG_VIDEO_ADV_DEBUG 345#ifdef CONFIG_VIDEO_ADV_DEBUG
346static int mt9t031_get_register(struct soc_camera_device *icd, 346static int mt9t031_get_register(struct soc_camera_device *icd,
347 struct v4l2_register *reg) 347 struct v4l2_dbg_register *reg)
348{ 348{
349 struct mt9t031 *mt9t031 = container_of(icd, struct mt9t031, icd); 349 struct mt9t031 *mt9t031 = container_of(icd, struct mt9t031, icd);
350 350
351 if (reg->match_type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0xff) 351 if (reg->match.type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0xff)
352 return -EINVAL; 352 return -EINVAL;
353 353
354 if (reg->match_chip != mt9t031->client->addr) 354 if (reg->match.addr != mt9t031->client->addr)
355 return -ENODEV; 355 return -ENODEV;
356 356
357 reg->val = reg_read(icd, reg->reg); 357 reg->val = reg_read(icd, reg->reg);
@@ -363,14 +363,14 @@ static int mt9t031_get_register(struct soc_camera_device *icd,
363} 363}
364 364
365static int mt9t031_set_register(struct soc_camera_device *icd, 365static int mt9t031_set_register(struct soc_camera_device *icd,
366 struct v4l2_register *reg) 366 struct v4l2_dbg_register *reg)
367{ 367{
368 struct mt9t031 *mt9t031 = container_of(icd, struct mt9t031, icd); 368 struct mt9t031 *mt9t031 = container_of(icd, struct mt9t031, icd);
369 369
370 if (reg->match_type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0xff) 370 if (reg->match.type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0xff)
371 return -EINVAL; 371 return -EINVAL;
372 372
373 if (reg->match_chip != mt9t031->client->addr) 373 if (reg->match.addr != mt9t031->client->addr)
374 return -ENODEV; 374 return -ENODEV;
375 375
376 if (reg_write(icd, reg->reg, reg->val) < 0) 376 if (reg_write(icd, reg->reg, reg->val) < 0)
diff --git a/drivers/media/video/mt9v022.c b/drivers/media/video/mt9v022.c
index 14a5f9c21ffa..b04c8cb1644d 100644
--- a/drivers/media/video/mt9v022.c
+++ b/drivers/media/video/mt9v022.c
@@ -422,14 +422,14 @@ static int mt9v022_try_fmt(struct soc_camera_device *icd,
422} 422}
423 423
424static int mt9v022_get_chip_id(struct soc_camera_device *icd, 424static int mt9v022_get_chip_id(struct soc_camera_device *icd,
425 struct v4l2_chip_ident *id) 425 struct v4l2_dbg_chip_ident *id)
426{ 426{
427 struct mt9v022 *mt9v022 = container_of(icd, struct mt9v022, icd); 427 struct mt9v022 *mt9v022 = container_of(icd, struct mt9v022, icd);
428 428
429 if (id->match_type != V4L2_CHIP_MATCH_I2C_ADDR) 429 if (id->match.type != V4L2_CHIP_MATCH_I2C_ADDR)
430 return -EINVAL; 430 return -EINVAL;
431 431
432 if (id->match_chip != mt9v022->client->addr) 432 if (id->match.addr != mt9v022->client->addr)
433 return -ENODEV; 433 return -ENODEV;
434 434
435 id->ident = mt9v022->model; 435 id->ident = mt9v022->model;
@@ -440,16 +440,17 @@ static int mt9v022_get_chip_id(struct soc_camera_device *icd,
440 440
441#ifdef CONFIG_VIDEO_ADV_DEBUG 441#ifdef CONFIG_VIDEO_ADV_DEBUG
442static int mt9v022_get_register(struct soc_camera_device *icd, 442static int mt9v022_get_register(struct soc_camera_device *icd,
443 struct v4l2_register *reg) 443 struct v4l2_dbg_register *reg)
444{ 444{
445 struct mt9v022 *mt9v022 = container_of(icd, struct mt9v022, icd); 445 struct mt9v022 *mt9v022 = container_of(icd, struct mt9v022, icd);
446 446
447 if (reg->match_type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0xff) 447 if (reg->match.type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0xff)
448 return -EINVAL; 448 return -EINVAL;
449 449
450 if (reg->match_chip != mt9v022->client->addr) 450 if (reg->match.addr != mt9v022->client->addr)
451 return -ENODEV; 451 return -ENODEV;
452 452
453 reg->size = 2;
453 reg->val = reg_read(icd, reg->reg); 454 reg->val = reg_read(icd, reg->reg);
454 455
455 if (reg->val > 0xffff) 456 if (reg->val > 0xffff)
@@ -459,14 +460,14 @@ static int mt9v022_get_register(struct soc_camera_device *icd,
459} 460}
460 461
461static int mt9v022_set_register(struct soc_camera_device *icd, 462static int mt9v022_set_register(struct soc_camera_device *icd,
462 struct v4l2_register *reg) 463 struct v4l2_dbg_register *reg)
463{ 464{
464 struct mt9v022 *mt9v022 = container_of(icd, struct mt9v022, icd); 465 struct mt9v022 *mt9v022 = container_of(icd, struct mt9v022, icd);
465 466
466 if (reg->match_type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0xff) 467 if (reg->match.type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0xff)
467 return -EINVAL; 468 return -EINVAL;
468 469
469 if (reg->match_chip != mt9v022->client->addr) 470 if (reg->match.addr != mt9v022->client->addr)
470 return -ENODEV; 471 return -ENODEV;
471 472
472 if (reg_write(icd, reg->reg, reg->val) < 0) 473 if (reg_write(icd, reg->reg, reg->val) < 0)
diff --git a/drivers/media/video/mxb.c b/drivers/media/video/mxb.c
index 7f130284b5c7..e3cbe14c349a 100644
--- a/drivers/media/video/mxb.c
+++ b/drivers/media/video/mxb.c
@@ -489,7 +489,7 @@ static int mxb_detach(struct saa7146_dev *dev)
489 return 0; 489 return 0;
490} 490}
491 491
492static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg) 492static long mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
493{ 493{
494 struct saa7146_dev *dev = fh->dev; 494 struct saa7146_dev *dev = fh->dev;
495 struct mxb *mxb = (struct mxb *)dev->ext_priv; 495 struct mxb *mxb = (struct mxb *)dev->ext_priv;
diff --git a/drivers/media/video/omap24xxcam.c b/drivers/media/video/omap24xxcam.c
index 85c3c7c92af1..73eb656acfe3 100644
--- a/drivers/media/video/omap24xxcam.c
+++ b/drivers/media/video/omap24xxcam.c
@@ -1454,9 +1454,9 @@ static int omap24xxcam_mmap(struct file *file, struct vm_area_struct *vma)
1454 return rval; 1454 return rval;
1455} 1455}
1456 1456
1457static int omap24xxcam_open(struct inode *inode, struct file *file) 1457static int omap24xxcam_open(struct file *file)
1458{ 1458{
1459 int minor = iminor(inode); 1459 int minor = video_devdata(file)->minor;
1460 struct omap24xxcam_device *cam = omap24xxcam.priv; 1460 struct omap24xxcam_device *cam = omap24xxcam.priv;
1461 struct omap24xxcam_fh *fh; 1461 struct omap24xxcam_fh *fh;
1462 struct v4l2_format format; 1462 struct v4l2_format format;
@@ -1511,7 +1511,7 @@ out_try_module_get:
1511 return -ENODEV; 1511 return -ENODEV;
1512} 1512}
1513 1513
1514static int omap24xxcam_release(struct inode *inode, struct file *file) 1514static int omap24xxcam_release(struct file *file)
1515{ 1515{
1516 struct omap24xxcam_fh *fh = file->private_data; 1516 struct omap24xxcam_fh *fh = file->private_data;
1517 struct omap24xxcam_device *cam = fh->cam; 1517 struct omap24xxcam_device *cam = fh->cam;
@@ -1559,8 +1559,7 @@ static int omap24xxcam_release(struct inode *inode, struct file *file)
1559 return 0; 1559 return 0;
1560} 1560}
1561 1561
1562static struct file_operations omap24xxcam_fops = { 1562static struct v4l2_file_operations omap24xxcam_fops = {
1563 .llseek = no_llseek,
1564 .ioctl = video_ioctl2, 1563 .ioctl = video_ioctl2,
1565 .poll = omap24xxcam_poll, 1564 .poll = omap24xxcam_poll,
1566 .mmap = omap24xxcam_mmap, 1565 .mmap = omap24xxcam_mmap,
diff --git a/drivers/media/video/ov511.c b/drivers/media/video/ov511.c
index 6ee9b69cc4a9..9af5532db142 100644
--- a/drivers/media/video/ov511.c
+++ b/drivers/media/video/ov511.c
@@ -3915,7 +3915,7 @@ ov51x_dealloc(struct usb_ov511 *ov)
3915 ***************************************************************************/ 3915 ***************************************************************************/
3916 3916
3917static int 3917static int
3918ov51x_v4l1_open(struct inode *inode, struct file *file) 3918ov51x_v4l1_open(struct file *file)
3919{ 3919{
3920 struct video_device *vdev = video_devdata(file); 3920 struct video_device *vdev = video_devdata(file);
3921 struct usb_ov511 *ov = video_get_drvdata(vdev); 3921 struct usb_ov511 *ov = video_get_drvdata(vdev);
@@ -3972,7 +3972,7 @@ out:
3972} 3972}
3973 3973
3974static int 3974static int
3975ov51x_v4l1_close(struct inode *inode, struct file *file) 3975ov51x_v4l1_close(struct file *file)
3976{ 3976{
3977 struct video_device *vdev = file->private_data; 3977 struct video_device *vdev = file->private_data;
3978 struct usb_ov511 *ov = video_get_drvdata(vdev); 3978 struct usb_ov511 *ov = video_get_drvdata(vdev);
@@ -4010,7 +4010,7 @@ ov51x_v4l1_close(struct inode *inode, struct file *file)
4010} 4010}
4011 4011
4012/* Do not call this function directly! */ 4012/* Do not call this function directly! */
4013static int 4013static long
4014ov51x_v4l1_ioctl_internal(struct file *file, unsigned int cmd, void *arg) 4014ov51x_v4l1_ioctl_internal(struct file *file, unsigned int cmd, void *arg)
4015{ 4015{
4016 struct video_device *vdev = file->private_data; 4016 struct video_device *vdev = file->private_data;
@@ -4449,8 +4449,8 @@ redo:
4449 return 0; 4449 return 0;
4450} 4450}
4451 4451
4452static int 4452static long
4453ov51x_v4l1_ioctl(struct inode *inode, struct file *file, 4453ov51x_v4l1_ioctl(struct file *file,
4454 unsigned int cmd, unsigned long arg) 4454 unsigned int cmd, unsigned long arg)
4455{ 4455{
4456 struct video_device *vdev = file->private_data; 4456 struct video_device *vdev = file->private_data;
@@ -4661,17 +4661,13 @@ ov51x_v4l1_mmap(struct file *file, struct vm_area_struct *vma)
4661 return 0; 4661 return 0;
4662} 4662}
4663 4663
4664static const struct file_operations ov511_fops = { 4664static const struct v4l2_file_operations ov511_fops = {
4665 .owner = THIS_MODULE, 4665 .owner = THIS_MODULE,
4666 .open = ov51x_v4l1_open, 4666 .open = ov51x_v4l1_open,
4667 .release = ov51x_v4l1_close, 4667 .release = ov51x_v4l1_close,
4668 .read = ov51x_v4l1_read, 4668 .read = ov51x_v4l1_read,
4669 .mmap = ov51x_v4l1_mmap, 4669 .mmap = ov51x_v4l1_mmap,
4670 .ioctl = ov51x_v4l1_ioctl, 4670 .ioctl = ov51x_v4l1_ioctl,
4671#ifdef CONFIG_COMPAT
4672 .compat_ioctl = v4l_compat_ioctl32,
4673#endif
4674 .llseek = no_llseek,
4675}; 4671};
4676 4672
4677static struct video_device vdev_template = { 4673static struct video_device vdev_template = {
diff --git a/drivers/media/video/ov7670.c b/drivers/media/video/ov7670.c
index ea032f5f2f41..ca26b0c50cf2 100644
--- a/drivers/media/video/ov7670.c
+++ b/drivers/media/video/ov7670.c
@@ -1310,7 +1310,7 @@ static int ov7670_command(struct i2c_client *client, unsigned int cmd,
1310 void *arg) 1310 void *arg)
1311{ 1311{
1312 switch (cmd) { 1312 switch (cmd) {
1313 case VIDIOC_G_CHIP_IDENT: 1313 case VIDIOC_DBG_G_CHIP_IDENT:
1314 return v4l2_chip_ident_i2c_client(client, arg, V4L2_IDENT_OV7670, 0); 1314 return v4l2_chip_ident_i2c_client(client, arg, V4L2_IDENT_OV7670, 0);
1315 1315
1316 case VIDIOC_INT_RESET: 1316 case VIDIOC_INT_RESET:
diff --git a/drivers/media/video/ov772x.c b/drivers/media/video/ov772x.c
index 54b736fcc07a..3c9e0ba974e9 100644
--- a/drivers/media/video/ov772x.c
+++ b/drivers/media/video/ov772x.c
@@ -724,7 +724,7 @@ static unsigned long ov772x_query_bus_param(struct soc_camera_device *icd)
724} 724}
725 725
726static int ov772x_get_chip_id(struct soc_camera_device *icd, 726static int ov772x_get_chip_id(struct soc_camera_device *icd,
727 struct v4l2_chip_ident *id) 727 struct v4l2_dbg_chip_ident *id)
728{ 728{
729 struct ov772x_priv *priv = container_of(icd, struct ov772x_priv, icd); 729 struct ov772x_priv *priv = container_of(icd, struct ov772x_priv, icd);
730 730
@@ -736,11 +736,12 @@ static int ov772x_get_chip_id(struct soc_camera_device *icd,
736 736
737#ifdef CONFIG_VIDEO_ADV_DEBUG 737#ifdef CONFIG_VIDEO_ADV_DEBUG
738static int ov772x_get_register(struct soc_camera_device *icd, 738static int ov772x_get_register(struct soc_camera_device *icd,
739 struct v4l2_register *reg) 739 struct v4l2_dbg_register *reg)
740{ 740{
741 struct ov772x_priv *priv = container_of(icd, struct ov772x_priv, icd); 741 struct ov772x_priv *priv = container_of(icd, struct ov772x_priv, icd);
742 int ret; 742 int ret;
743 743
744 reg->size = 1;
744 if (reg->reg > 0xff) 745 if (reg->reg > 0xff)
745 return -EINVAL; 746 return -EINVAL;
746 747
@@ -754,7 +755,7 @@ static int ov772x_get_register(struct soc_camera_device *icd,
754} 755}
755 756
756static int ov772x_set_register(struct soc_camera_device *icd, 757static int ov772x_set_register(struct soc_camera_device *icd,
757 struct v4l2_register *reg) 758 struct v4l2_dbg_register *reg)
758{ 759{
759 struct ov772x_priv *priv = container_of(icd, struct ov772x_priv, icd); 760 struct ov772x_priv *priv = container_of(icd, struct ov772x_priv, icd);
760 761
diff --git a/drivers/media/video/pms.c b/drivers/media/video/pms.c
index 45730fac1570..a1ad38fc49c1 100644
--- a/drivers/media/video/pms.c
+++ b/drivers/media/video/pms.c
@@ -680,7 +680,7 @@ static int pms_capture(struct pms_device *dev, char __user *buf, int rgb555, int
680 * Video4linux interfacing 680 * Video4linux interfacing
681 */ 681 */
682 682
683static int pms_do_ioctl(struct file *file, unsigned int cmd, void *arg) 683static long pms_do_ioctl(struct file *file, unsigned int cmd, void *arg)
684{ 684{
685 struct video_device *dev = video_devdata(file); 685 struct video_device *dev = video_devdata(file);
686 struct pms_device *pd=(struct pms_device *)dev; 686 struct pms_device *pd=(struct pms_device *)dev;
@@ -862,7 +862,7 @@ static int pms_do_ioctl(struct file *file, unsigned int cmd, void *arg)
862 return 0; 862 return 0;
863} 863}
864 864
865static int pms_ioctl(struct inode *inode, struct file *file, 865static long pms_ioctl(struct file *file,
866 unsigned int cmd, unsigned long arg) 866 unsigned int cmd, unsigned long arg)
867{ 867{
868 return video_usercopy(file, cmd, arg, pms_do_ioctl); 868 return video_usercopy(file, cmd, arg, pms_do_ioctl);
@@ -881,7 +881,7 @@ static ssize_t pms_read(struct file *file, char __user *buf,
881 return len; 881 return len;
882} 882}
883 883
884static int pms_exclusive_open(struct inode *inode, struct file *file) 884static int pms_exclusive_open(struct file *file)
885{ 885{
886 struct video_device *v = video_devdata(file); 886 struct video_device *v = video_devdata(file);
887 struct pms_device *pd = (struct pms_device *)v; 887 struct pms_device *pd = (struct pms_device *)v;
@@ -889,7 +889,7 @@ static int pms_exclusive_open(struct inode *inode, struct file *file)
889 return test_and_set_bit(0, &pd->in_use) ? -EBUSY : 0; 889 return test_and_set_bit(0, &pd->in_use) ? -EBUSY : 0;
890} 890}
891 891
892static int pms_exclusive_release(struct inode *inode, struct file *file) 892static int pms_exclusive_release(struct file *file)
893{ 893{
894 struct video_device *v = video_devdata(file); 894 struct video_device *v = video_devdata(file);
895 struct pms_device *pd = (struct pms_device *)v; 895 struct pms_device *pd = (struct pms_device *)v;
@@ -898,16 +898,12 @@ static int pms_exclusive_release(struct inode *inode, struct file *file)
898 return 0; 898 return 0;
899} 899}
900 900
901static const struct file_operations pms_fops = { 901static const struct v4l2_file_operations pms_fops = {
902 .owner = THIS_MODULE, 902 .owner = THIS_MODULE,
903 .open = pms_exclusive_open, 903 .open = pms_exclusive_open,
904 .release = pms_exclusive_release, 904 .release = pms_exclusive_release,
905 .ioctl = pms_ioctl, 905 .ioctl = pms_ioctl,
906#ifdef CONFIG_COMPAT
907 .compat_ioctl = v4l_compat_ioctl32,
908#endif
909 .read = pms_read, 906 .read = pms_read,
910 .llseek = no_llseek,
911}; 907};
912 908
913static struct video_device pms_template= 909static struct video_device pms_template=
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
index 4358079f1966..8fb92ac78c7b 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
@@ -4732,26 +4732,25 @@ static int pvr2_hdw_get_eeprom_addr(struct pvr2_hdw *hdw)
4732 4732
4733 4733
4734int pvr2_hdw_register_access(struct pvr2_hdw *hdw, 4734int pvr2_hdw_register_access(struct pvr2_hdw *hdw,
4735 u32 match_type, u32 match_chip, u64 reg_id, 4735 struct v4l2_dbg_match *match, u64 reg_id,
4736 int setFl,u64 *val_ptr) 4736 int setFl, u64 *val_ptr)
4737{ 4737{
4738#ifdef CONFIG_VIDEO_ADV_DEBUG 4738#ifdef CONFIG_VIDEO_ADV_DEBUG
4739 struct pvr2_i2c_client *cp; 4739 struct pvr2_i2c_client *cp;
4740 struct v4l2_register req; 4740 struct v4l2_dbg_register req;
4741 int stat = 0; 4741 int stat = 0;
4742 int okFl = 0; 4742 int okFl = 0;
4743 4743
4744 if (!capable(CAP_SYS_ADMIN)) return -EPERM; 4744 if (!capable(CAP_SYS_ADMIN)) return -EPERM;
4745 4745
4746 req.match_type = match_type; 4746 req.match = *match;
4747 req.match_chip = match_chip;
4748 req.reg = reg_id; 4747 req.reg = reg_id;
4749 if (setFl) req.val = *val_ptr; 4748 if (setFl) req.val = *val_ptr;
4750 mutex_lock(&hdw->i2c_list_lock); do { 4749 mutex_lock(&hdw->i2c_list_lock); do {
4751 list_for_each_entry(cp, &hdw->i2c_clients, list) { 4750 list_for_each_entry(cp, &hdw->i2c_clients, list) {
4752 if (!v4l2_chip_match_i2c_client( 4751 if (!v4l2_chip_match_i2c_client(
4753 cp->client, 4752 cp->client,
4754 req.match_type, req.match_chip)) { 4753 &req.match)) {
4755 continue; 4754 continue;
4756 } 4755 }
4757 stat = pvr2_i2c_client_cmd( 4756 stat = pvr2_i2c_client_cmd(
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.h b/drivers/media/video/pvrusb2/pvrusb2-hdw.h
index 49482d1f2b28..1b4fec337c6b 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-hdw.h
+++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.h
@@ -242,8 +242,8 @@ void pvr2_hdw_v4l_store_minor_number(struct pvr2_hdw *,
242 setFl - true to set the register, false to read it 242 setFl - true to set the register, false to read it
243 val_ptr - storage location for source / result. */ 243 val_ptr - storage location for source / result. */
244int pvr2_hdw_register_access(struct pvr2_hdw *, 244int pvr2_hdw_register_access(struct pvr2_hdw *,
245 u32 match_type, u32 match_chip,u64 reg_id, 245 struct v4l2_dbg_match *match, u64 reg_id,
246 int setFl,u64 *val_ptr); 246 int setFl, u64 *val_ptr);
247 247
248/* The following entry points are all lower level things you normally don't 248/* The following entry points are all lower level things you normally don't
249 want to worry about. */ 249 want to worry about. */
diff --git a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
index 52af1c435965..878fd52a73b3 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
@@ -168,13 +168,13 @@ static const char *get_v4l_name(int v4l_type)
168 * This is part of Video 4 Linux API. The procedure handles ioctl() calls. 168 * This is part of Video 4 Linux API. The procedure handles ioctl() calls.
169 * 169 *
170 */ 170 */
171static int pvr2_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg) 171static long pvr2_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
172{ 172{
173 struct pvr2_v4l2_fh *fh = file->private_data; 173 struct pvr2_v4l2_fh *fh = file->private_data;
174 struct pvr2_v4l2 *vp = fh->vhead; 174 struct pvr2_v4l2 *vp = fh->vhead;
175 struct pvr2_v4l2_dev *dev_info = fh->dev_info; 175 struct pvr2_v4l2_dev *dev_info = fh->dev_info;
176 struct pvr2_hdw *hdw = fh->channel.mc_head->hdw; 176 struct pvr2_hdw *hdw = fh->channel.mc_head->hdw;
177 int ret = -EINVAL; 177 long ret = -EINVAL;
178 178
179 if (pvrusb2_debug & PVR2_TRACE_V4LIOCTL) { 179 if (pvrusb2_debug & PVR2_TRACE_V4LIOCTL) {
180 v4l_print_ioctl(pvr2_hdw_get_driver_name(hdw),cmd); 180 v4l_print_ioctl(pvr2_hdw_get_driver_name(hdw),cmd);
@@ -851,11 +851,11 @@ static int pvr2_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
851 case VIDIOC_DBG_G_REGISTER: 851 case VIDIOC_DBG_G_REGISTER:
852 { 852 {
853 u64 val; 853 u64 val;
854 struct v4l2_register *req = (struct v4l2_register *)arg; 854 struct v4l2_dbg_register *req = (struct v4l2_dbg_register *)arg;
855 if (cmd == VIDIOC_DBG_S_REGISTER) val = req->val; 855 if (cmd == VIDIOC_DBG_S_REGISTER) val = req->val;
856 ret = pvr2_hdw_register_access( 856 ret = pvr2_hdw_register_access(
857 hdw,req->match_type,req->match_chip,req->reg, 857 hdw, &req->match, req->reg,
858 cmd == VIDIOC_DBG_S_REGISTER,&val); 858 cmd == VIDIOC_DBG_S_REGISTER, &val);
859 if (cmd == VIDIOC_DBG_G_REGISTER) req->val = val; 859 if (cmd == VIDIOC_DBG_G_REGISTER) req->val = val;
860 break; 860 break;
861 } 861 }
@@ -871,20 +871,20 @@ static int pvr2_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
871 if (ret < 0) { 871 if (ret < 0) {
872 if (pvrusb2_debug & PVR2_TRACE_V4LIOCTL) { 872 if (pvrusb2_debug & PVR2_TRACE_V4LIOCTL) {
873 pvr2_trace(PVR2_TRACE_V4LIOCTL, 873 pvr2_trace(PVR2_TRACE_V4LIOCTL,
874 "pvr2_v4l2_do_ioctl failure, ret=%d",ret); 874 "pvr2_v4l2_do_ioctl failure, ret=%ld", ret);
875 } else { 875 } else {
876 if (pvrusb2_debug & PVR2_TRACE_V4LIOCTL) { 876 if (pvrusb2_debug & PVR2_TRACE_V4LIOCTL) {
877 pvr2_trace(PVR2_TRACE_V4LIOCTL, 877 pvr2_trace(PVR2_TRACE_V4LIOCTL,
878 "pvr2_v4l2_do_ioctl failure, ret=%d" 878 "pvr2_v4l2_do_ioctl failure, ret=%ld"
879 " command was:",ret); 879 " command was:", ret);
880 v4l_print_ioctl(pvr2_hdw_get_driver_name(hdw), 880 v4l_print_ioctl(pvr2_hdw_get_driver_name(hdw),
881 cmd); 881 cmd);
882 } 882 }
883 } 883 }
884 } else { 884 } else {
885 pvr2_trace(PVR2_TRACE_V4LIOCTL, 885 pvr2_trace(PVR2_TRACE_V4LIOCTL,
886 "pvr2_v4l2_do_ioctl complete, ret=%d (0x%x)", 886 "pvr2_v4l2_do_ioctl complete, ret=%ld (0x%lx)",
887 ret,ret); 887 ret, ret);
888 } 888 }
889 return ret; 889 return ret;
890} 890}
@@ -948,7 +948,7 @@ static void pvr2_v4l2_internal_check(struct pvr2_channel *chp)
948} 948}
949 949
950 950
951static int pvr2_v4l2_ioctl(struct inode *inode, struct file *file, 951static long pvr2_v4l2_ioctl(struct file *file,
952 unsigned int cmd, unsigned long arg) 952 unsigned int cmd, unsigned long arg)
953{ 953{
954 954
@@ -960,7 +960,7 @@ static int pvr2_v4l2_ioctl(struct inode *inode, struct file *file,
960} 960}
961 961
962 962
963static int pvr2_v4l2_release(struct inode *inode, struct file *file) 963static int pvr2_v4l2_release(struct file *file)
964{ 964{
965 struct pvr2_v4l2_fh *fhp = file->private_data; 965 struct pvr2_v4l2_fh *fhp = file->private_data;
966 struct pvr2_v4l2 *vp = fhp->vhead; 966 struct pvr2_v4l2 *vp = fhp->vhead;
@@ -1008,7 +1008,7 @@ static int pvr2_v4l2_release(struct inode *inode, struct file *file)
1008} 1008}
1009 1009
1010 1010
1011static int pvr2_v4l2_open(struct inode *inode, struct file *file) 1011static int pvr2_v4l2_open(struct file *file)
1012{ 1012{
1013 struct pvr2_v4l2_dev *dip; /* Our own context pointer */ 1013 struct pvr2_v4l2_dev *dip; /* Our own context pointer */
1014 struct pvr2_v4l2_fh *fhp; 1014 struct pvr2_v4l2_fh *fhp;
@@ -1235,13 +1235,12 @@ static unsigned int pvr2_v4l2_poll(struct file *file, poll_table *wait)
1235} 1235}
1236 1236
1237 1237
1238static const struct file_operations vdev_fops = { 1238static const struct v4l2_file_operations vdev_fops = {
1239 .owner = THIS_MODULE, 1239 .owner = THIS_MODULE,
1240 .open = pvr2_v4l2_open, 1240 .open = pvr2_v4l2_open,
1241 .release = pvr2_v4l2_release, 1241 .release = pvr2_v4l2_release,
1242 .read = pvr2_v4l2_read, 1242 .read = pvr2_v4l2_read,
1243 .ioctl = pvr2_v4l2_ioctl, 1243 .ioctl = pvr2_v4l2_ioctl,
1244 .llseek = no_llseek,
1245 .poll = pvr2_v4l2_poll, 1244 .poll = pvr2_v4l2_poll,
1246}; 1245};
1247 1246
diff --git a/drivers/media/video/pwc/pwc-ctrl.c b/drivers/media/video/pwc/pwc-ctrl.c
index c66530210192..f9fbe02e0f69 100644
--- a/drivers/media/video/pwc/pwc-ctrl.c
+++ b/drivers/media/video/pwc/pwc-ctrl.c
@@ -1266,9 +1266,9 @@ int pwc_get_cmos_sensor(struct pwc_device *pdev, int *sensor)
1266/* copy local variable to arg */ 1266/* copy local variable to arg */
1267#define ARG_OUT(ARG_name) /* nothing */ 1267#define ARG_OUT(ARG_name) /* nothing */
1268 1268
1269int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) 1269long pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg)
1270{ 1270{
1271 int ret = 0; 1271 long ret = 0;
1272 1272
1273 switch(cmd) { 1273 switch(cmd) {
1274 case VIDIOCPWCRUSER: 1274 case VIDIOCPWCRUSER:
diff --git a/drivers/media/video/pwc/pwc-if.c b/drivers/media/video/pwc/pwc-if.c
index 1ce9da167b7e..39fbc970f43d 100644
--- a/drivers/media/video/pwc/pwc-if.c
+++ b/drivers/media/video/pwc/pwc-if.c
@@ -142,16 +142,16 @@ static struct {
142 142
143/***/ 143/***/
144 144
145static int pwc_video_open(struct inode *inode, struct file *file); 145static int pwc_video_open(struct file *file);
146static int pwc_video_close(struct inode *inode, struct file *file); 146static int pwc_video_close(struct file *file);
147static ssize_t pwc_video_read(struct file *file, char __user *buf, 147static ssize_t pwc_video_read(struct file *file, char __user *buf,
148 size_t count, loff_t *ppos); 148 size_t count, loff_t *ppos);
149static unsigned int pwc_video_poll(struct file *file, poll_table *wait); 149static unsigned int pwc_video_poll(struct file *file, poll_table *wait);
150static int pwc_video_ioctl(struct inode *inode, struct file *file, 150static long pwc_video_ioctl(struct file *file,
151 unsigned int ioctlnr, unsigned long arg); 151 unsigned int ioctlnr, unsigned long arg);
152static int pwc_video_mmap(struct file *file, struct vm_area_struct *vma); 152static int pwc_video_mmap(struct file *file, struct vm_area_struct *vma);
153 153
154static const struct file_operations pwc_fops = { 154static const struct v4l2_file_operations pwc_fops = {
155 .owner = THIS_MODULE, 155 .owner = THIS_MODULE,
156 .open = pwc_video_open, 156 .open = pwc_video_open,
157 .release = pwc_video_close, 157 .release = pwc_video_close,
@@ -159,10 +159,6 @@ static const struct file_operations pwc_fops = {
159 .poll = pwc_video_poll, 159 .poll = pwc_video_poll,
160 .mmap = pwc_video_mmap, 160 .mmap = pwc_video_mmap,
161 .ioctl = pwc_video_ioctl, 161 .ioctl = pwc_video_ioctl,
162#ifdef CONFIG_COMPAT
163 .compat_ioctl = v4l_compat_ioctl32,
164#endif
165 .llseek = no_llseek,
166}; 162};
167static struct video_device pwc_template = { 163static struct video_device pwc_template = {
168 .name = "Philips Webcam", /* Filled in later */ 164 .name = "Philips Webcam", /* Filled in later */
@@ -1104,7 +1100,7 @@ static const char *pwc_sensor_type_to_string(unsigned int sensor_type)
1104/***************************************************************************/ 1100/***************************************************************************/
1105/* Video4Linux functions */ 1101/* Video4Linux functions */
1106 1102
1107static int pwc_video_open(struct inode *inode, struct file *file) 1103static int pwc_video_open(struct file *file)
1108{ 1104{
1109 int i, ret; 1105 int i, ret;
1110 struct video_device *vdev = video_devdata(file); 1106 struct video_device *vdev = video_devdata(file);
@@ -1224,7 +1220,7 @@ static void pwc_cleanup(struct pwc_device *pdev)
1224} 1220}
1225 1221
1226/* Note that all cleanup is done in the reverse order as in _open */ 1222/* Note that all cleanup is done in the reverse order as in _open */
1227static int pwc_video_close(struct inode *inode, struct file *file) 1223static int pwc_video_close(struct file *file)
1228{ 1224{
1229 struct video_device *vdev = file->private_data; 1225 struct video_device *vdev = file->private_data;
1230 struct pwc_device *pdev; 1226 struct pwc_device *pdev;
@@ -1399,12 +1395,12 @@ static unsigned int pwc_video_poll(struct file *file, poll_table *wait)
1399 return 0; 1395 return 0;
1400} 1396}
1401 1397
1402static int pwc_video_ioctl(struct inode *inode, struct file *file, 1398static long pwc_video_ioctl(struct file *file,
1403 unsigned int cmd, unsigned long arg) 1399 unsigned int cmd, unsigned long arg)
1404{ 1400{
1405 struct video_device *vdev = file->private_data; 1401 struct video_device *vdev = file->private_data;
1406 struct pwc_device *pdev; 1402 struct pwc_device *pdev;
1407 int r = -ENODEV; 1403 long r = -ENODEV;
1408 1404
1409 if (!vdev) 1405 if (!vdev)
1410 goto out; 1406 goto out;
diff --git a/drivers/media/video/pwc/pwc-v4l.c b/drivers/media/video/pwc/pwc-v4l.c
index d7c147328e35..bc0a464295c5 100644
--- a/drivers/media/video/pwc/pwc-v4l.c
+++ b/drivers/media/video/pwc/pwc-v4l.c
@@ -337,7 +337,7 @@ static int pwc_vidioc_set_fmt(struct pwc_device *pdev, struct v4l2_format *f)
337 337
338} 338}
339 339
340int pwc_video_do_ioctl(struct file *file, unsigned int cmd, void *arg) 340long pwc_video_do_ioctl(struct file *file, unsigned int cmd, void *arg)
341{ 341{
342 struct video_device *vdev = video_devdata(file); 342 struct video_device *vdev = video_devdata(file);
343 struct pwc_device *pdev; 343 struct pwc_device *pdev;
diff --git a/drivers/media/video/pwc/pwc.h b/drivers/media/video/pwc/pwc.h
index c046a2535668..01411fb2337a 100644
--- a/drivers/media/video/pwc/pwc.h
+++ b/drivers/media/video/pwc/pwc.h
@@ -337,10 +337,10 @@ extern int pwc_get_dynamic_noise(struct pwc_device *pdev, int *noise);
337extern int pwc_camera_power(struct pwc_device *pdev, int power); 337extern int pwc_camera_power(struct pwc_device *pdev, int power);
338 338
339/* Private ioctl()s; see pwc-ioctl.h */ 339/* Private ioctl()s; see pwc-ioctl.h */
340extern int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg); 340extern long pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg);
341 341
342/** Functions in pwc-v4l.c */ 342/** Functions in pwc-v4l.c */
343extern int pwc_video_do_ioctl(struct file *file, unsigned int cmd, void *arg); 343extern long pwc_video_do_ioctl(struct file *file, unsigned int cmd, void *arg);
344 344
345/** pwc-uncompress.c */ 345/** pwc-uncompress.c */
346/* Expand frame to image, possibly including decompression. Uses read_frame and fill_image */ 346/* Expand frame to image, possibly including decompression. Uses read_frame and fill_image */
diff --git a/drivers/media/video/s2255drv.c b/drivers/media/video/s2255drv.c
index 3c3f8cf73108..13f85ad363cd 100644
--- a/drivers/media/video/s2255drv.c
+++ b/drivers/media/video/s2255drv.c
@@ -1502,9 +1502,9 @@ static int vidioc_s_jpegcomp(struct file *file, void *priv,
1502 dprintk(2, "setting jpeg quality %d\n", jc->quality); 1502 dprintk(2, "setting jpeg quality %d\n", jc->quality);
1503 return 0; 1503 return 0;
1504} 1504}
1505static int s2255_open(struct inode *inode, struct file *file) 1505static int s2255_open(struct file *file)
1506{ 1506{
1507 int minor = iminor(inode); 1507 int minor = video_devdata(file)->minor;
1508 struct s2255_dev *h, *dev = NULL; 1508 struct s2255_dev *h, *dev = NULL;
1509 struct s2255_fh *fh; 1509 struct s2255_fh *fh;
1510 struct list_head *list; 1510 struct list_head *list;
@@ -1711,11 +1711,11 @@ static void s2255_destroy(struct kref *kref)
1711 mutex_unlock(&dev->open_lock); 1711 mutex_unlock(&dev->open_lock);
1712} 1712}
1713 1713
1714static int s2255_close(struct inode *inode, struct file *file) 1714static int s2255_close(struct file *file)
1715{ 1715{
1716 struct s2255_fh *fh = file->private_data; 1716 struct s2255_fh *fh = file->private_data;
1717 struct s2255_dev *dev = fh->dev; 1717 struct s2255_dev *dev = fh->dev;
1718 int minor = iminor(inode); 1718 int minor = video_devdata(file)->minor;
1719 if (!dev) 1719 if (!dev)
1720 return -ENODEV; 1720 return -ENODEV;
1721 1721
@@ -1759,15 +1759,13 @@ static int s2255_mmap_v4l(struct file *file, struct vm_area_struct *vma)
1759 return ret; 1759 return ret;
1760} 1760}
1761 1761
1762static const struct file_operations s2255_fops_v4l = { 1762static const struct v4l2_file_operations s2255_fops_v4l = {
1763 .owner = THIS_MODULE, 1763 .owner = THIS_MODULE,
1764 .open = s2255_open, 1764 .open = s2255_open,
1765 .release = s2255_close, 1765 .release = s2255_close,
1766 .poll = s2255_poll, 1766 .poll = s2255_poll,
1767 .ioctl = video_ioctl2, /* V4L2 ioctl handler */ 1767 .ioctl = video_ioctl2, /* V4L2 ioctl handler */
1768 .compat_ioctl = v4l_compat_ioctl32,
1769 .mmap = s2255_mmap_v4l, 1768 .mmap = s2255_mmap_v4l,
1770 .llseek = no_llseek,
1771}; 1769};
1772 1770
1773static const struct v4l2_ioctl_ops s2255_ioctl_ops = { 1771static const struct v4l2_ioctl_ops s2255_ioctl_ops = {
diff --git a/drivers/media/video/saa5246a.c b/drivers/media/video/saa5246a.c
index f159441e9375..e637e440b6d5 100644
--- a/drivers/media/video/saa5246a.c
+++ b/drivers/media/video/saa5246a.c
@@ -804,7 +804,7 @@ static inline int saa5246a_stop_dau(struct saa5246a_device *t,
804 * 804 *
805 * Returns 0 if successful 805 * Returns 0 if successful
806 */ 806 */
807static int do_saa5246a_ioctl(struct file *file, unsigned int cmd, void *arg) 807static long do_saa5246a_ioctl(struct file *file, unsigned int cmd, void *arg)
808{ 808{
809 struct saa5246a_device *t = video_drvdata(file); 809 struct saa5246a_device *t = video_drvdata(file);
810 810
@@ -944,11 +944,11 @@ static inline unsigned int vtx_fix_command(unsigned int cmd)
944/* 944/*
945 * Handle the locking 945 * Handle the locking
946 */ 946 */
947static int saa5246a_ioctl(struct inode *inode, struct file *file, 947static long saa5246a_ioctl(struct file *file,
948 unsigned int cmd, unsigned long arg) 948 unsigned int cmd, unsigned long arg)
949{ 949{
950 struct saa5246a_device *t = video_drvdata(file); 950 struct saa5246a_device *t = video_drvdata(file);
951 int err; 951 long err;
952 952
953 cmd = vtx_fix_command(cmd); 953 cmd = vtx_fix_command(cmd);
954 mutex_lock(&t->lock); 954 mutex_lock(&t->lock);
@@ -957,7 +957,7 @@ static int saa5246a_ioctl(struct inode *inode, struct file *file,
957 return err; 957 return err;
958} 958}
959 959
960static int saa5246a_open(struct inode *inode, struct file *file) 960static int saa5246a_open(struct file *file)
961{ 961{
962 struct saa5246a_device *t = video_drvdata(file); 962 struct saa5246a_device *t = video_drvdata(file);
963 963
@@ -999,7 +999,7 @@ static int saa5246a_open(struct inode *inode, struct file *file)
999 return 0; 999 return 0;
1000} 1000}
1001 1001
1002static int saa5246a_release(struct inode *inode, struct file *file) 1002static int saa5246a_release(struct file *file)
1003{ 1003{
1004 struct saa5246a_device *t = video_drvdata(file); 1004 struct saa5246a_device *t = video_drvdata(file);
1005 1005
@@ -1018,12 +1018,11 @@ static int saa5246a_release(struct inode *inode, struct file *file)
1018 return 0; 1018 return 0;
1019} 1019}
1020 1020
1021static const struct file_operations saa_fops = { 1021static const struct v4l2_file_operations saa_fops = {
1022 .owner = THIS_MODULE, 1022 .owner = THIS_MODULE,
1023 .open = saa5246a_open, 1023 .open = saa5246a_open,
1024 .release = saa5246a_release, 1024 .release = saa5246a_release,
1025 .ioctl = saa5246a_ioctl, 1025 .ioctl = saa5246a_ioctl,
1026 .llseek = no_llseek,
1027}; 1026};
1028 1027
1029static struct video_device saa_template = 1028static struct video_device saa_template =
diff --git a/drivers/media/video/saa5249.c b/drivers/media/video/saa5249.c
index 6ef3affb97f1..e29765192469 100644
--- a/drivers/media/video/saa5249.c
+++ b/drivers/media/video/saa5249.c
@@ -190,7 +190,7 @@ static int i2c_getdata(struct saa5249_device *t, int count, u8 *buf)
190 * Standard character-device-driver functions 190 * Standard character-device-driver functions
191 */ 191 */
192 192
193static int do_saa5249_ioctl(struct file *file, unsigned int cmd, void *arg) 193static long do_saa5249_ioctl(struct file *file, unsigned int cmd, void *arg)
194{ 194{
195 static int virtual_mode = false; 195 static int virtual_mode = false;
196 struct saa5249_device *t = video_drvdata(file); 196 struct saa5249_device *t = video_drvdata(file);
@@ -479,11 +479,11 @@ static inline unsigned int vtx_fix_command(unsigned int cmd)
479 * Handle the locking 479 * Handle the locking
480 */ 480 */
481 481
482static int saa5249_ioctl(struct inode *inode, struct file *file, 482static long saa5249_ioctl(struct file *file,
483 unsigned int cmd, unsigned long arg) 483 unsigned int cmd, unsigned long arg)
484{ 484{
485 struct saa5249_device *t = video_drvdata(file); 485 struct saa5249_device *t = video_drvdata(file);
486 int err; 486 long err;
487 487
488 cmd = vtx_fix_command(cmd); 488 cmd = vtx_fix_command(cmd);
489 mutex_lock(&t->lock); 489 mutex_lock(&t->lock);
@@ -492,7 +492,7 @@ static int saa5249_ioctl(struct inode *inode, struct file *file,
492 return err; 492 return err;
493} 493}
494 494
495static int saa5249_open(struct inode *inode, struct file *file) 495static int saa5249_open(struct file *file)
496{ 496{
497 struct saa5249_device *t = video_drvdata(file); 497 struct saa5249_device *t = video_drvdata(file);
498 int pgbuf; 498 int pgbuf;
@@ -529,7 +529,7 @@ static int saa5249_open(struct inode *inode, struct file *file)
529 529
530 530
531 531
532static int saa5249_release(struct inode *inode, struct file *file) 532static int saa5249_release(struct file *file)
533{ 533{
534 struct saa5249_device *t = video_drvdata(file); 534 struct saa5249_device *t = video_drvdata(file);
535 535
@@ -539,15 +539,11 @@ static int saa5249_release(struct inode *inode, struct file *file)
539 return 0; 539 return 0;
540} 540}
541 541
542static const struct file_operations saa_fops = { 542static const struct v4l2_file_operations saa_fops = {
543 .owner = THIS_MODULE, 543 .owner = THIS_MODULE,
544 .open = saa5249_open, 544 .open = saa5249_open,
545 .release = saa5249_release, 545 .release = saa5249_release,
546 .ioctl = saa5249_ioctl, 546 .ioctl = saa5249_ioctl,
547#ifdef CONFIG_COMPAT
548 .compat_ioctl = v4l_compat_ioctl32,
549#endif
550 .llseek = no_llseek,
551}; 547};
552 548
553static struct video_device saa_template = 549static struct video_device saa_template =
diff --git a/drivers/media/video/saa7115.c b/drivers/media/video/saa7115.c
index 22708ecdf1bb..46c796c3fec8 100644
--- a/drivers/media/video/saa7115.c
+++ b/drivers/media/video/saa7115.c
@@ -1371,25 +1371,24 @@ static int saa711x_g_vbi_data(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_dat
1371} 1371}
1372 1372
1373#ifdef CONFIG_VIDEO_ADV_DEBUG 1373#ifdef CONFIG_VIDEO_ADV_DEBUG
1374static int saa711x_g_register(struct v4l2_subdev *sd, struct v4l2_register *reg) 1374static int saa711x_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg)
1375{ 1375{
1376 struct i2c_client *client = v4l2_get_subdevdata(sd); 1376 struct i2c_client *client = v4l2_get_subdevdata(sd);
1377 1377
1378 if (!v4l2_chip_match_i2c_client(client, 1378 if (!v4l2_chip_match_i2c_client(client, &reg->match))
1379 reg->match_type, reg->match_chip))
1380 return -EINVAL; 1379 return -EINVAL;
1381 if (!capable(CAP_SYS_ADMIN)) 1380 if (!capable(CAP_SYS_ADMIN))
1382 return -EPERM; 1381 return -EPERM;
1383 reg->val = saa711x_read(sd, reg->reg & 0xff); 1382 reg->val = saa711x_read(sd, reg->reg & 0xff);
1383 reg->size = 1;
1384 return 0; 1384 return 0;
1385} 1385}
1386 1386
1387static int saa711x_s_register(struct v4l2_subdev *sd, struct v4l2_register *reg) 1387static int saa711x_s_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg)
1388{ 1388{
1389 struct i2c_client *client = v4l2_get_subdevdata(sd); 1389 struct i2c_client *client = v4l2_get_subdevdata(sd);
1390 1390
1391 if (!v4l2_chip_match_i2c_client(client, 1391 if (!v4l2_chip_match_i2c_client(client, &reg->match))
1392 reg->match_type, reg->match_chip))
1393 return -EINVAL; 1392 return -EINVAL;
1394 if (!capable(CAP_SYS_ADMIN)) 1393 if (!capable(CAP_SYS_ADMIN))
1395 return -EPERM; 1394 return -EPERM;
@@ -1398,7 +1397,7 @@ static int saa711x_s_register(struct v4l2_subdev *sd, struct v4l2_register *reg)
1398} 1397}
1399#endif 1398#endif
1400 1399
1401static int saa711x_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_chip_ident *chip) 1400static int saa711x_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip)
1402{ 1401{
1403 struct saa711x_state *state = to_state(sd); 1402 struct saa711x_state *state = to_state(sd);
1404 struct i2c_client *client = v4l2_get_subdevdata(sd); 1403 struct i2c_client *client = v4l2_get_subdevdata(sd);
diff --git a/drivers/media/video/saa7127.c b/drivers/media/video/saa7127.c
index bfc85654795e..d6848f7a503b 100644
--- a/drivers/media/video/saa7127.c
+++ b/drivers/media/video/saa7127.c
@@ -623,25 +623,24 @@ static int saa7127_s_vbi_data(struct v4l2_subdev *sd, const struct v4l2_sliced_v
623} 623}
624 624
625#ifdef CONFIG_VIDEO_ADV_DEBUG 625#ifdef CONFIG_VIDEO_ADV_DEBUG
626static int saa7127_g_register(struct v4l2_subdev *sd, struct v4l2_register *reg) 626static int saa7127_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg)
627{ 627{
628 struct i2c_client *client = v4l2_get_subdevdata(sd); 628 struct i2c_client *client = v4l2_get_subdevdata(sd);
629 629
630 if (!v4l2_chip_match_i2c_client(client, 630 if (!v4l2_chip_match_i2c_client(client, &reg->match))
631 reg->match_type, reg->match_chip))
632 return -EINVAL; 631 return -EINVAL;
633 if (!capable(CAP_SYS_ADMIN)) 632 if (!capable(CAP_SYS_ADMIN))
634 return -EPERM; 633 return -EPERM;
635 reg->val = saa7127_read(sd, reg->reg & 0xff); 634 reg->val = saa7127_read(sd, reg->reg & 0xff);
635 reg->size = 1;
636 return 0; 636 return 0;
637} 637}
638 638
639static int saa7127_s_register(struct v4l2_subdev *sd, struct v4l2_register *reg) 639static int saa7127_s_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg)
640{ 640{
641 struct i2c_client *client = v4l2_get_subdevdata(sd); 641 struct i2c_client *client = v4l2_get_subdevdata(sd);
642 642
643 if (!v4l2_chip_match_i2c_client(client, 643 if (!v4l2_chip_match_i2c_client(client, &reg->match))
644 reg->match_type, reg->match_chip))
645 return -EINVAL; 644 return -EINVAL;
646 if (!capable(CAP_SYS_ADMIN)) 645 if (!capable(CAP_SYS_ADMIN))
647 return -EPERM; 646 return -EPERM;
@@ -650,7 +649,7 @@ static int saa7127_s_register(struct v4l2_subdev *sd, struct v4l2_register *reg)
650} 649}
651#endif 650#endif
652 651
653static int saa7127_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_chip_ident *chip) 652static int saa7127_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip)
654{ 653{
655 struct saa7127_state *state = to_state(sd); 654 struct saa7127_state *state = to_state(sd);
656 struct i2c_client *client = v4l2_get_subdevdata(sd); 655 struct i2c_client *client = v4l2_get_subdevdata(sd);
diff --git a/drivers/media/video/saa7134/saa6752hs.c b/drivers/media/video/saa7134/saa6752hs.c
index 1fb6eccdade3..1fee6e84a512 100644
--- a/drivers/media/video/saa7134/saa6752hs.c
+++ b/drivers/media/video/saa7134/saa6752hs.c
@@ -838,7 +838,7 @@ saa6752hs_command(struct i2c_client *client, unsigned int cmd, void *arg)
838 h->standard = *((v4l2_std_id *) arg); 838 h->standard = *((v4l2_std_id *) arg);
839 break; 839 break;
840 840
841 case VIDIOC_G_CHIP_IDENT: 841 case VIDIOC_DBG_G_CHIP_IDENT:
842 return v4l2_chip_ident_i2c_client(client, 842 return v4l2_chip_ident_i2c_client(client,
843 arg, h->chip, h->revision); 843 arg, h->chip, h->revision);
844 844
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c
index a2e3f6729c5b..e2febcd6e529 100644
--- a/drivers/media/video/saa7134/saa7134-cards.c
+++ b/drivers/media/video/saa7134/saa7134-cards.c
@@ -4462,6 +4462,7 @@ struct saa7134_board saa7134_boards[] = {
4462 .tuner_addr = ADDR_UNSET, 4462 .tuner_addr = ADDR_UNSET,
4463 .radio_addr = ADDR_UNSET, 4463 .radio_addr = ADDR_UNSET,
4464 .tda9887_conf = TDA9887_PRESENT, 4464 .tda9887_conf = TDA9887_PRESENT,
4465 .mpeg = SAA7134_MPEG_DVB,
4465 .inputs = {{ 4466 .inputs = {{
4466 .name = name_tv, 4467 .name = name_tv,
4467 .vmux = 3, 4468 .vmux = 3,
@@ -4480,8 +4481,6 @@ struct saa7134_board saa7134_boards[] = {
4480 .name = name_radio, 4481 .name = name_radio,
4481 .amux = LINE2, 4482 .amux = LINE2,
4482 }, 4483 },
4483 /* no DVB support for now */
4484 /* .mpeg = SAA7134_MPEG_DVB, */
4485 }, 4484 },
4486 [SAA7134_BOARD_ASUSTeK_TIGER_3IN1] = { 4485 [SAA7134_BOARD_ASUSTeK_TIGER_3IN1] = {
4487 .name = "Asus Tiger 3in1", 4486 .name = "Asus Tiger 3in1",
@@ -4643,6 +4642,38 @@ struct saa7134_board saa7134_boards[] = {
4643 .amux = 2, 4642 .amux = 2,
4644 }, 4643 },
4645 }, 4644 },
4645 [SAA7134_BOARD_AVERMEDIA_GO_007_FM_PLUS] = {
4646 .name = "Avermedia AVerTV GO 007 FM Plus",
4647 .audio_clock = 0x00187de7,
4648 .tuner_type = TUNER_PHILIPS_TDA8290,
4649 .radio_type = UNSET,
4650 .tuner_addr = ADDR_UNSET,
4651 .radio_addr = ADDR_UNSET,
4652 .gpiomask = 0x00300003,
4653 /* .gpiomask = 0x8c240003, */
4654 .inputs = { {
4655 .name = name_tv,
4656 .vmux = 1,
4657 .amux = TV,
4658 .tv = 1,
4659 .gpio = 0x01,
4660 }, {
4661 .name = name_svideo,
4662 .vmux = 6,
4663 .amux = LINE1,
4664 .gpio = 0x02,
4665 } },
4666 .radio = {
4667 .name = name_radio,
4668 .amux = TV,
4669 .gpio = 0x00300001,
4670 },
4671 .mute = {
4672 .name = name_mute,
4673 .amux = TV,
4674 .gpio = 0x01,
4675 },
4676 },
4646}; 4677};
4647 4678
4648const unsigned int saa7134_bcount = ARRAY_SIZE(saa7134_boards); 4679const unsigned int saa7134_bcount = ARRAY_SIZE(saa7134_boards);
@@ -5702,6 +5733,13 @@ struct pci_device_id saa7134_pci_tbl[] = {
5702 .subdevice = 0x7128, 5733 .subdevice = 0x7128,
5703 .driver_data = SAA7134_BOARD_KWORLD_PLUS_TV_ANALOG, 5734 .driver_data = SAA7134_BOARD_KWORLD_PLUS_TV_ANALOG,
5704 }, { 5735 }, {
5736 .vendor = PCI_VENDOR_ID_PHILIPS,
5737 .device = PCI_DEVICE_ID_PHILIPS_SAA7133,
5738 .subvendor = 0x1461, /* Avermedia Technologies Inc */
5739 .subdevice = 0xf31d,
5740 .driver_data = SAA7134_BOARD_AVERMEDIA_GO_007_FM_PLUS,
5741
5742 }, {
5705 /* --- boards without eeprom + subsystem ID --- */ 5743 /* --- boards without eeprom + subsystem ID --- */
5706 .vendor = PCI_VENDOR_ID_PHILIPS, 5744 .vendor = PCI_VENDOR_ID_PHILIPS,
5707 .device = PCI_DEVICE_ID_PHILIPS_SAA7134, 5745 .device = PCI_DEVICE_ID_PHILIPS_SAA7134,
@@ -5930,6 +5968,7 @@ int saa7134_board_init1(struct saa7134_dev *dev)
5930 case SAA7134_BOARD_GENIUS_TVGO_A11MCE: 5968 case SAA7134_BOARD_GENIUS_TVGO_A11MCE:
5931 case SAA7134_BOARD_REAL_ANGEL_220: 5969 case SAA7134_BOARD_REAL_ANGEL_220:
5932 case SAA7134_BOARD_KWORLD_PLUS_TV_ANALOG: 5970 case SAA7134_BOARD_KWORLD_PLUS_TV_ANALOG:
5971 case SAA7134_BOARD_AVERMEDIA_GO_007_FM_PLUS:
5933 dev->has_remote = SAA7134_REMOTE_GPIO; 5972 dev->has_remote = SAA7134_REMOTE_GPIO;
5934 break; 5973 break;
5935 case SAA7134_BOARD_FLYDVBS_LR300: 5974 case SAA7134_BOARD_FLYDVBS_LR300:
@@ -6025,6 +6064,7 @@ int saa7134_board_init1(struct saa7134_dev *dev)
6025 case SAA7134_BOARD_BEHOLD_M6: 6064 case SAA7134_BOARD_BEHOLD_M6:
6026 case SAA7134_BOARD_BEHOLD_M63: 6065 case SAA7134_BOARD_BEHOLD_M63:
6027 case SAA7134_BOARD_BEHOLD_M6_EXTRA: 6066 case SAA7134_BOARD_BEHOLD_M6_EXTRA:
6067 case SAA7134_BOARD_BEHOLD_H6:
6028 dev->has_remote = SAA7134_REMOTE_I2C; 6068 dev->has_remote = SAA7134_REMOTE_I2C;
6029 break; 6069 break;
6030 case SAA7134_BOARD_AVERMEDIA_A169_B: 6070 case SAA7134_BOARD_AVERMEDIA_A169_B:
diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c
index d9a5652595b5..0776ecf56d27 100644
--- a/drivers/media/video/saa7134/saa7134-dvb.c
+++ b/drivers/media/video/saa7134/saa7134-dvb.c
@@ -49,6 +49,8 @@
49#include "lnbp21.h" 49#include "lnbp21.h"
50#include "tuner-simple.h" 50#include "tuner-simple.h"
51 51
52#include "zl10353.h"
53
52MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]"); 54MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]");
53MODULE_LICENSE("GPL"); 55MODULE_LICENSE("GPL");
54 56
@@ -854,6 +856,12 @@ static struct tda1004x_config ads_tech_duo_config = {
854 .request_firmware = philips_tda1004x_request_firmware 856 .request_firmware = philips_tda1004x_request_firmware
855}; 857};
856 858
859static struct zl10353_config behold_h6_config = {
860 .demod_address = 0x1e>>1,
861 .no_tuner = 1,
862 .parallel_ts = 1,
863};
864
857/* ================================================================== 865/* ==================================================================
858 * tda10086 based DVB-S cards, helper functions 866 * tda10086 based DVB-S cards, helper functions
859 */ 867 */
@@ -1357,6 +1365,16 @@ static int dvb_init(struct saa7134_dev *dev)
1357 &tda827x_cfg_0) < 0) 1365 &tda827x_cfg_0) < 0)
1358 goto dettach_frontend; 1366 goto dettach_frontend;
1359 break; 1367 break;
1368 case SAA7134_BOARD_BEHOLD_H6:
1369 fe0->dvb.frontend = dvb_attach(zl10353_attach,
1370 &behold_h6_config,
1371 &dev->i2c_adap);
1372 if (fe0->dvb.frontend) {
1373 dvb_attach(simple_tuner_attach, fe0->dvb.frontend,
1374 &dev->i2c_adap, 0x61,
1375 TUNER_PHILIPS_FMD1216ME_MK3);
1376 }
1377 break;
1360 default: 1378 default:
1361 wprintk("Huh? unknown DVB card?\n"); 1379 wprintk("Huh? unknown DVB card?\n");
1362 break; 1380 break;
diff --git a/drivers/media/video/saa7134/saa7134-empress.c b/drivers/media/video/saa7134/saa7134-empress.c
index 7f40511bcc04..c9d8beb87a60 100644
--- a/drivers/media/video/saa7134/saa7134-empress.c
+++ b/drivers/media/video/saa7134/saa7134-empress.c
@@ -83,9 +83,9 @@ static int ts_init_encoder(struct saa7134_dev* dev)
83 83
84/* ------------------------------------------------------------------ */ 84/* ------------------------------------------------------------------ */
85 85
86static int ts_open(struct inode *inode, struct file *file) 86static int ts_open(struct file *file)
87{ 87{
88 int minor = iminor(inode); 88 int minor = video_devdata(file)->minor;
89 struct saa7134_dev *dev; 89 struct saa7134_dev *dev;
90 int err; 90 int err;
91 91
@@ -119,7 +119,7 @@ done:
119 return err; 119 return err;
120} 120}
121 121
122static int ts_release(struct inode *inode, struct file *file) 122static int ts_release(struct file *file)
123{ 123{
124 struct saa7134_dev *dev = file->private_data; 124 struct saa7134_dev *dev = file->private_data;
125 125
@@ -405,7 +405,7 @@ static int empress_querymenu(struct file *file, void *priv,
405} 405}
406 406
407static int empress_g_chip_ident(struct file *file, void *fh, 407static int empress_g_chip_ident(struct file *file, void *fh,
408 struct v4l2_chip_ident *chip) 408 struct v4l2_dbg_chip_ident *chip)
409{ 409{
410 struct saa7134_dev *dev = file->private_data; 410 struct saa7134_dev *dev = file->private_data;
411 411
@@ -413,12 +413,12 @@ static int empress_g_chip_ident(struct file *file, void *fh,
413 chip->revision = 0; 413 chip->revision = 0;
414 if (dev->mpeg_i2c_client == NULL) 414 if (dev->mpeg_i2c_client == NULL)
415 return -EINVAL; 415 return -EINVAL;
416 if (chip->match_type == V4L2_CHIP_MATCH_I2C_DRIVER && 416 if (chip->match.type == V4L2_CHIP_MATCH_I2C_DRIVER &&
417 chip->match_chip == I2C_DRIVERID_SAA6752HS) 417 !strcmp(chip->match.name, "saa6752hs"))
418 return saa7134_i2c_call_saa6752(dev, VIDIOC_G_CHIP_IDENT, chip); 418 return saa7134_i2c_call_saa6752(dev, VIDIOC_DBG_G_CHIP_IDENT, chip);
419 if (chip->match_type == V4L2_CHIP_MATCH_I2C_ADDR && 419 if (chip->match.type == V4L2_CHIP_MATCH_I2C_ADDR &&
420 chip->match_chip == dev->mpeg_i2c_client->addr) 420 chip->match.addr == dev->mpeg_i2c_client->addr)
421 return saa7134_i2c_call_saa6752(dev, VIDIOC_G_CHIP_IDENT, chip); 421 return saa7134_i2c_call_saa6752(dev, VIDIOC_DBG_G_CHIP_IDENT, chip);
422 return -EINVAL; 422 return -EINVAL;
423} 423}
424 424
@@ -437,7 +437,7 @@ static int empress_g_std(struct file *file, void *priv, v4l2_std_id *id)
437 return 0; 437 return 0;
438} 438}
439 439
440static const struct file_operations ts_fops = 440static const struct v4l2_file_operations ts_fops =
441{ 441{
442 .owner = THIS_MODULE, 442 .owner = THIS_MODULE,
443 .open = ts_open, 443 .open = ts_open,
@@ -446,7 +446,6 @@ static const struct file_operations ts_fops =
446 .poll = ts_poll, 446 .poll = ts_poll,
447 .mmap = ts_mmap, 447 .mmap = ts_mmap,
448 .ioctl = video_ioctl2, 448 .ioctl = video_ioctl2,
449 .llseek = no_llseek,
450}; 449};
451 450
452static const struct v4l2_ioctl_ops ts_ioctl_ops = { 451static const struct v4l2_ioctl_ops ts_ioctl_ops = {
diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c
index d2124f64e4e2..8a106d36e723 100644
--- a/drivers/media/video/saa7134/saa7134-input.c
+++ b/drivers/media/video/saa7134/saa7134-input.c
@@ -449,6 +449,7 @@ int saa7134_input_init1(struct saa7134_dev *dev)
449 case SAA7134_BOARD_AVERMEDIA_STUDIO_507: 449 case SAA7134_BOARD_AVERMEDIA_STUDIO_507:
450 case SAA7134_BOARD_AVERMEDIA_GO_007_FM: 450 case SAA7134_BOARD_AVERMEDIA_GO_007_FM:
451 case SAA7134_BOARD_AVERMEDIA_M102: 451 case SAA7134_BOARD_AVERMEDIA_M102:
452 case SAA7134_BOARD_AVERMEDIA_GO_007_FM_PLUS:
452 ir_codes = ir_codes_avermedia; 453 ir_codes = ir_codes_avermedia;
453 mask_keycode = 0x0007C8; 454 mask_keycode = 0x0007C8;
454 mask_keydown = 0x000010; 455 mask_keydown = 0x000010;
diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c
index 02bb6747a39c..a1f7e351f572 100644
--- a/drivers/media/video/saa7134/saa7134-video.c
+++ b/drivers/media/video/saa7134/saa7134-video.c
@@ -1326,9 +1326,9 @@ static int saa7134_resource(struct saa7134_fh *fh)
1326 return 0; 1326 return 0;
1327} 1327}
1328 1328
1329static int video_open(struct inode *inode, struct file *file) 1329static int video_open(struct file *file)
1330{ 1330{
1331 int minor = iminor(inode); 1331 int minor = video_devdata(file)->minor;
1332 struct saa7134_dev *dev; 1332 struct saa7134_dev *dev;
1333 struct saa7134_fh *fh; 1333 struct saa7134_fh *fh;
1334 enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 1334 enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
@@ -1462,7 +1462,7 @@ err:
1462 return POLLERR; 1462 return POLLERR;
1463} 1463}
1464 1464
1465static int video_release(struct inode *inode, struct file *file) 1465static int video_release(struct file *file)
1466{ 1466{
1467 struct saa7134_fh *fh = file->private_data; 1467 struct saa7134_fh *fh = file->private_data;
1468 struct saa7134_dev *dev = fh->dev; 1468 struct saa7134_dev *dev = fh->dev;
@@ -2247,24 +2247,25 @@ static int saa7134_g_parm(struct file *file, void *fh,
2247 2247
2248#ifdef CONFIG_VIDEO_ADV_DEBUG 2248#ifdef CONFIG_VIDEO_ADV_DEBUG
2249static int vidioc_g_register (struct file *file, void *priv, 2249static int vidioc_g_register (struct file *file, void *priv,
2250 struct v4l2_register *reg) 2250 struct v4l2_dbg_register *reg)
2251{ 2251{
2252 struct saa7134_fh *fh = priv; 2252 struct saa7134_fh *fh = priv;
2253 struct saa7134_dev *dev = fh->dev; 2253 struct saa7134_dev *dev = fh->dev;
2254 2254
2255 if (!v4l2_chip_match_host(reg->match_type, reg->match_chip)) 2255 if (!v4l2_chip_match_host(&reg->match))
2256 return -EINVAL; 2256 return -EINVAL;
2257 reg->val = saa_readb(reg->reg); 2257 reg->val = saa_readb(reg->reg);
2258 reg->size = 1;
2258 return 0; 2259 return 0;
2259} 2260}
2260 2261
2261static int vidioc_s_register (struct file *file, void *priv, 2262static int vidioc_s_register (struct file *file, void *priv,
2262 struct v4l2_register *reg) 2263 struct v4l2_dbg_register *reg)
2263{ 2264{
2264 struct saa7134_fh *fh = priv; 2265 struct saa7134_fh *fh = priv;
2265 struct saa7134_dev *dev = fh->dev; 2266 struct saa7134_dev *dev = fh->dev;
2266 2267
2267 if (!v4l2_chip_match_host(reg->match_type, reg->match_chip)) 2268 if (!v4l2_chip_match_host(&reg->match))
2268 return -EINVAL; 2269 return -EINVAL;
2269 saa_writeb(reg->reg&0xffffff, reg->val); 2270 saa_writeb(reg->reg&0xffffff, reg->val);
2270 return 0; 2271 return 0;
@@ -2377,7 +2378,7 @@ static int radio_queryctrl(struct file *file, void *priv,
2377 return 0; 2378 return 0;
2378} 2379}
2379 2380
2380static const struct file_operations video_fops = 2381static const struct v4l2_file_operations video_fops =
2381{ 2382{
2382 .owner = THIS_MODULE, 2383 .owner = THIS_MODULE,
2383 .open = video_open, 2384 .open = video_open,
@@ -2386,8 +2387,6 @@ static const struct file_operations video_fops =
2386 .poll = video_poll, 2387 .poll = video_poll,
2387 .mmap = video_mmap, 2388 .mmap = video_mmap,
2388 .ioctl = video_ioctl2, 2389 .ioctl = video_ioctl2,
2389 .compat_ioctl = v4l_compat_ioctl32,
2390 .llseek = no_llseek,
2391}; 2390};
2392 2391
2393static const struct v4l2_ioctl_ops video_ioctl_ops = { 2392static const struct v4l2_ioctl_ops video_ioctl_ops = {
@@ -2441,13 +2440,11 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = {
2441#endif 2440#endif
2442}; 2441};
2443 2442
2444static const struct file_operations radio_fops = { 2443static const struct v4l2_file_operations radio_fops = {
2445 .owner = THIS_MODULE, 2444 .owner = THIS_MODULE,
2446 .open = video_open, 2445 .open = video_open,
2447 .release = video_release, 2446 .release = video_release,
2448 .ioctl = video_ioctl2, 2447 .ioctl = video_ioctl2,
2449 .compat_ioctl = v4l_compat_ioctl32,
2450 .llseek = no_llseek,
2451}; 2448};
2452 2449
2453static const struct v4l2_ioctl_ops radio_ioctl_ops = { 2450static const struct v4l2_ioctl_ops radio_ioctl_ops = {
diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h
index f6c1fcc72070..14ee265f3374 100644
--- a/drivers/media/video/saa7134/saa7134.h
+++ b/drivers/media/video/saa7134/saa7134.h
@@ -276,6 +276,7 @@ struct saa7134_format {
276#define SAA7134_BOARD_ADS_INSTANT_HDTV_PCI 151 276#define SAA7134_BOARD_ADS_INSTANT_HDTV_PCI 151
277#define SAA7134_BOARD_ASUSTeK_TIGER 152 277#define SAA7134_BOARD_ASUSTeK_TIGER 152
278#define SAA7134_BOARD_KWORLD_PLUS_TV_ANALOG 153 278#define SAA7134_BOARD_KWORLD_PLUS_TV_ANALOG 153
279#define SAA7134_BOARD_AVERMEDIA_GO_007_FM_PLUS 154
279 280
280#define SAA7134_MAXBOARDS 32 281#define SAA7134_MAXBOARDS 32
281#define SAA7134_INPUT_MAX 8 282#define SAA7134_INPUT_MAX 8
diff --git a/drivers/media/video/saa717x.c b/drivers/media/video/saa717x.c
index 9befca65905e..454ad1dd7507 100644
--- a/drivers/media/video/saa717x.c
+++ b/drivers/media/video/saa717x.c
@@ -1171,25 +1171,26 @@ static int saa717x_queryctrl(struct v4l2_subdev *sd, struct v4l2_queryctrl *qc)
1171} 1171}
1172 1172
1173#ifdef CONFIG_VIDEO_ADV_DEBUG 1173#ifdef CONFIG_VIDEO_ADV_DEBUG
1174static int saa717x_g_register(struct v4l2_subdev *sd, struct v4l2_register *reg) 1174static int saa717x_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg)
1175{ 1175{
1176 struct i2c_client *client = v4l2_get_subdevdata(sd); 1176 struct i2c_client *client = v4l2_get_subdevdata(sd);
1177 1177
1178 if (!v4l2_chip_match_i2c_client(client, reg->match_type, reg->match_chip)) 1178 if (!v4l2_chip_match_i2c_client(client, &reg->match))
1179 return -EINVAL; 1179 return -EINVAL;
1180 if (!capable(CAP_SYS_ADMIN)) 1180 if (!capable(CAP_SYS_ADMIN))
1181 return -EPERM; 1181 return -EPERM;
1182 reg->val = saa717x_read(sd, reg->reg); 1182 reg->val = saa717x_read(sd, reg->reg);
1183 reg->size = 1;
1183 return 0; 1184 return 0;
1184} 1185}
1185 1186
1186static int saa717x_s_register(struct v4l2_subdev *sd, struct v4l2_register *reg) 1187static int saa717x_s_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg)
1187{ 1188{
1188 struct i2c_client *client = v4l2_get_subdevdata(sd); 1189 struct i2c_client *client = v4l2_get_subdevdata(sd);
1189 u16 addr = reg->reg & 0xffff; 1190 u16 addr = reg->reg & 0xffff;
1190 u8 val = reg->val & 0xff; 1191 u8 val = reg->val & 0xff;
1191 1192
1192 if (!v4l2_chip_match_i2c_client(client, reg->match_type, reg->match_chip)) 1193 if (!v4l2_chip_match_i2c_client(client, &reg->match))
1193 return -EINVAL; 1194 return -EINVAL;
1194 if (!capable(CAP_SYS_ADMIN)) 1195 if (!capable(CAP_SYS_ADMIN))
1195 return -EPERM; 1196 return -EPERM;
diff --git a/drivers/media/video/se401.c b/drivers/media/video/se401.c
index d652f25eef0e..5990ab38a124 100644
--- a/drivers/media/video/se401.c
+++ b/drivers/media/video/se401.c
@@ -932,7 +932,7 @@ static void usb_se401_remove_disconnected (struct usb_se401 *se401)
932 ***************************************************************************/ 932 ***************************************************************************/
933 933
934 934
935static int se401_open(struct inode *inode, struct file *file) 935static int se401_open(struct file *file)
936{ 936{
937 struct video_device *dev = video_devdata(file); 937 struct video_device *dev = video_devdata(file);
938 struct usb_se401 *se401 = (struct usb_se401 *)dev; 938 struct usb_se401 *se401 = (struct usb_se401 *)dev;
@@ -954,7 +954,7 @@ static int se401_open(struct inode *inode, struct file *file)
954 return err; 954 return err;
955} 955}
956 956
957static int se401_close(struct inode *inode, struct file *file) 957static int se401_close(struct file *file)
958{ 958{
959 struct video_device *dev = file->private_data; 959 struct video_device *dev = file->private_data;
960 struct usb_se401 *se401 = (struct usb_se401 *)dev; 960 struct usb_se401 *se401 = (struct usb_se401 *)dev;
@@ -975,7 +975,7 @@ static int se401_close(struct inode *inode, struct file *file)
975 return 0; 975 return 0;
976} 976}
977 977
978static int se401_do_ioctl(struct file *file, unsigned int cmd, void *arg) 978static long se401_do_ioctl(struct file *file, unsigned int cmd, void *arg)
979{ 979{
980 struct video_device *vdev = file->private_data; 980 struct video_device *vdev = file->private_data;
981 struct usb_se401 *se401 = (struct usb_se401 *)vdev; 981 struct usb_se401 *se401 = (struct usb_se401 *)vdev;
@@ -1138,7 +1138,7 @@ static int se401_do_ioctl(struct file *file, unsigned int cmd, void *arg)
1138 return 0; 1138 return 0;
1139} 1139}
1140 1140
1141static int se401_ioctl(struct inode *inode, struct file *file, 1141static long se401_ioctl(struct file *file,
1142 unsigned int cmd, unsigned long arg) 1142 unsigned int cmd, unsigned long arg)
1143{ 1143{
1144 return video_usercopy(file, cmd, arg, se401_do_ioctl); 1144 return video_usercopy(file, cmd, arg, se401_do_ioctl);
@@ -1222,17 +1222,13 @@ static int se401_mmap(struct file *file, struct vm_area_struct *vma)
1222 return 0; 1222 return 0;
1223} 1223}
1224 1224
1225static const struct file_operations se401_fops = { 1225static const struct v4l2_file_operations se401_fops = {
1226 .owner = THIS_MODULE, 1226 .owner = THIS_MODULE,
1227 .open = se401_open, 1227 .open = se401_open,
1228 .release = se401_close, 1228 .release = se401_close,
1229 .read = se401_read, 1229 .read = se401_read,
1230 .mmap = se401_mmap, 1230 .mmap = se401_mmap,
1231 .ioctl = se401_ioctl, 1231 .ioctl = se401_ioctl,
1232#ifdef CONFIG_COMPAT
1233 .compat_ioctl = v4l_compat_ioctl32,
1234#endif
1235 .llseek = no_llseek,
1236}; 1232};
1237static struct video_device se401_template = { 1233static struct video_device se401_template = {
1238 .name = "se401 USB camera", 1234 .name = "se401 USB camera",
diff --git a/drivers/media/video/sn9c102/sn9c102_core.c b/drivers/media/video/sn9c102/sn9c102_core.c
index 01a8efb8deb1..23edfdc4d4bc 100644
--- a/drivers/media/video/sn9c102/sn9c102_core.c
+++ b/drivers/media/video/sn9c102/sn9c102_core.c
@@ -1746,7 +1746,7 @@ static void sn9c102_release_resources(struct kref *kref)
1746} 1746}
1747 1747
1748 1748
1749static int sn9c102_open(struct inode* inode, struct file* filp) 1749static int sn9c102_open(struct file *filp)
1750{ 1750{
1751 struct sn9c102_device* cam; 1751 struct sn9c102_device* cam;
1752 int err = 0; 1752 int err = 0;
@@ -1857,7 +1857,7 @@ out:
1857} 1857}
1858 1858
1859 1859
1860static int sn9c102_release(struct inode* inode, struct file* filp) 1860static int sn9c102_release(struct file *filp)
1861{ 1861{
1862 struct sn9c102_device* cam; 1862 struct sn9c102_device* cam;
1863 1863
@@ -3092,8 +3092,8 @@ sn9c102_vidioc_s_audio(struct sn9c102_device* cam, void __user * arg)
3092} 3092}
3093 3093
3094 3094
3095static int sn9c102_ioctl_v4l2(struct inode* inode, struct file* filp, 3095static long sn9c102_ioctl_v4l2(struct file *filp,
3096 unsigned int cmd, void __user * arg) 3096 unsigned int cmd, void __user *arg)
3097{ 3097{
3098 struct sn9c102_device *cam = video_drvdata(filp); 3098 struct sn9c102_device *cam = video_drvdata(filp);
3099 3099
@@ -3196,7 +3196,7 @@ static int sn9c102_ioctl_v4l2(struct inode* inode, struct file* filp,
3196} 3196}
3197 3197
3198 3198
3199static int sn9c102_ioctl(struct inode* inode, struct file* filp, 3199static long sn9c102_ioctl(struct file *filp,
3200 unsigned int cmd, unsigned long arg) 3200 unsigned int cmd, unsigned long arg)
3201{ 3201{
3202 struct sn9c102_device *cam = video_drvdata(filp); 3202 struct sn9c102_device *cam = video_drvdata(filp);
@@ -3220,7 +3220,7 @@ static int sn9c102_ioctl(struct inode* inode, struct file* filp,
3220 3220
3221 V4LDBG(3, "sn9c102", cmd); 3221 V4LDBG(3, "sn9c102", cmd);
3222 3222
3223 err = sn9c102_ioctl_v4l2(inode, filp, cmd, (void __user *)arg); 3223 err = sn9c102_ioctl_v4l2(filp, cmd, (void __user *)arg);
3224 3224
3225 mutex_unlock(&cam->fileop_mutex); 3225 mutex_unlock(&cam->fileop_mutex);
3226 3226
@@ -3229,18 +3229,14 @@ static int sn9c102_ioctl(struct inode* inode, struct file* filp,
3229 3229
3230/*****************************************************************************/ 3230/*****************************************************************************/
3231 3231
3232static const struct file_operations sn9c102_fops = { 3232static const struct v4l2_file_operations sn9c102_fops = {
3233 .owner = THIS_MODULE, 3233 .owner = THIS_MODULE,
3234 .open = sn9c102_open, 3234 .open = sn9c102_open,
3235 .release = sn9c102_release, 3235 .release = sn9c102_release,
3236 .ioctl = sn9c102_ioctl, 3236 .ioctl = sn9c102_ioctl,
3237#ifdef CONFIG_COMPAT
3238 .compat_ioctl = v4l_compat_ioctl32,
3239#endif
3240 .read = sn9c102_read, 3237 .read = sn9c102_read,
3241 .poll = sn9c102_poll, 3238 .poll = sn9c102_poll,
3242 .mmap = sn9c102_mmap, 3239 .mmap = sn9c102_mmap,
3243 .llseek = no_llseek,
3244}; 3240};
3245 3241
3246/*****************************************************************************/ 3242/*****************************************************************************/
diff --git a/drivers/media/video/soc_camera.c b/drivers/media/video/soc_camera.c
index 90077cb4fe66..fcb05f06de8f 100644
--- a/drivers/media/video/soc_camera.c
+++ b/drivers/media/video/soc_camera.c
@@ -256,7 +256,7 @@ static void soc_camera_free_user_formats(struct soc_camera_device *icd)
256 vfree(icd->user_formats); 256 vfree(icd->user_formats);
257} 257}
258 258
259static int soc_camera_open(struct inode *inode, struct file *file) 259static int soc_camera_open(struct file *file)
260{ 260{
261 struct video_device *vdev; 261 struct video_device *vdev;
262 struct soc_camera_device *icd; 262 struct soc_camera_device *icd;
@@ -330,7 +330,7 @@ emgd:
330 return ret; 330 return ret;
331} 331}
332 332
333static int soc_camera_close(struct inode *inode, struct file *file) 333static int soc_camera_close(struct file *file)
334{ 334{
335 struct soc_camera_file *icf = file->private_data; 335 struct soc_camera_file *icf = file->private_data;
336 struct soc_camera_device *icd = icf->icd; 336 struct soc_camera_device *icd = icf->icd;
@@ -400,7 +400,7 @@ static unsigned int soc_camera_poll(struct file *file, poll_table *pt)
400 return ici->ops->poll(file, pt); 400 return ici->ops->poll(file, pt);
401} 401}
402 402
403static struct file_operations soc_camera_fops = { 403static struct v4l2_file_operations soc_camera_fops = {
404 .owner = THIS_MODULE, 404 .owner = THIS_MODULE,
405 .open = soc_camera_open, 405 .open = soc_camera_open,
406 .release = soc_camera_close, 406 .release = soc_camera_close,
@@ -408,7 +408,6 @@ static struct file_operations soc_camera_fops = {
408 .read = soc_camera_read, 408 .read = soc_camera_read,
409 .mmap = soc_camera_mmap, 409 .mmap = soc_camera_mmap,
410 .poll = soc_camera_poll, 410 .poll = soc_camera_poll,
411 .llseek = no_llseek,
412}; 411};
413 412
414static int soc_camera_s_fmt_vid_cap(struct file *file, void *priv, 413static int soc_camera_s_fmt_vid_cap(struct file *file, void *priv,
@@ -700,7 +699,7 @@ static int soc_camera_s_crop(struct file *file, void *fh,
700} 699}
701 700
702static int soc_camera_g_chip_ident(struct file *file, void *fh, 701static int soc_camera_g_chip_ident(struct file *file, void *fh,
703 struct v4l2_chip_ident *id) 702 struct v4l2_dbg_chip_ident *id)
704{ 703{
705 struct soc_camera_file *icf = file->private_data; 704 struct soc_camera_file *icf = file->private_data;
706 struct soc_camera_device *icd = icf->icd; 705 struct soc_camera_device *icd = icf->icd;
@@ -713,7 +712,7 @@ static int soc_camera_g_chip_ident(struct file *file, void *fh,
713 712
714#ifdef CONFIG_VIDEO_ADV_DEBUG 713#ifdef CONFIG_VIDEO_ADV_DEBUG
715static int soc_camera_g_register(struct file *file, void *fh, 714static int soc_camera_g_register(struct file *file, void *fh,
716 struct v4l2_register *reg) 715 struct v4l2_dbg_register *reg)
717{ 716{
718 struct soc_camera_file *icf = file->private_data; 717 struct soc_camera_file *icf = file->private_data;
719 struct soc_camera_device *icd = icf->icd; 718 struct soc_camera_device *icd = icf->icd;
@@ -725,7 +724,7 @@ static int soc_camera_g_register(struct file *file, void *fh,
725} 724}
726 725
727static int soc_camera_s_register(struct file *file, void *fh, 726static int soc_camera_s_register(struct file *file, void *fh,
728 struct v4l2_register *reg) 727 struct v4l2_dbg_register *reg)
729{ 728{
730 struct soc_camera_file *icf = file->private_data; 729 struct soc_camera_file *icf = file->private_data;
731 struct soc_camera_device *icd = icf->icd; 730 struct soc_camera_device *icd = icf->icd;
diff --git a/drivers/media/video/stk-webcam.c b/drivers/media/video/stk-webcam.c
index f9516d0f3c11..26378cf390fc 100644
--- a/drivers/media/video/stk-webcam.c
+++ b/drivers/media/video/stk-webcam.c
@@ -664,7 +664,7 @@ static void stk_free_buffers(struct stk_camera *dev)
664 664
665/* v4l file operations */ 665/* v4l file operations */
666 666
667static int v4l_stk_open(struct inode *inode, struct file *fp) 667static int v4l_stk_open(struct file *fp)
668{ 668{
669 struct stk_camera *dev; 669 struct stk_camera *dev;
670 struct video_device *vdev; 670 struct video_device *vdev;
@@ -684,7 +684,7 @@ static int v4l_stk_open(struct inode *inode, struct file *fp)
684 return 0; 684 return 0;
685} 685}
686 686
687static int v4l_stk_release(struct inode *inode, struct file *fp) 687static int v4l_stk_release(struct file *fp)
688{ 688{
689 struct stk_camera *dev = fp->private_data; 689 struct stk_camera *dev = fp->private_data;
690 690
@@ -1281,7 +1281,7 @@ static int stk_vidioc_enum_framesizes(struct file *filp,
1281 } 1281 }
1282} 1282}
1283 1283
1284static struct file_operations v4l_stk_fops = { 1284static struct v4l2_file_operations v4l_stk_fops = {
1285 .owner = THIS_MODULE, 1285 .owner = THIS_MODULE,
1286 .open = v4l_stk_open, 1286 .open = v4l_stk_open,
1287 .release = v4l_stk_release, 1287 .release = v4l_stk_release,
@@ -1289,10 +1289,6 @@ static struct file_operations v4l_stk_fops = {
1289 .poll = v4l_stk_poll, 1289 .poll = v4l_stk_poll,
1290 .mmap = v4l_stk_mmap, 1290 .mmap = v4l_stk_mmap,
1291 .ioctl = video_ioctl2, 1291 .ioctl = video_ioctl2,
1292#ifdef CONFIG_COMPAT
1293 .compat_ioctl = v4l_compat_ioctl32,
1294#endif
1295 .llseek = no_llseek
1296}; 1292};
1297 1293
1298static const struct v4l2_ioctl_ops v4l_stk_ioctl_ops = { 1294static const struct v4l2_ioctl_ops v4l_stk_ioctl_ops = {
diff --git a/drivers/media/video/stradis.c b/drivers/media/video/stradis.c
index bbad54f85c83..0eb313082c97 100644
--- a/drivers/media/video/stradis.c
+++ b/drivers/media/video/stradis.c
@@ -1275,7 +1275,7 @@ static void make_clip_tab(struct saa7146 *saa, struct video_clip *cr, int ncr)
1275 clip_draw_rectangle(clipmap, 0, 0, 1024, -saa->win.y); 1275 clip_draw_rectangle(clipmap, 0, 0, 1024, -saa->win.y);
1276} 1276}
1277 1277
1278static int saa_ioctl(struct inode *inode, struct file *file, 1278static long saa_ioctl(struct file *file,
1279 unsigned int cmd, unsigned long argl) 1279 unsigned int cmd, unsigned long argl)
1280{ 1280{
1281 struct saa7146 *saa = file->private_data; 1281 struct saa7146 *saa = file->private_data;
@@ -1877,7 +1877,7 @@ static ssize_t saa_write(struct file *file, const char __user * buf,
1877 return count; 1877 return count;
1878} 1878}
1879 1879
1880static int saa_open(struct inode *inode, struct file *file) 1880static int saa_open(struct file *file)
1881{ 1881{
1882 struct video_device *vdev = video_devdata(file); 1882 struct video_device *vdev = video_devdata(file);
1883 struct saa7146 *saa = container_of(vdev, struct saa7146, video_dev); 1883 struct saa7146 *saa = container_of(vdev, struct saa7146, video_dev);
@@ -1895,7 +1895,7 @@ static int saa_open(struct inode *inode, struct file *file)
1895 return 0; 1895 return 0;
1896} 1896}
1897 1897
1898static int saa_release(struct inode *inode, struct file *file) 1898static int saa_release(struct file *file)
1899{ 1899{
1900 struct saa7146 *saa = file->private_data; 1900 struct saa7146 *saa = file->private_data;
1901 saa->user--; 1901 saa->user--;
@@ -1906,16 +1906,12 @@ static int saa_release(struct inode *inode, struct file *file)
1906 return 0; 1906 return 0;
1907} 1907}
1908 1908
1909static const struct file_operations saa_fops = { 1909static const struct v4l2_file_operations saa_fops = {
1910 .owner = THIS_MODULE, 1910 .owner = THIS_MODULE,
1911 .open = saa_open, 1911 .open = saa_open,
1912 .release = saa_release, 1912 .release = saa_release,
1913 .ioctl = saa_ioctl, 1913 .ioctl = saa_ioctl,
1914#ifdef CONFIG_COMPAT
1915 .compat_ioctl = v4l_compat_ioctl32,
1916#endif
1917 .read = saa_read, 1914 .read = saa_read,
1918 .llseek = no_llseek,
1919 .write = saa_write, 1915 .write = saa_write,
1920 .mmap = saa_mmap, 1916 .mmap = saa_mmap,
1921}; 1917};
diff --git a/drivers/media/video/stv680.c b/drivers/media/video/stv680.c
index 42acc92c182d..75f286f7a2e9 100644
--- a/drivers/media/video/stv680.c
+++ b/drivers/media/video/stv680.c
@@ -1080,7 +1080,7 @@ static int stv680_newframe (struct usb_stv *stv680, int framenr)
1080 * Video4Linux 1080 * Video4Linux
1081 *********************************************************************/ 1081 *********************************************************************/
1082 1082
1083static int stv_open (struct inode *inode, struct file *file) 1083static int stv_open(struct file *file)
1084{ 1084{
1085 struct video_device *dev = video_devdata(file); 1085 struct video_device *dev = video_devdata(file);
1086 struct usb_stv *stv680 = video_get_drvdata(dev); 1086 struct usb_stv *stv680 = video_get_drvdata(dev);
@@ -1106,7 +1106,7 @@ static int stv_open (struct inode *inode, struct file *file)
1106 return err; 1106 return err;
1107} 1107}
1108 1108
1109static int stv_close (struct inode *inode, struct file *file) 1109static int stv_close(struct file *file)
1110{ 1110{
1111 struct video_device *dev = file->private_data; 1111 struct video_device *dev = file->private_data;
1112 struct usb_stv *stv680 = video_get_drvdata(dev); 1112 struct usb_stv *stv680 = video_get_drvdata(dev);
@@ -1132,7 +1132,7 @@ static int stv_close (struct inode *inode, struct file *file)
1132 return 0; 1132 return 0;
1133} 1133}
1134 1134
1135static int stv680_do_ioctl(struct file *file, unsigned int cmd, void *arg) 1135static long stv680_do_ioctl(struct file *file, unsigned int cmd, void *arg)
1136{ 1136{
1137 struct video_device *vdev = file->private_data; 1137 struct video_device *vdev = file->private_data;
1138 struct usb_stv *stv680 = video_get_drvdata(vdev); 1138 struct usb_stv *stv680 = video_get_drvdata(vdev);
@@ -1299,7 +1299,7 @@ static int stv680_do_ioctl(struct file *file, unsigned int cmd, void *arg)
1299 return 0; 1299 return 0;
1300} 1300}
1301 1301
1302static int stv680_ioctl(struct inode *inode, struct file *file, 1302static long stv680_ioctl(struct file *file,
1303 unsigned int cmd, unsigned long arg) 1303 unsigned int cmd, unsigned long arg)
1304{ 1304{
1305 return video_usercopy(file, cmd, arg, stv680_do_ioctl); 1305 return video_usercopy(file, cmd, arg, stv680_do_ioctl);
@@ -1391,17 +1391,13 @@ static ssize_t stv680_read (struct file *file, char __user *buf,
1391 return realcount; 1391 return realcount;
1392} /* stv680_read */ 1392} /* stv680_read */
1393 1393
1394static const struct file_operations stv680_fops = { 1394static const struct v4l2_file_operations stv680_fops = {
1395 .owner = THIS_MODULE, 1395 .owner = THIS_MODULE,
1396 .open = stv_open, 1396 .open = stv_open,
1397 .release = stv_close, 1397 .release = stv_close,
1398 .read = stv680_read, 1398 .read = stv680_read,
1399 .mmap = stv680_mmap, 1399 .mmap = stv680_mmap,
1400 .ioctl = stv680_ioctl, 1400 .ioctl = stv680_ioctl,
1401#ifdef CONFIG_COMPAT
1402 .compat_ioctl = v4l_compat_ioctl32,
1403#endif
1404 .llseek = no_llseek,
1405}; 1401};
1406static struct video_device stv680_template = { 1402static struct video_device stv680_template = {
1407 .name = "STV0680 USB camera", 1403 .name = "STV0680 USB camera",
diff --git a/drivers/media/video/tda9840.c b/drivers/media/video/tda9840.c
index 2644e0dc9251..6afb7059502d 100644
--- a/drivers/media/video/tda9840.c
+++ b/drivers/media/video/tda9840.c
@@ -137,7 +137,7 @@ static int tda9840_g_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *t)
137 return 0; 137 return 0;
138} 138}
139 139
140static int tda9840_ioctl(struct v4l2_subdev *sd, unsigned cmd, void *arg) 140static long tda9840_ioctl(struct v4l2_subdev *sd, unsigned cmd, void *arg)
141{ 141{
142 int byte; 142 int byte;
143 143
diff --git a/drivers/media/video/tea6415c.c b/drivers/media/video/tea6415c.c
index 31dde86f2df4..7519fd1f57ef 100644
--- a/drivers/media/video/tea6415c.c
+++ b/drivers/media/video/tea6415c.c
@@ -122,7 +122,7 @@ static int switch_matrix(struct i2c_client *client, int i, int o)
122 return ret; 122 return ret;
123} 123}
124 124
125static int tea6415c_ioctl(struct v4l2_subdev *sd, unsigned cmd, void *arg) 125static long tea6415c_ioctl(struct v4l2_subdev *sd, unsigned cmd, void *arg)
126{ 126{
127 if (cmd == TEA6415C_SWITCH) { 127 if (cmd == TEA6415C_SWITCH) {
128 struct i2c_client *client = v4l2_get_subdevdata(sd); 128 struct i2c_client *client = v4l2_get_subdevdata(sd);
diff --git a/drivers/media/video/tea6420.c b/drivers/media/video/tea6420.c
index 38e519f04bde..081e74fa3b2e 100644
--- a/drivers/media/video/tea6420.c
+++ b/drivers/media/video/tea6420.c
@@ -90,7 +90,7 @@ static int tea6420_switch(struct i2c_client *client, int i, int o, int g)
90 return 0; 90 return 0;
91} 91}
92 92
93static int tea6420_ioctl(struct v4l2_subdev *sd, unsigned cmd, void *arg) 93static long tea6420_ioctl(struct v4l2_subdev *sd, unsigned cmd, void *arg)
94{ 94{
95 if (cmd == TEA6420_SWITCH) { 95 if (cmd == TEA6420_SWITCH) {
96 struct i2c_client *client = v4l2_get_subdevdata(sd); 96 struct i2c_client *client = v4l2_get_subdevdata(sd);
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c
index 97d7509d212f..30640fbfd0f9 100644
--- a/drivers/media/video/tuner-core.c
+++ b/drivers/media/video/tuner-core.c
@@ -800,7 +800,7 @@ static int tuner_s_standby(struct v4l2_subdev *sd, u32 standby)
800} 800}
801 801
802#ifdef CONFIG_VIDEO_ALLOW_V4L1 802#ifdef CONFIG_VIDEO_ALLOW_V4L1
803static int tuner_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg) 803static long tuner_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
804{ 804{
805 struct tuner *t = to_tuner(sd); 805 struct tuner *t = to_tuner(sd);
806 struct i2c_client *client = v4l2_get_subdevdata(sd); 806 struct i2c_client *client = v4l2_get_subdevdata(sd);
diff --git a/drivers/media/video/tvaudio.c b/drivers/media/video/tvaudio.c
index d0c794da735b..5aeccb301cea 100644
--- a/drivers/media/video/tvaudio.c
+++ b/drivers/media/video/tvaudio.c
@@ -1762,7 +1762,7 @@ static int tvaudio_s_frequency(struct v4l2_subdev *sd, struct v4l2_frequency *fr
1762 return 0; 1762 return 0;
1763} 1763}
1764 1764
1765static int tvaudio_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_chip_ident *chip) 1765static int tvaudio_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip)
1766{ 1766{
1767 struct i2c_client *client = v4l2_get_subdevdata(sd); 1767 struct i2c_client *client = v4l2_get_subdevdata(sd);
1768 1768
diff --git a/drivers/media/video/tvp5150.c b/drivers/media/video/tvp5150.c
index a388a9f0cb18..2cd64ef27b95 100644
--- a/drivers/media/video/tvp5150.c
+++ b/drivers/media/video/tvp5150.c
@@ -963,7 +963,7 @@ static int tvp5150_g_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt)
963 963
964 964
965static int tvp5150_g_chip_ident(struct v4l2_subdev *sd, 965static int tvp5150_g_chip_ident(struct v4l2_subdev *sd,
966 struct v4l2_chip_ident *chip) 966 struct v4l2_dbg_chip_ident *chip)
967{ 967{
968 int rev; 968 int rev;
969 struct i2c_client *client = v4l2_get_subdevdata(sd); 969 struct i2c_client *client = v4l2_get_subdevdata(sd);
@@ -977,25 +977,24 @@ static int tvp5150_g_chip_ident(struct v4l2_subdev *sd,
977 977
978 978
979#ifdef CONFIG_VIDEO_ADV_DEBUG 979#ifdef CONFIG_VIDEO_ADV_DEBUG
980static int tvp5150_g_register(struct v4l2_subdev *sd, struct v4l2_register *reg) 980static int tvp5150_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg)
981{ 981{
982 struct i2c_client *client = v4l2_get_subdevdata(sd); 982 struct i2c_client *client = v4l2_get_subdevdata(sd);
983 983
984 if (!v4l2_chip_match_i2c_client(client, 984 if (!v4l2_chip_match_i2c_client(client, &reg->match))
985 reg->match_type, reg->match_chip))
986 return -EINVAL; 985 return -EINVAL;
987 if (!capable(CAP_SYS_ADMIN)) 986 if (!capable(CAP_SYS_ADMIN))
988 return -EPERM; 987 return -EPERM;
989 reg->val = tvp5150_read(sd, reg->reg & 0xff); 988 reg->val = tvp5150_read(sd, reg->reg & 0xff);
989 reg->size = 1;
990 return 0; 990 return 0;
991} 991}
992 992
993static int tvp5150_s_register(struct v4l2_subdev *sd, struct v4l2_register *reg) 993static int tvp5150_s_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg)
994{ 994{
995 struct i2c_client *client = v4l2_get_subdevdata(sd); 995 struct i2c_client *client = v4l2_get_subdevdata(sd);
996 996
997 if (!v4l2_chip_match_i2c_client(client, 997 if (!v4l2_chip_match_i2c_client(client, &reg->match))
998 reg->match_type, reg->match_chip))
999 return -EINVAL; 998 return -EINVAL;
1000 if (!capable(CAP_SYS_ADMIN)) 999 if (!capable(CAP_SYS_ADMIN))
1001 return -EPERM; 1000 return -EPERM;
diff --git a/drivers/media/video/tw9910.c b/drivers/media/video/tw9910.c
index d5cdc4be1a35..52c0357faa5d 100644
--- a/drivers/media/video/tw9910.c
+++ b/drivers/media/video/tw9910.c
@@ -575,7 +575,7 @@ static unsigned long tw9910_query_bus_param(struct soc_camera_device *icd)
575} 575}
576 576
577static int tw9910_get_chip_id(struct soc_camera_device *icd, 577static int tw9910_get_chip_id(struct soc_camera_device *icd,
578 struct v4l2_chip_ident *id) 578 struct v4l2_dbg_chip_ident *id)
579{ 579{
580 id->ident = V4L2_IDENT_TW9910; 580 id->ident = V4L2_IDENT_TW9910;
581 id->revision = 0; 581 id->revision = 0;
@@ -606,7 +606,7 @@ static int tw9910_enum_input(struct soc_camera_device *icd,
606 606
607#ifdef CONFIG_VIDEO_ADV_DEBUG 607#ifdef CONFIG_VIDEO_ADV_DEBUG
608static int tw9910_get_register(struct soc_camera_device *icd, 608static int tw9910_get_register(struct soc_camera_device *icd,
609 struct v4l2_register *reg) 609 struct v4l2_dbg_register *reg)
610{ 610{
611 struct tw9910_priv *priv = container_of(icd, struct tw9910_priv, icd); 611 struct tw9910_priv *priv = container_of(icd, struct tw9910_priv, icd);
612 int ret; 612 int ret;
@@ -627,7 +627,7 @@ static int tw9910_get_register(struct soc_camera_device *icd,
627} 627}
628 628
629static int tw9910_set_register(struct soc_camera_device *icd, 629static int tw9910_set_register(struct soc_camera_device *icd,
630 struct v4l2_register *reg) 630 struct v4l2_dbg_register *reg)
631{ 631{
632 struct tw9910_priv *priv = container_of(icd, struct tw9910_priv, icd); 632 struct tw9910_priv *priv = container_of(icd, struct tw9910_priv, icd);
633 633
diff --git a/drivers/media/video/upd64031a.c b/drivers/media/video/upd64031a.c
index 7a609a3a6dbe..4f16effb530f 100644
--- a/drivers/media/video/upd64031a.c
+++ b/drivers/media/video/upd64031a.c
@@ -147,7 +147,7 @@ static int upd64031a_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing
147 return upd64031a_s_frequency(sd, NULL); 147 return upd64031a_s_frequency(sd, NULL);
148} 148}
149 149
150static int upd64031a_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_chip_ident *chip) 150static int upd64031a_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip)
151{ 151{
152 struct i2c_client *client = v4l2_get_subdevdata(sd); 152 struct i2c_client *client = v4l2_get_subdevdata(sd);
153 153
@@ -162,25 +162,24 @@ static int upd64031a_log_status(struct v4l2_subdev *sd)
162} 162}
163 163
164#ifdef CONFIG_VIDEO_ADV_DEBUG 164#ifdef CONFIG_VIDEO_ADV_DEBUG
165static int upd64031a_g_register(struct v4l2_subdev *sd, struct v4l2_register *reg) 165static int upd64031a_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg)
166{ 166{
167 struct i2c_client *client = v4l2_get_subdevdata(sd); 167 struct i2c_client *client = v4l2_get_subdevdata(sd);
168 168
169 if (!v4l2_chip_match_i2c_client(client, 169 if (!v4l2_chip_match_i2c_client(client, &reg->match))
170 reg->match_type, reg->match_chip))
171 return -EINVAL; 170 return -EINVAL;
172 if (!capable(CAP_SYS_ADMIN)) 171 if (!capable(CAP_SYS_ADMIN))
173 return -EPERM; 172 return -EPERM;
174 reg->val = upd64031a_read(sd, reg->reg & 0xff); 173 reg->val = upd64031a_read(sd, reg->reg & 0xff);
174 reg->size = 1;
175 return 0; 175 return 0;
176} 176}
177 177
178static int upd64031a_s_register(struct v4l2_subdev *sd, struct v4l2_register *reg) 178static int upd64031a_s_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg)
179{ 179{
180 struct i2c_client *client = v4l2_get_subdevdata(sd); 180 struct i2c_client *client = v4l2_get_subdevdata(sd);
181 181
182 if (!v4l2_chip_match_i2c_client(client, 182 if (!v4l2_chip_match_i2c_client(client, &reg->match))
183 reg->match_type, reg->match_chip))
184 return -EINVAL; 183 return -EINVAL;
185 if (!capable(CAP_SYS_ADMIN)) 184 if (!capable(CAP_SYS_ADMIN))
186 return -EPERM; 185 return -EPERM;
diff --git a/drivers/media/video/upd64083.c b/drivers/media/video/upd64083.c
index 58412cb9c01a..4b712f69d1b7 100644
--- a/drivers/media/video/upd64083.c
+++ b/drivers/media/video/upd64083.c
@@ -120,25 +120,24 @@ static int upd64083_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing
120} 120}
121 121
122#ifdef CONFIG_VIDEO_ADV_DEBUG 122#ifdef CONFIG_VIDEO_ADV_DEBUG
123static int upd64083_g_register(struct v4l2_subdev *sd, struct v4l2_register *reg) 123static int upd64083_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg)
124{ 124{
125 struct i2c_client *client = v4l2_get_subdevdata(sd); 125 struct i2c_client *client = v4l2_get_subdevdata(sd);
126 126
127 if (!v4l2_chip_match_i2c_client(client, 127 if (!v4l2_chip_match_i2c_client(client, &reg->match))
128 reg->match_type, reg->match_chip))
129 return -EINVAL; 128 return -EINVAL;
130 if (!capable(CAP_SYS_ADMIN)) 129 if (!capable(CAP_SYS_ADMIN))
131 return -EPERM; 130 return -EPERM;
132 reg->val = upd64083_read(sd, reg->reg & 0xff); 131 reg->val = upd64083_read(sd, reg->reg & 0xff);
132 reg->size = 1;
133 return 0; 133 return 0;
134} 134}
135 135
136static int upd64083_s_register(struct v4l2_subdev *sd, struct v4l2_register *reg) 136static int upd64083_s_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg)
137{ 137{
138 struct i2c_client *client = v4l2_get_subdevdata(sd); 138 struct i2c_client *client = v4l2_get_subdevdata(sd);
139 139
140 if (!v4l2_chip_match_i2c_client(client, 140 if (!v4l2_chip_match_i2c_client(client, &reg->match))
141 reg->match_type, reg->match_chip))
142 return -EINVAL; 141 return -EINVAL;
143 if (!capable(CAP_SYS_ADMIN)) 142 if (!capable(CAP_SYS_ADMIN))
144 return -EPERM; 143 return -EPERM;
@@ -147,7 +146,7 @@ static int upd64083_s_register(struct v4l2_subdev *sd, struct v4l2_register *reg
147} 146}
148#endif 147#endif
149 148
150static int upd64083_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_chip_ident *chip) 149static int upd64083_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip)
151{ 150{
152 struct i2c_client *client = v4l2_get_subdevdata(sd); 151 struct i2c_client *client = v4l2_get_subdevdata(sd);
153 152
diff --git a/drivers/media/video/usbvideo/usbvideo.c b/drivers/media/video/usbvideo/usbvideo.c
index 148a1f98c70f..dea8b321fb4a 100644
--- a/drivers/media/video/usbvideo/usbvideo.c
+++ b/drivers/media/video/usbvideo/usbvideo.c
@@ -41,13 +41,13 @@ module_param(video_nr, int, 0);
41static void usbvideo_Disconnect(struct usb_interface *intf); 41static void usbvideo_Disconnect(struct usb_interface *intf);
42static void usbvideo_CameraRelease(struct uvd *uvd); 42static void usbvideo_CameraRelease(struct uvd *uvd);
43 43
44static int usbvideo_v4l_ioctl(struct inode *inode, struct file *file, 44static long usbvideo_v4l_ioctl(struct file *file,
45 unsigned int cmd, unsigned long arg); 45 unsigned int cmd, unsigned long arg);
46static int usbvideo_v4l_mmap(struct file *file, struct vm_area_struct *vma); 46static int usbvideo_v4l_mmap(struct file *file, struct vm_area_struct *vma);
47static int usbvideo_v4l_open(struct inode *inode, struct file *file); 47static int usbvideo_v4l_open(struct file *file);
48static ssize_t usbvideo_v4l_read(struct file *file, char __user *buf, 48static ssize_t usbvideo_v4l_read(struct file *file, char __user *buf,
49 size_t count, loff_t *ppos); 49 size_t count, loff_t *ppos);
50static int usbvideo_v4l_close(struct inode *inode, struct file *file); 50static int usbvideo_v4l_close(struct file *file);
51 51
52static int usbvideo_StartDataPump(struct uvd *uvd); 52static int usbvideo_StartDataPump(struct uvd *uvd);
53static void usbvideo_StopDataPump(struct uvd *uvd); 53static void usbvideo_StopDataPump(struct uvd *uvd);
@@ -942,17 +942,13 @@ static int usbvideo_find_struct(struct usbvideo *cams)
942 return rv; 942 return rv;
943} 943}
944 944
945static const struct file_operations usbvideo_fops = { 945static const struct v4l2_file_operations usbvideo_fops = {
946 .owner = THIS_MODULE, 946 .owner = THIS_MODULE,
947 .open = usbvideo_v4l_open, 947 .open = usbvideo_v4l_open,
948 .release =usbvideo_v4l_close, 948 .release =usbvideo_v4l_close,
949 .read = usbvideo_v4l_read, 949 .read = usbvideo_v4l_read,
950 .mmap = usbvideo_v4l_mmap, 950 .mmap = usbvideo_v4l_mmap,
951 .ioctl = usbvideo_v4l_ioctl, 951 .ioctl = usbvideo_v4l_ioctl,
952#ifdef CONFIG_COMPAT
953 .compat_ioctl = v4l_compat_ioctl32,
954#endif
955 .llseek = no_llseek,
956}; 952};
957static const struct video_device usbvideo_template = { 953static const struct video_device usbvideo_template = {
958 .fops = &usbvideo_fops, 954 .fops = &usbvideo_fops,
@@ -1113,7 +1109,7 @@ static int usbvideo_v4l_mmap(struct file *file, struct vm_area_struct *vma)
1113 * 27-Jan-2000 Used USBVIDEO_NUMSBUF as number of URB buffers. 1109 * 27-Jan-2000 Used USBVIDEO_NUMSBUF as number of URB buffers.
1114 * 24-May-2000 Corrected to prevent race condition (MOD_xxx_USE_COUNT). 1110 * 24-May-2000 Corrected to prevent race condition (MOD_xxx_USE_COUNT).
1115 */ 1111 */
1116static int usbvideo_v4l_open(struct inode *inode, struct file *file) 1112static int usbvideo_v4l_open(struct file *file)
1117{ 1113{
1118 struct video_device *dev = video_devdata(file); 1114 struct video_device *dev = video_devdata(file);
1119 struct uvd *uvd = (struct uvd *) dev; 1115 struct uvd *uvd = (struct uvd *) dev;
@@ -1233,7 +1229,7 @@ static int usbvideo_v4l_open(struct inode *inode, struct file *file)
1233 * 27-Jan-2000 Used USBVIDEO_NUMSBUF as number of URB buffers. 1229 * 27-Jan-2000 Used USBVIDEO_NUMSBUF as number of URB buffers.
1234 * 24-May-2000 Moved MOD_DEC_USE_COUNT outside of code that can sleep. 1230 * 24-May-2000 Moved MOD_DEC_USE_COUNT outside of code that can sleep.
1235 */ 1231 */
1236static int usbvideo_v4l_close(struct inode *inode, struct file *file) 1232static int usbvideo_v4l_close(struct file *file)
1237{ 1233{
1238 struct video_device *dev = file->private_data; 1234 struct video_device *dev = file->private_data;
1239 struct uvd *uvd = (struct uvd *) dev; 1235 struct uvd *uvd = (struct uvd *) dev;
@@ -1281,7 +1277,7 @@ static int usbvideo_v4l_close(struct inode *inode, struct file *file)
1281 * History: 1277 * History:
1282 * 22-Jan-2000 Corrected VIDIOCSPICT to reject unsupported settings. 1278 * 22-Jan-2000 Corrected VIDIOCSPICT to reject unsupported settings.
1283 */ 1279 */
1284static int usbvideo_v4l_do_ioctl(struct file *file, unsigned int cmd, void *arg) 1280static long usbvideo_v4l_do_ioctl(struct file *file, unsigned int cmd, void *arg)
1285{ 1281{
1286 struct uvd *uvd = file->private_data; 1282 struct uvd *uvd = file->private_data;
1287 1283
@@ -1501,7 +1497,7 @@ static int usbvideo_v4l_do_ioctl(struct file *file, unsigned int cmd, void *arg)
1501 return 0; 1497 return 0;
1502} 1498}
1503 1499
1504static int usbvideo_v4l_ioctl(struct inode *inode, struct file *file, 1500static long usbvideo_v4l_ioctl(struct file *file,
1505 unsigned int cmd, unsigned long arg) 1501 unsigned int cmd, unsigned long arg)
1506{ 1502{
1507 return video_usercopy(file, cmd, arg, usbvideo_v4l_do_ioctl); 1503 return video_usercopy(file, cmd, arg, usbvideo_v4l_do_ioctl);
diff --git a/drivers/media/video/usbvideo/vicam.c b/drivers/media/video/usbvideo/vicam.c
index 4602597ed8d1..2f1106338c08 100644
--- a/drivers/media/video/usbvideo/vicam.c
+++ b/drivers/media/video/usbvideo/vicam.c
@@ -229,12 +229,12 @@ set_camera_power(struct vicam_camera *cam, int state)
229 return 0; 229 return 0;
230} 230}
231 231
232static int 232static long
233vicam_ioctl(struct inode *inode, struct file *file, unsigned int ioctlnr, unsigned long arg) 233vicam_ioctl(struct file *file, unsigned int ioctlnr, unsigned long arg)
234{ 234{
235 void __user *user_arg = (void __user *)arg; 235 void __user *user_arg = (void __user *)arg;
236 struct vicam_camera *cam = file->private_data; 236 struct vicam_camera *cam = file->private_data;
237 int retval = 0; 237 long retval = 0;
238 238
239 if (!cam) 239 if (!cam)
240 return -ENODEV; 240 return -ENODEV;
@@ -470,7 +470,7 @@ vicam_ioctl(struct inode *inode, struct file *file, unsigned int ioctlnr, unsign
470} 470}
471 471
472static int 472static int
473vicam_open(struct inode *inode, struct file *file) 473vicam_open(struct file *file)
474{ 474{
475 struct vicam_camera *cam = video_drvdata(file); 475 struct vicam_camera *cam = video_drvdata(file);
476 476
@@ -536,7 +536,7 @@ vicam_open(struct inode *inode, struct file *file)
536} 536}
537 537
538static int 538static int
539vicam_close(struct inode *inode, struct file *file) 539vicam_close(struct file *file)
540{ 540{
541 struct vicam_camera *cam = file->private_data; 541 struct vicam_camera *cam = file->private_data;
542 int open_count; 542 int open_count;
@@ -783,17 +783,13 @@ vicam_mmap(struct file *file, struct vm_area_struct *vma)
783 return 0; 783 return 0;
784} 784}
785 785
786static const struct file_operations vicam_fops = { 786static const struct v4l2_file_operations vicam_fops = {
787 .owner = THIS_MODULE, 787 .owner = THIS_MODULE,
788 .open = vicam_open, 788 .open = vicam_open,
789 .release = vicam_close, 789 .release = vicam_close,
790 .read = vicam_read, 790 .read = vicam_read,
791 .mmap = vicam_mmap, 791 .mmap = vicam_mmap,
792 .ioctl = vicam_ioctl, 792 .ioctl = vicam_ioctl,
793#ifdef CONFIG_COMPAT
794 .compat_ioctl = v4l_compat_ioctl32,
795#endif
796 .llseek = no_llseek,
797}; 793};
798 794
799static struct video_device vicam_template = { 795static struct video_device vicam_template = {
diff --git a/drivers/media/video/usbvision/usbvision-video.c b/drivers/media/video/usbvision/usbvision-video.c
index 85661b1848fe..2be5e47ed081 100644
--- a/drivers/media/video/usbvision/usbvision-video.c
+++ b/drivers/media/video/usbvision/usbvision-video.c
@@ -355,7 +355,7 @@ static void usbvision_remove_sysfs(struct video_device *vdev)
355 * then allocates buffers needed for video processing. 355 * then allocates buffers needed for video processing.
356 * 356 *
357 */ 357 */
358static int usbvision_v4l2_open(struct inode *inode, struct file *file) 358static int usbvision_v4l2_open(struct file *file)
359{ 359{
360 struct usb_usbvision *usbvision = video_drvdata(file); 360 struct usb_usbvision *usbvision = video_drvdata(file);
361 int errCode = 0; 361 int errCode = 0;
@@ -432,7 +432,7 @@ static int usbvision_v4l2_open(struct inode *inode, struct file *file)
432 * allocated in usbvision_v4l2_open(). 432 * allocated in usbvision_v4l2_open().
433 * 433 *
434 */ 434 */
435static int usbvision_v4l2_close(struct inode *inode, struct file *file) 435static int usbvision_v4l2_close(struct file *file)
436{ 436{
437 struct usb_usbvision *usbvision = video_drvdata(file); 437 struct usb_usbvision *usbvision = video_drvdata(file);
438 438
@@ -477,12 +477,12 @@ static int usbvision_v4l2_close(struct inode *inode, struct file *file)
477 */ 477 */
478#ifdef CONFIG_VIDEO_ADV_DEBUG 478#ifdef CONFIG_VIDEO_ADV_DEBUG
479static int vidioc_g_register (struct file *file, void *priv, 479static int vidioc_g_register (struct file *file, void *priv,
480 struct v4l2_register *reg) 480 struct v4l2_dbg_register *reg)
481{ 481{
482 struct usb_usbvision *usbvision = video_drvdata(file); 482 struct usb_usbvision *usbvision = video_drvdata(file);
483 int errCode; 483 int errCode;
484 484
485 if (!v4l2_chip_match_host(reg->match_type, reg->match_chip)) 485 if (!v4l2_chip_match_host(&reg->match))
486 return -EINVAL; 486 return -EINVAL;
487 /* NT100x has a 8-bit register space */ 487 /* NT100x has a 8-bit register space */
488 errCode = usbvision_read_reg(usbvision, reg->reg&0xff); 488 errCode = usbvision_read_reg(usbvision, reg->reg&0xff);
@@ -492,16 +492,17 @@ static int vidioc_g_register (struct file *file, void *priv,
492 return errCode; 492 return errCode;
493 } 493 }
494 reg->val = errCode; 494 reg->val = errCode;
495 reg->size = 1;
495 return 0; 496 return 0;
496} 497}
497 498
498static int vidioc_s_register (struct file *file, void *priv, 499static int vidioc_s_register (struct file *file, void *priv,
499 struct v4l2_register *reg) 500 struct v4l2_dbg_register *reg)
500{ 501{
501 struct usb_usbvision *usbvision = video_drvdata(file); 502 struct usb_usbvision *usbvision = video_drvdata(file);
502 int errCode; 503 int errCode;
503 504
504 if (!v4l2_chip_match_host(reg->match_type, reg->match_chip)) 505 if (!v4l2_chip_match_host(&reg->match))
505 return -EINVAL; 506 return -EINVAL;
506 /* NT100x has a 8-bit register space */ 507 /* NT100x has a 8-bit register space */
507 errCode = usbvision_write_reg(usbvision, reg->reg&0xff, reg->val); 508 errCode = usbvision_write_reg(usbvision, reg->reg&0xff, reg->val);
@@ -1178,7 +1179,7 @@ static int usbvision_v4l2_mmap(struct file *file, struct vm_area_struct *vma)
1178 * Here comes the stuff for radio on usbvision based devices 1179 * Here comes the stuff for radio on usbvision based devices
1179 * 1180 *
1180 */ 1181 */
1181static int usbvision_radio_open(struct inode *inode, struct file *file) 1182static int usbvision_radio_open(struct file *file)
1182{ 1183{
1183 struct usb_usbvision *usbvision = video_drvdata(file); 1184 struct usb_usbvision *usbvision = video_drvdata(file);
1184 int errCode = 0; 1185 int errCode = 0;
@@ -1228,7 +1229,7 @@ out:
1228} 1229}
1229 1230
1230 1231
1231static int usbvision_radio_close(struct inode *inode, struct file *file) 1232static int usbvision_radio_close(struct file *file)
1232{ 1233{
1233 struct usb_usbvision *usbvision = video_drvdata(file); 1234 struct usb_usbvision *usbvision = video_drvdata(file);
1234 int errCode = 0; 1235 int errCode = 0;
@@ -1266,26 +1267,26 @@ static int usbvision_radio_close(struct inode *inode, struct file *file)
1266 * Here comes the stuff for vbi on usbvision based devices 1267 * Here comes the stuff for vbi on usbvision based devices
1267 * 1268 *
1268 */ 1269 */
1269static int usbvision_vbi_open(struct inode *inode, struct file *file) 1270static int usbvision_vbi_open(struct file *file)
1270{ 1271{
1271 /* TODO */ 1272 /* TODO */
1272 return -ENODEV; 1273 return -ENODEV;
1273} 1274}
1274 1275
1275static int usbvision_vbi_close(struct inode *inode, struct file *file) 1276static int usbvision_vbi_close(struct file *file)
1276{ 1277{
1277 /* TODO */ 1278 /* TODO */
1278 return -ENODEV; 1279 return -ENODEV;
1279} 1280}
1280 1281
1281static int usbvision_do_vbi_ioctl(struct file *file, 1282static long usbvision_do_vbi_ioctl(struct file *file,
1282 unsigned int cmd, void *arg) 1283 unsigned int cmd, void *arg)
1283{ 1284{
1284 /* TODO */ 1285 /* TODO */
1285 return -ENOIOCTLCMD; 1286 return -ENOIOCTLCMD;
1286} 1287}
1287 1288
1288static int usbvision_vbi_ioctl(struct inode *inode, struct file *file, 1289static long usbvision_vbi_ioctl(struct file *file,
1289 unsigned int cmd, unsigned long arg) 1290 unsigned int cmd, unsigned long arg)
1290{ 1291{
1291 return video_usercopy(file, cmd, arg, usbvision_do_vbi_ioctl); 1292 return video_usercopy(file, cmd, arg, usbvision_do_vbi_ioctl);
@@ -1297,16 +1298,14 @@ static int usbvision_vbi_ioctl(struct inode *inode, struct file *file,
1297// 1298//
1298 1299
1299// Video template 1300// Video template
1300static const struct file_operations usbvision_fops = { 1301static const struct v4l2_file_operations usbvision_fops = {
1301 .owner = THIS_MODULE, 1302 .owner = THIS_MODULE,
1302 .open = usbvision_v4l2_open, 1303 .open = usbvision_v4l2_open,
1303 .release = usbvision_v4l2_close, 1304 .release = usbvision_v4l2_close,
1304 .read = usbvision_v4l2_read, 1305 .read = usbvision_v4l2_read,
1305 .mmap = usbvision_v4l2_mmap, 1306 .mmap = usbvision_v4l2_mmap,
1306 .ioctl = video_ioctl2, 1307 .ioctl = video_ioctl2,
1307 .llseek = no_llseek,
1308/* .poll = video_poll, */ 1308/* .poll = video_poll, */
1309 .compat_ioctl = v4l_compat_ioctl32,
1310}; 1309};
1311 1310
1312static const struct v4l2_ioctl_ops usbvision_ioctl_ops = { 1311static const struct v4l2_ioctl_ops usbvision_ioctl_ops = {
@@ -1355,13 +1354,11 @@ static struct video_device usbvision_video_template = {
1355 1354
1356 1355
1357// Radio template 1356// Radio template
1358static const struct file_operations usbvision_radio_fops = { 1357static const struct v4l2_file_operations usbvision_radio_fops = {
1359 .owner = THIS_MODULE, 1358 .owner = THIS_MODULE,
1360 .open = usbvision_radio_open, 1359 .open = usbvision_radio_open,
1361 .release = usbvision_radio_close, 1360 .release = usbvision_radio_close,
1362 .ioctl = video_ioctl2, 1361 .ioctl = video_ioctl2,
1363 .llseek = no_llseek,
1364 .compat_ioctl = v4l_compat_ioctl32,
1365}; 1362};
1366 1363
1367static const struct v4l2_ioctl_ops usbvision_radio_ioctl_ops = { 1364static const struct v4l2_ioctl_ops usbvision_radio_ioctl_ops = {
@@ -1392,13 +1389,11 @@ static struct video_device usbvision_radio_template = {
1392}; 1389};
1393 1390
1394// vbi template 1391// vbi template
1395static const struct file_operations usbvision_vbi_fops = { 1392static const struct v4l2_file_operations usbvision_vbi_fops = {
1396 .owner = THIS_MODULE, 1393 .owner = THIS_MODULE,
1397 .open = usbvision_vbi_open, 1394 .open = usbvision_vbi_open,
1398 .release = usbvision_vbi_close, 1395 .release = usbvision_vbi_close,
1399 .ioctl = usbvision_vbi_ioctl, 1396 .ioctl = usbvision_vbi_ioctl,
1400 .llseek = no_llseek,
1401 .compat_ioctl = v4l_compat_ioctl32,
1402}; 1397};
1403 1398
1404static struct video_device usbvision_vbi_template= 1399static struct video_device usbvision_vbi_template=
diff --git a/drivers/media/video/uvc/uvc_v4l2.c b/drivers/media/video/uvc/uvc_v4l2.c
index afcc6934559e..fa150fff2c10 100644
--- a/drivers/media/video/uvc/uvc_v4l2.c
+++ b/drivers/media/video/uvc/uvc_v4l2.c
@@ -406,7 +406,7 @@ static int uvc_has_privileges(struct uvc_fh *handle)
406 * V4L2 file operations 406 * V4L2 file operations
407 */ 407 */
408 408
409static int uvc_v4l2_open(struct inode *inode, struct file *file) 409static int uvc_v4l2_open(struct file *file)
410{ 410{
411 struct uvc_video_device *video; 411 struct uvc_video_device *video;
412 struct uvc_fh *handle; 412 struct uvc_fh *handle;
@@ -444,7 +444,7 @@ done:
444 return ret; 444 return ret;
445} 445}
446 446
447static int uvc_v4l2_release(struct inode *inode, struct file *file) 447static int uvc_v4l2_release(struct file *file)
448{ 448{
449 struct uvc_video_device *video = video_drvdata(file); 449 struct uvc_video_device *video = video_drvdata(file);
450 struct uvc_fh *handle = (struct uvc_fh *)file->private_data; 450 struct uvc_fh *handle = (struct uvc_fh *)file->private_data;
@@ -472,12 +472,12 @@ static int uvc_v4l2_release(struct inode *inode, struct file *file)
472 return 0; 472 return 0;
473} 473}
474 474
475static int uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg) 475static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
476{ 476{
477 struct video_device *vdev = video_devdata(file); 477 struct video_device *vdev = video_devdata(file);
478 struct uvc_video_device *video = video_get_drvdata(vdev); 478 struct uvc_video_device *video = video_get_drvdata(vdev);
479 struct uvc_fh *handle = (struct uvc_fh *)file->private_data; 479 struct uvc_fh *handle = (struct uvc_fh *)file->private_data;
480 int ret = 0; 480 long ret = 0;
481 481
482 switch (cmd) { 482 switch (cmd) {
483 /* Query capabilities */ 483 /* Query capabilities */
@@ -996,7 +996,7 @@ static int uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
996 return ret; 996 return ret;
997} 997}
998 998
999static int uvc_v4l2_ioctl(struct inode *inode, struct file *file, 999static long uvc_v4l2_ioctl(struct file *file,
1000 unsigned int cmd, unsigned long arg) 1000 unsigned int cmd, unsigned long arg)
1001{ 1001{
1002 if (uvc_trace_param & UVC_TRACE_IOCTL) { 1002 if (uvc_trace_param & UVC_TRACE_IOCTL) {
@@ -1097,13 +1097,11 @@ static unsigned int uvc_v4l2_poll(struct file *file, poll_table *wait)
1097 return uvc_queue_poll(&video->queue, file, wait); 1097 return uvc_queue_poll(&video->queue, file, wait);
1098} 1098}
1099 1099
1100struct file_operations uvc_fops = { 1100const struct v4l2_file_operations uvc_fops = {
1101 .owner = THIS_MODULE, 1101 .owner = THIS_MODULE,
1102 .open = uvc_v4l2_open, 1102 .open = uvc_v4l2_open,
1103 .release = uvc_v4l2_release, 1103 .release = uvc_v4l2_release,
1104 .ioctl = uvc_v4l2_ioctl, 1104 .ioctl = uvc_v4l2_ioctl,
1105 .compat_ioctl = v4l_compat_ioctl32,
1106 .llseek = no_llseek,
1107 .read = uvc_v4l2_read, 1105 .read = uvc_v4l2_read,
1108 .mmap = uvc_v4l2_mmap, 1106 .mmap = uvc_v4l2_mmap,
1109 .poll = uvc_v4l2_poll, 1107 .poll = uvc_v4l2_poll,
diff --git a/drivers/media/video/uvc/uvcvideo.h b/drivers/media/video/uvc/uvcvideo.h
index 896b791ece15..bcf4361dc1bc 100644
--- a/drivers/media/video/uvc/uvcvideo.h
+++ b/drivers/media/video/uvc/uvcvideo.h
@@ -753,7 +753,7 @@ static inline int uvc_queue_streaming(struct uvc_video_queue *queue)
753} 753}
754 754
755/* V4L2 interface */ 755/* V4L2 interface */
756extern struct file_operations uvc_fops; 756extern const struct v4l2_file_operations uvc_fops;
757 757
758/* Video */ 758/* Video */
759extern int uvc_video_init(struct uvc_video_device *video); 759extern int uvc_video_init(struct uvc_video_device *video);
diff --git a/drivers/media/video/v4l1-compat.c b/drivers/media/video/v4l1-compat.c
index f13c0a9d684f..d450cab20be4 100644
--- a/drivers/media/video/v4l1-compat.c
+++ b/drivers/media/video/v4l1-compat.c
@@ -267,12 +267,12 @@ done:
267 267
268/* ----------------------------------------------------------------- */ 268/* ----------------------------------------------------------------- */
269 269
270static noinline int v4l1_compat_get_capabilities( 270static noinline long v4l1_compat_get_capabilities(
271 struct video_capability *cap, 271 struct video_capability *cap,
272 struct file *file, 272 struct file *file,
273 v4l2_kioctl drv) 273 v4l2_kioctl drv)
274{ 274{
275 int err; 275 long err;
276 struct v4l2_framebuffer fbuf; 276 struct v4l2_framebuffer fbuf;
277 struct v4l2_capability *cap2; 277 struct v4l2_capability *cap2;
278 278
@@ -286,13 +286,13 @@ static noinline int v4l1_compat_get_capabilities(
286 286
287 err = drv(file, VIDIOC_QUERYCAP, cap2); 287 err = drv(file, VIDIOC_QUERYCAP, cap2);
288 if (err < 0) { 288 if (err < 0) {
289 dprintk("VIDIOCGCAP / VIDIOC_QUERYCAP: %d\n", err); 289 dprintk("VIDIOCGCAP / VIDIOC_QUERYCAP: %ld\n", err);
290 goto done; 290 goto done;
291 } 291 }
292 if (cap2->capabilities & V4L2_CAP_VIDEO_OVERLAY) { 292 if (cap2->capabilities & V4L2_CAP_VIDEO_OVERLAY) {
293 err = drv(file, VIDIOC_G_FBUF, &fbuf); 293 err = drv(file, VIDIOC_G_FBUF, &fbuf);
294 if (err < 0) { 294 if (err < 0) {
295 dprintk("VIDIOCGCAP / VIDIOC_G_FBUF: %d\n", err); 295 dprintk("VIDIOCGCAP / VIDIOC_G_FBUF: %ld\n", err);
296 memset(&fbuf, 0, sizeof(fbuf)); 296 memset(&fbuf, 0, sizeof(fbuf));
297 } 297 }
298 err = 0; 298 err = 0;
@@ -324,12 +324,12 @@ done:
324 return err; 324 return err;
325} 325}
326 326
327static noinline int v4l1_compat_get_frame_buffer( 327static noinline long v4l1_compat_get_frame_buffer(
328 struct video_buffer *buffer, 328 struct video_buffer *buffer,
329 struct file *file, 329 struct file *file,
330 v4l2_kioctl drv) 330 v4l2_kioctl drv)
331{ 331{
332 int err; 332 long err;
333 struct v4l2_framebuffer fbuf; 333 struct v4l2_framebuffer fbuf;
334 334
335 memset(buffer, 0, sizeof(*buffer)); 335 memset(buffer, 0, sizeof(*buffer));
@@ -337,7 +337,7 @@ static noinline int v4l1_compat_get_frame_buffer(
337 337
338 err = drv(file, VIDIOC_G_FBUF, &fbuf); 338 err = drv(file, VIDIOC_G_FBUF, &fbuf);
339 if (err < 0) { 339 if (err < 0) {
340 dprintk("VIDIOCGFBUF / VIDIOC_G_FBUF: %d\n", err); 340 dprintk("VIDIOCGFBUF / VIDIOC_G_FBUF: %ld\n", err);
341 goto done; 341 goto done;
342 } 342 }
343 buffer->base = fbuf.base; 343 buffer->base = fbuf.base;
@@ -378,12 +378,12 @@ done:
378 return err; 378 return err;
379} 379}
380 380
381static noinline int v4l1_compat_set_frame_buffer( 381static noinline long v4l1_compat_set_frame_buffer(
382 struct video_buffer *buffer, 382 struct video_buffer *buffer,
383 struct file *file, 383 struct file *file,
384 v4l2_kioctl drv) 384 v4l2_kioctl drv)
385{ 385{
386 int err; 386 long err;
387 struct v4l2_framebuffer fbuf; 387 struct v4l2_framebuffer fbuf;
388 388
389 memset(&fbuf, 0, sizeof(fbuf)); 389 memset(&fbuf, 0, sizeof(fbuf));
@@ -410,16 +410,16 @@ static noinline int v4l1_compat_set_frame_buffer(
410 fbuf.fmt.bytesperline = buffer->bytesperline; 410 fbuf.fmt.bytesperline = buffer->bytesperline;
411 err = drv(file, VIDIOC_S_FBUF, &fbuf); 411 err = drv(file, VIDIOC_S_FBUF, &fbuf);
412 if (err < 0) 412 if (err < 0)
413 dprintk("VIDIOCSFBUF / VIDIOC_S_FBUF: %d\n", err); 413 dprintk("VIDIOCSFBUF / VIDIOC_S_FBUF: %ld\n", err);
414 return err; 414 return err;
415} 415}
416 416
417static noinline int v4l1_compat_get_win_cap_dimensions( 417static noinline long v4l1_compat_get_win_cap_dimensions(
418 struct video_window *win, 418 struct video_window *win,
419 struct file *file, 419 struct file *file,
420 v4l2_kioctl drv) 420 v4l2_kioctl drv)
421{ 421{
422 int err; 422 long err;
423 struct v4l2_format *fmt; 423 struct v4l2_format *fmt;
424 424
425 fmt = kzalloc(sizeof(*fmt), GFP_KERNEL); 425 fmt = kzalloc(sizeof(*fmt), GFP_KERNEL);
@@ -432,7 +432,7 @@ static noinline int v4l1_compat_get_win_cap_dimensions(
432 fmt->type = V4L2_BUF_TYPE_VIDEO_OVERLAY; 432 fmt->type = V4L2_BUF_TYPE_VIDEO_OVERLAY;
433 err = drv(file, VIDIOC_G_FMT, fmt); 433 err = drv(file, VIDIOC_G_FMT, fmt);
434 if (err < 0) 434 if (err < 0)
435 dprintk("VIDIOCGWIN / VIDIOC_G_WIN: %d\n", err); 435 dprintk("VIDIOCGWIN / VIDIOC_G_WIN: %ld\n", err);
436 if (err == 0) { 436 if (err == 0) {
437 win->x = fmt->fmt.win.w.left; 437 win->x = fmt->fmt.win.w.left;
438 win->y = fmt->fmt.win.w.top; 438 win->y = fmt->fmt.win.w.top;
@@ -447,7 +447,7 @@ static noinline int v4l1_compat_get_win_cap_dimensions(
447 fmt->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 447 fmt->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
448 err = drv(file, VIDIOC_G_FMT, fmt); 448 err = drv(file, VIDIOC_G_FMT, fmt);
449 if (err < 0) { 449 if (err < 0) {
450 dprintk("VIDIOCGWIN / VIDIOC_G_FMT: %d\n", err); 450 dprintk("VIDIOCGWIN / VIDIOC_G_FMT: %ld\n", err);
451 goto done; 451 goto done;
452 } 452 }
453 win->x = 0; 453 win->x = 0;
@@ -462,12 +462,12 @@ done:
462 return err; 462 return err;
463} 463}
464 464
465static noinline int v4l1_compat_set_win_cap_dimensions( 465static noinline long v4l1_compat_set_win_cap_dimensions(
466 struct video_window *win, 466 struct video_window *win,
467 struct file *file, 467 struct file *file,
468 v4l2_kioctl drv) 468 v4l2_kioctl drv)
469{ 469{
470 int err, err1, err2; 470 long err, err1, err2;
471 struct v4l2_format *fmt; 471 struct v4l2_format *fmt;
472 472
473 fmt = kzalloc(sizeof(*fmt), GFP_KERNEL); 473 fmt = kzalloc(sizeof(*fmt), GFP_KERNEL);
@@ -479,7 +479,7 @@ static noinline int v4l1_compat_set_win_cap_dimensions(
479 drv(file, VIDIOC_STREAMOFF, &fmt->type); 479 drv(file, VIDIOC_STREAMOFF, &fmt->type);
480 err1 = drv(file, VIDIOC_G_FMT, fmt); 480 err1 = drv(file, VIDIOC_G_FMT, fmt);
481 if (err1 < 0) 481 if (err1 < 0)
482 dprintk("VIDIOCSWIN / VIDIOC_G_FMT: %d\n", err1); 482 dprintk("VIDIOCSWIN / VIDIOC_G_FMT: %ld\n", err1);
483 if (err1 == 0) { 483 if (err1 == 0) {
484 fmt->fmt.pix.width = win->width; 484 fmt->fmt.pix.width = win->width;
485 fmt->fmt.pix.height = win->height; 485 fmt->fmt.pix.height = win->height;
@@ -487,7 +487,7 @@ static noinline int v4l1_compat_set_win_cap_dimensions(
487 fmt->fmt.pix.bytesperline = 0; 487 fmt->fmt.pix.bytesperline = 0;
488 err = drv(file, VIDIOC_S_FMT, fmt); 488 err = drv(file, VIDIOC_S_FMT, fmt);
489 if (err < 0) 489 if (err < 0)
490 dprintk("VIDIOCSWIN / VIDIOC_S_FMT #1: %d\n", 490 dprintk("VIDIOCSWIN / VIDIOC_S_FMT #1: %ld\n",
491 err); 491 err);
492 win->width = fmt->fmt.pix.width; 492 win->width = fmt->fmt.pix.width;
493 win->height = fmt->fmt.pix.height; 493 win->height = fmt->fmt.pix.height;
@@ -504,7 +504,7 @@ static noinline int v4l1_compat_set_win_cap_dimensions(
504 fmt->fmt.win.clipcount = win->clipcount; 504 fmt->fmt.win.clipcount = win->clipcount;
505 err2 = drv(file, VIDIOC_S_FMT, fmt); 505 err2 = drv(file, VIDIOC_S_FMT, fmt);
506 if (err2 < 0) 506 if (err2 < 0)
507 dprintk("VIDIOCSWIN / VIDIOC_S_FMT #2: %d\n", err2); 507 dprintk("VIDIOCSWIN / VIDIOC_S_FMT #2: %ld\n", err2);
508 508
509 if (err1 != 0 && err2 != 0) 509 if (err1 != 0 && err2 != 0)
510 err = err1; 510 err = err1;
@@ -514,12 +514,12 @@ static noinline int v4l1_compat_set_win_cap_dimensions(
514 return err; 514 return err;
515} 515}
516 516
517static noinline int v4l1_compat_turn_preview_on_off( 517static noinline long v4l1_compat_turn_preview_on_off(
518 int *on, 518 int *on,
519 struct file *file, 519 struct file *file,
520 v4l2_kioctl drv) 520 v4l2_kioctl drv)
521{ 521{
522 int err; 522 long err;
523 enum v4l2_buf_type captype = V4L2_BUF_TYPE_VIDEO_CAPTURE; 523 enum v4l2_buf_type captype = V4L2_BUF_TYPE_VIDEO_CAPTURE;
524 524
525 if (0 == *on) { 525 if (0 == *on) {
@@ -530,16 +530,16 @@ static noinline int v4l1_compat_turn_preview_on_off(
530 } 530 }
531 err = drv(file, VIDIOC_OVERLAY, on); 531 err = drv(file, VIDIOC_OVERLAY, on);
532 if (err < 0) 532 if (err < 0)
533 dprintk("VIDIOCCAPTURE / VIDIOC_PREVIEW: %d\n", err); 533 dprintk("VIDIOCCAPTURE / VIDIOC_PREVIEW: %ld\n", err);
534 return err; 534 return err;
535} 535}
536 536
537static noinline int v4l1_compat_get_input_info( 537static noinline long v4l1_compat_get_input_info(
538 struct video_channel *chan, 538 struct video_channel *chan,
539 struct file *file, 539 struct file *file,
540 v4l2_kioctl drv) 540 v4l2_kioctl drv)
541{ 541{
542 int err; 542 long err;
543 struct v4l2_input input2; 543 struct v4l2_input input2;
544 v4l2_std_id sid; 544 v4l2_std_id sid;
545 545
@@ -548,7 +548,7 @@ static noinline int v4l1_compat_get_input_info(
548 err = drv(file, VIDIOC_ENUMINPUT, &input2); 548 err = drv(file, VIDIOC_ENUMINPUT, &input2);
549 if (err < 0) { 549 if (err < 0) {
550 dprintk("VIDIOCGCHAN / VIDIOC_ENUMINPUT: " 550 dprintk("VIDIOCGCHAN / VIDIOC_ENUMINPUT: "
551 "channel=%d err=%d\n", chan->channel, err); 551 "channel=%d err=%ld\n", chan->channel, err);
552 goto done; 552 goto done;
553 } 553 }
554 chan->channel = input2.index; 554 chan->channel = input2.index;
@@ -569,7 +569,7 @@ static noinline int v4l1_compat_get_input_info(
569 chan->norm = 0; 569 chan->norm = 0;
570 err = drv(file, VIDIOC_G_STD, &sid); 570 err = drv(file, VIDIOC_G_STD, &sid);
571 if (err < 0) 571 if (err < 0)
572 dprintk("VIDIOCGCHAN / VIDIOC_G_STD: %d\n", err); 572 dprintk("VIDIOCGCHAN / VIDIOC_G_STD: %ld\n", err);
573 if (err == 0) { 573 if (err == 0) {
574 if (sid & V4L2_STD_PAL) 574 if (sid & V4L2_STD_PAL)
575 chan->norm = VIDEO_MODE_PAL; 575 chan->norm = VIDEO_MODE_PAL;
@@ -582,17 +582,17 @@ done:
582 return err; 582 return err;
583} 583}
584 584
585static noinline int v4l1_compat_set_input( 585static noinline long v4l1_compat_set_input(
586 struct video_channel *chan, 586 struct video_channel *chan,
587 struct file *file, 587 struct file *file,
588 v4l2_kioctl drv) 588 v4l2_kioctl drv)
589{ 589{
590 int err; 590 long err;
591 v4l2_std_id sid = 0; 591 v4l2_std_id sid = 0;
592 592
593 err = drv(file, VIDIOC_S_INPUT, &chan->channel); 593 err = drv(file, VIDIOC_S_INPUT, &chan->channel);
594 if (err < 0) 594 if (err < 0)
595 dprintk("VIDIOCSCHAN / VIDIOC_S_INPUT: %d\n", err); 595 dprintk("VIDIOCSCHAN / VIDIOC_S_INPUT: %ld\n", err);
596 switch (chan->norm) { 596 switch (chan->norm) {
597 case VIDEO_MODE_PAL: 597 case VIDEO_MODE_PAL:
598 sid = V4L2_STD_PAL; 598 sid = V4L2_STD_PAL;
@@ -607,17 +607,17 @@ static noinline int v4l1_compat_set_input(
607 if (0 != sid) { 607 if (0 != sid) {
608 err = drv(file, VIDIOC_S_STD, &sid); 608 err = drv(file, VIDIOC_S_STD, &sid);
609 if (err < 0) 609 if (err < 0)
610 dprintk("VIDIOCSCHAN / VIDIOC_S_STD: %d\n", err); 610 dprintk("VIDIOCSCHAN / VIDIOC_S_STD: %ld\n", err);
611 } 611 }
612 return err; 612 return err;
613} 613}
614 614
615static noinline int v4l1_compat_get_picture( 615static noinline long v4l1_compat_get_picture(
616 struct video_picture *pict, 616 struct video_picture *pict,
617 struct file *file, 617 struct file *file,
618 v4l2_kioctl drv) 618 v4l2_kioctl drv)
619{ 619{
620 int err; 620 long err;
621 struct v4l2_format *fmt; 621 struct v4l2_format *fmt;
622 622
623 fmt = kzalloc(sizeof(*fmt), GFP_KERNEL); 623 fmt = kzalloc(sizeof(*fmt), GFP_KERNEL);
@@ -640,7 +640,7 @@ static noinline int v4l1_compat_get_picture(
640 fmt->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 640 fmt->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
641 err = drv(file, VIDIOC_G_FMT, fmt); 641 err = drv(file, VIDIOC_G_FMT, fmt);
642 if (err < 0) { 642 if (err < 0) {
643 dprintk("VIDIOCGPICT / VIDIOC_G_FMT: %d\n", err); 643 dprintk("VIDIOCGPICT / VIDIOC_G_FMT: %ld\n", err);
644 goto done; 644 goto done;
645 } 645 }
646 646
@@ -654,12 +654,12 @@ done:
654 return err; 654 return err;
655} 655}
656 656
657static noinline int v4l1_compat_set_picture( 657static noinline long v4l1_compat_set_picture(
658 struct video_picture *pict, 658 struct video_picture *pict,
659 struct file *file, 659 struct file *file,
660 v4l2_kioctl drv) 660 v4l2_kioctl drv)
661{ 661{
662 int err; 662 long err;
663 struct v4l2_framebuffer fbuf; 663 struct v4l2_framebuffer fbuf;
664 int mem_err = 0, ovl_err = 0; 664 int mem_err = 0, ovl_err = 0;
665 struct v4l2_format *fmt; 665 struct v4l2_format *fmt;
@@ -694,7 +694,7 @@ static noinline int v4l1_compat_set_picture(
694 support memory capture. Trying to set the memory capture 694 support memory capture. Trying to set the memory capture
695 parameters would be pointless. */ 695 parameters would be pointless. */
696 if (err < 0) { 696 if (err < 0) {
697 dprintk("VIDIOCSPICT / VIDIOC_G_FMT: %d\n", err); 697 dprintk("VIDIOCSPICT / VIDIOC_G_FMT: %ld\n", err);
698 mem_err = -1000; /* didn't even try */ 698 mem_err = -1000; /* didn't even try */
699 } else if (fmt->fmt.pix.pixelformat != 699 } else if (fmt->fmt.pix.pixelformat !=
700 palette_to_pixelformat(pict->palette)) { 700 palette_to_pixelformat(pict->palette)) {
@@ -711,7 +711,7 @@ static noinline int v4l1_compat_set_picture(
711 support overlay. Trying to set the overlay parameters 711 support overlay. Trying to set the overlay parameters
712 would be quite pointless. */ 712 would be quite pointless. */
713 if (err < 0) { 713 if (err < 0) {
714 dprintk("VIDIOCSPICT / VIDIOC_G_FBUF: %d\n", err); 714 dprintk("VIDIOCSPICT / VIDIOC_G_FBUF: %ld\n", err);
715 ovl_err = -1000; /* didn't even try */ 715 ovl_err = -1000; /* didn't even try */
716 } else if (fbuf.fmt.pixelformat != 716 } else if (fbuf.fmt.pixelformat !=
717 palette_to_pixelformat(pict->palette)) { 717 palette_to_pixelformat(pict->palette)) {
@@ -736,12 +736,13 @@ static noinline int v4l1_compat_set_picture(
736 return err; 736 return err;
737} 737}
738 738
739static noinline int v4l1_compat_get_tuner( 739static noinline long v4l1_compat_get_tuner(
740 struct video_tuner *tun, 740 struct video_tuner *tun,
741 struct file *file, 741 struct file *file,
742 v4l2_kioctl drv) 742 v4l2_kioctl drv)
743{ 743{
744 int err, i; 744 long err;
745 int i;
745 struct v4l2_tuner tun2; 746 struct v4l2_tuner tun2;
746 struct v4l2_standard std2; 747 struct v4l2_standard std2;
747 v4l2_std_id sid; 748 v4l2_std_id sid;
@@ -749,7 +750,7 @@ static noinline int v4l1_compat_get_tuner(
749 memset(&tun2, 0, sizeof(tun2)); 750 memset(&tun2, 0, sizeof(tun2));
750 err = drv(file, VIDIOC_G_TUNER, &tun2); 751 err = drv(file, VIDIOC_G_TUNER, &tun2);
751 if (err < 0) { 752 if (err < 0) {
752 dprintk("VIDIOCGTUNER / VIDIOC_G_TUNER: %d\n", err); 753 dprintk("VIDIOCGTUNER / VIDIOC_G_TUNER: %ld\n", err);
753 goto done; 754 goto done;
754 } 755 }
755 memcpy(tun->name, tun2.name, 756 memcpy(tun->name, tun2.name,
@@ -775,7 +776,7 @@ static noinline int v4l1_compat_get_tuner(
775 776
776 err = drv(file, VIDIOC_G_STD, &sid); 777 err = drv(file, VIDIOC_G_STD, &sid);
777 if (err < 0) 778 if (err < 0)
778 dprintk("VIDIOCGTUNER / VIDIOC_G_STD: %d\n", err); 779 dprintk("VIDIOCGTUNER / VIDIOC_G_STD: %ld\n", err);
779 if (err == 0) { 780 if (err == 0) {
780 if (sid & V4L2_STD_PAL) 781 if (sid & V4L2_STD_PAL)
781 tun->mode = VIDEO_MODE_PAL; 782 tun->mode = VIDEO_MODE_PAL;
@@ -794,12 +795,12 @@ done:
794 return err; 795 return err;
795} 796}
796 797
797static noinline int v4l1_compat_select_tuner( 798static noinline long v4l1_compat_select_tuner(
798 struct video_tuner *tun, 799 struct video_tuner *tun,
799 struct file *file, 800 struct file *file,
800 v4l2_kioctl drv) 801 v4l2_kioctl drv)
801{ 802{
802 int err; 803 long err;
803 struct v4l2_tuner t;/*84 bytes on x86_64*/ 804 struct v4l2_tuner t;/*84 bytes on x86_64*/
804 memset(&t, 0, sizeof(t)); 805 memset(&t, 0, sizeof(t));
805 806
@@ -807,34 +808,34 @@ static noinline int v4l1_compat_select_tuner(
807 808
808 err = drv(file, VIDIOC_S_INPUT, &t); 809 err = drv(file, VIDIOC_S_INPUT, &t);
809 if (err < 0) 810 if (err < 0)
810 dprintk("VIDIOCSTUNER / VIDIOC_S_INPUT: %d\n", err); 811 dprintk("VIDIOCSTUNER / VIDIOC_S_INPUT: %ld\n", err);
811 return err; 812 return err;
812} 813}
813 814
814static noinline int v4l1_compat_get_frequency( 815static noinline long v4l1_compat_get_frequency(
815 unsigned long *freq, 816 unsigned long *freq,
816 struct file *file, 817 struct file *file,
817 v4l2_kioctl drv) 818 v4l2_kioctl drv)
818{ 819{
819 int err; 820 long err;
820 struct v4l2_frequency freq2; 821 struct v4l2_frequency freq2;
821 memset(&freq2, 0, sizeof(freq2)); 822 memset(&freq2, 0, sizeof(freq2));
822 823
823 freq2.tuner = 0; 824 freq2.tuner = 0;
824 err = drv(file, VIDIOC_G_FREQUENCY, &freq2); 825 err = drv(file, VIDIOC_G_FREQUENCY, &freq2);
825 if (err < 0) 826 if (err < 0)
826 dprintk("VIDIOCGFREQ / VIDIOC_G_FREQUENCY: %d\n", err); 827 dprintk("VIDIOCGFREQ / VIDIOC_G_FREQUENCY: %ld\n", err);
827 if (0 == err) 828 if (0 == err)
828 *freq = freq2.frequency; 829 *freq = freq2.frequency;
829 return err; 830 return err;
830} 831}
831 832
832static noinline int v4l1_compat_set_frequency( 833static noinline long v4l1_compat_set_frequency(
833 unsigned long *freq, 834 unsigned long *freq,
834 struct file *file, 835 struct file *file,
835 v4l2_kioctl drv) 836 v4l2_kioctl drv)
836{ 837{
837 int err; 838 long err;
838 struct v4l2_frequency freq2; 839 struct v4l2_frequency freq2;
839 memset(&freq2, 0, sizeof(freq2)); 840 memset(&freq2, 0, sizeof(freq2));
840 841
@@ -842,16 +843,17 @@ static noinline int v4l1_compat_set_frequency(
842 freq2.frequency = *freq; 843 freq2.frequency = *freq;
843 err = drv(file, VIDIOC_S_FREQUENCY, &freq2); 844 err = drv(file, VIDIOC_S_FREQUENCY, &freq2);
844 if (err < 0) 845 if (err < 0)
845 dprintk("VIDIOCSFREQ / VIDIOC_S_FREQUENCY: %d\n", err); 846 dprintk("VIDIOCSFREQ / VIDIOC_S_FREQUENCY: %ld\n", err);
846 return err; 847 return err;
847} 848}
848 849
849static noinline int v4l1_compat_get_audio( 850static noinline long v4l1_compat_get_audio(
850 struct video_audio *aud, 851 struct video_audio *aud,
851 struct file *file, 852 struct file *file,
852 v4l2_kioctl drv) 853 v4l2_kioctl drv)
853{ 854{
854 int err, i; 855 long err;
856 int i;
855 struct v4l2_queryctrl qctrl2; 857 struct v4l2_queryctrl qctrl2;
856 struct v4l2_audio aud2; 858 struct v4l2_audio aud2;
857 struct v4l2_tuner tun2; 859 struct v4l2_tuner tun2;
@@ -859,7 +861,7 @@ static noinline int v4l1_compat_get_audio(
859 861
860 err = drv(file, VIDIOC_G_AUDIO, &aud2); 862 err = drv(file, VIDIOC_G_AUDIO, &aud2);
861 if (err < 0) { 863 if (err < 0) {
862 dprintk("VIDIOCGAUDIO / VIDIOC_G_AUDIO: %d\n", err); 864 dprintk("VIDIOCGAUDIO / VIDIOC_G_AUDIO: %ld\n", err);
863 goto done; 865 goto done;
864 } 866 }
865 memcpy(aud->name, aud2.name, 867 memcpy(aud->name, aud2.name,
@@ -903,7 +905,7 @@ static noinline int v4l1_compat_get_audio(
903 memset(&tun2, 0, sizeof(tun2)); 905 memset(&tun2, 0, sizeof(tun2));
904 err = drv(file, VIDIOC_G_TUNER, &tun2); 906 err = drv(file, VIDIOC_G_TUNER, &tun2);
905 if (err < 0) { 907 if (err < 0) {
906 dprintk("VIDIOCGAUDIO / VIDIOC_G_TUNER: %d\n", err); 908 dprintk("VIDIOCGAUDIO / VIDIOC_G_TUNER: %ld\n", err);
907 err = 0; 909 err = 0;
908 goto done; 910 goto done;
909 } 911 }
@@ -918,12 +920,12 @@ done:
918 return err; 920 return err;
919} 921}
920 922
921static noinline int v4l1_compat_set_audio( 923static noinline long v4l1_compat_set_audio(
922 struct video_audio *aud, 924 struct video_audio *aud,
923 struct file *file, 925 struct file *file,
924 v4l2_kioctl drv) 926 v4l2_kioctl drv)
925{ 927{
926 int err; 928 long err;
927 struct v4l2_audio aud2; 929 struct v4l2_audio aud2;
928 struct v4l2_tuner tun2; 930 struct v4l2_tuner tun2;
929 931
@@ -933,7 +935,7 @@ static noinline int v4l1_compat_set_audio(
933 aud2.index = aud->audio; 935 aud2.index = aud->audio;
934 err = drv(file, VIDIOC_S_AUDIO, &aud2); 936 err = drv(file, VIDIOC_S_AUDIO, &aud2);
935 if (err < 0) { 937 if (err < 0) {
936 dprintk("VIDIOCSAUDIO / VIDIOC_S_AUDIO: %d\n", err); 938 dprintk("VIDIOCSAUDIO / VIDIOC_S_AUDIO: %ld\n", err);
937 goto done; 939 goto done;
938 } 940 }
939 941
@@ -950,7 +952,7 @@ static noinline int v4l1_compat_set_audio(
950 952
951 err = drv(file, VIDIOC_G_TUNER, &tun2); 953 err = drv(file, VIDIOC_G_TUNER, &tun2);
952 if (err < 0) 954 if (err < 0)
953 dprintk("VIDIOCSAUDIO / VIDIOC_G_TUNER: %d\n", err); 955 dprintk("VIDIOCSAUDIO / VIDIOC_G_TUNER: %ld\n", err);
954 if (err == 0) { 956 if (err == 0) {
955 switch (aud->mode) { 957 switch (aud->mode) {
956 default: 958 default:
@@ -967,19 +969,19 @@ static noinline int v4l1_compat_set_audio(
967 } 969 }
968 err = drv(file, VIDIOC_S_TUNER, &tun2); 970 err = drv(file, VIDIOC_S_TUNER, &tun2);
969 if (err < 0) 971 if (err < 0)
970 dprintk("VIDIOCSAUDIO / VIDIOC_S_TUNER: %d\n", err); 972 dprintk("VIDIOCSAUDIO / VIDIOC_S_TUNER: %ld\n", err);
971 } 973 }
972 err = 0; 974 err = 0;
973done: 975done:
974 return err; 976 return err;
975} 977}
976 978
977static noinline int v4l1_compat_capture_frame( 979static noinline long v4l1_compat_capture_frame(
978 struct video_mmap *mm, 980 struct video_mmap *mm,
979 struct file *file, 981 struct file *file,
980 v4l2_kioctl drv) 982 v4l2_kioctl drv)
981{ 983{
982 int err; 984 long err;
983 enum v4l2_buf_type captype = V4L2_BUF_TYPE_VIDEO_CAPTURE; 985 enum v4l2_buf_type captype = V4L2_BUF_TYPE_VIDEO_CAPTURE;
984 struct v4l2_buffer buf; 986 struct v4l2_buffer buf;
985 struct v4l2_format *fmt; 987 struct v4l2_format *fmt;
@@ -994,7 +996,7 @@ static noinline int v4l1_compat_capture_frame(
994 fmt->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 996 fmt->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
995 err = drv(file, VIDIOC_G_FMT, fmt); 997 err = drv(file, VIDIOC_G_FMT, fmt);
996 if (err < 0) { 998 if (err < 0) {
997 dprintk("VIDIOCMCAPTURE / VIDIOC_G_FMT: %d\n", err); 999 dprintk("VIDIOCMCAPTURE / VIDIOC_G_FMT: %ld\n", err);
998 goto done; 1000 goto done;
999 } 1001 }
1000 if (mm->width != fmt->fmt.pix.width || 1002 if (mm->width != fmt->fmt.pix.width ||
@@ -1010,7 +1012,7 @@ static noinline int v4l1_compat_capture_frame(
1010 fmt->fmt.pix.bytesperline = 0; 1012 fmt->fmt.pix.bytesperline = 0;
1011 err = drv(file, VIDIOC_S_FMT, fmt); 1013 err = drv(file, VIDIOC_S_FMT, fmt);
1012 if (err < 0) { 1014 if (err < 0) {
1013 dprintk("VIDIOCMCAPTURE / VIDIOC_S_FMT: %d\n", err); 1015 dprintk("VIDIOCMCAPTURE / VIDIOC_S_FMT: %ld\n", err);
1014 goto done; 1016 goto done;
1015 } 1017 }
1016 } 1018 }
@@ -1018,28 +1020,28 @@ static noinline int v4l1_compat_capture_frame(
1018 buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 1020 buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
1019 err = drv(file, VIDIOC_QUERYBUF, &buf); 1021 err = drv(file, VIDIOC_QUERYBUF, &buf);
1020 if (err < 0) { 1022 if (err < 0) {
1021 dprintk("VIDIOCMCAPTURE / VIDIOC_QUERYBUF: %d\n", err); 1023 dprintk("VIDIOCMCAPTURE / VIDIOC_QUERYBUF: %ld\n", err);
1022 goto done; 1024 goto done;
1023 } 1025 }
1024 err = drv(file, VIDIOC_QBUF, &buf); 1026 err = drv(file, VIDIOC_QBUF, &buf);
1025 if (err < 0) { 1027 if (err < 0) {
1026 dprintk("VIDIOCMCAPTURE / VIDIOC_QBUF: %d\n", err); 1028 dprintk("VIDIOCMCAPTURE / VIDIOC_QBUF: %ld\n", err);
1027 goto done; 1029 goto done;
1028 } 1030 }
1029 err = drv(file, VIDIOC_STREAMON, &captype); 1031 err = drv(file, VIDIOC_STREAMON, &captype);
1030 if (err < 0) 1032 if (err < 0)
1031 dprintk("VIDIOCMCAPTURE / VIDIOC_STREAMON: %d\n", err); 1033 dprintk("VIDIOCMCAPTURE / VIDIOC_STREAMON: %ld\n", err);
1032done: 1034done:
1033 kfree(fmt); 1035 kfree(fmt);
1034 return err; 1036 return err;
1035} 1037}
1036 1038
1037static noinline int v4l1_compat_sync( 1039static noinline long v4l1_compat_sync(
1038 int *i, 1040 int *i,
1039 struct file *file, 1041 struct file *file,
1040 v4l2_kioctl drv) 1042 v4l2_kioctl drv)
1041{ 1043{
1042 int err; 1044 long err;
1043 enum v4l2_buf_type captype = V4L2_BUF_TYPE_VIDEO_CAPTURE; 1045 enum v4l2_buf_type captype = V4L2_BUF_TYPE_VIDEO_CAPTURE;
1044 struct v4l2_buffer buf; 1046 struct v4l2_buffer buf;
1045 struct poll_wqueues *pwq; 1047 struct poll_wqueues *pwq;
@@ -1050,7 +1052,7 @@ static noinline int v4l1_compat_sync(
1050 err = drv(file, VIDIOC_QUERYBUF, &buf); 1052 err = drv(file, VIDIOC_QUERYBUF, &buf);
1051 if (err < 0) { 1053 if (err < 0) {
1052 /* No such buffer */ 1054 /* No such buffer */
1053 dprintk("VIDIOCSYNC / VIDIOC_QUERYBUF: %d\n", err); 1055 dprintk("VIDIOCSYNC / VIDIOC_QUERYBUF: %ld\n", err);
1054 goto done; 1056 goto done;
1055 } 1057 }
1056 if (!(buf.flags & V4L2_BUF_FLAG_MAPPED)) { 1058 if (!(buf.flags & V4L2_BUF_FLAG_MAPPED)) {
@@ -1062,7 +1064,7 @@ static noinline int v4l1_compat_sync(
1062 /* make sure capture actually runs so we don't block forever */ 1064 /* make sure capture actually runs so we don't block forever */
1063 err = drv(file, VIDIOC_STREAMON, &captype); 1065 err = drv(file, VIDIOC_STREAMON, &captype);
1064 if (err < 0) { 1066 if (err < 0) {
1065 dprintk("VIDIOCSYNC / VIDIOC_STREAMON: %d\n", err); 1067 dprintk("VIDIOCSYNC / VIDIOC_STREAMON: %ld\n", err);
1066 goto done; 1068 goto done;
1067 } 1069 }
1068 1070
@@ -1076,7 +1078,7 @@ static noinline int v4l1_compat_sync(
1076 break; 1078 break;
1077 err = drv(file, VIDIOC_QUERYBUF, &buf); 1079 err = drv(file, VIDIOC_QUERYBUF, &buf);
1078 if (err < 0) 1080 if (err < 0)
1079 dprintk("VIDIOCSYNC / VIDIOC_QUERYBUF: %d\n", err); 1081 dprintk("VIDIOCSYNC / VIDIOC_QUERYBUF: %ld\n", err);
1080 } 1082 }
1081 kfree(pwq); 1083 kfree(pwq);
1082 if (!(buf.flags & V4L2_BUF_FLAG_DONE)) /* not done */ 1084 if (!(buf.flags & V4L2_BUF_FLAG_DONE)) /* not done */
@@ -1084,18 +1086,18 @@ static noinline int v4l1_compat_sync(
1084 do { 1086 do {
1085 err = drv(file, VIDIOC_DQBUF, &buf); 1087 err = drv(file, VIDIOC_DQBUF, &buf);
1086 if (err < 0) 1088 if (err < 0)
1087 dprintk("VIDIOCSYNC / VIDIOC_DQBUF: %d\n", err); 1089 dprintk("VIDIOCSYNC / VIDIOC_DQBUF: %ld\n", err);
1088 } while (err == 0 && buf.index != *i); 1090 } while (err == 0 && buf.index != *i);
1089done: 1091done:
1090 return err; 1092 return err;
1091} 1093}
1092 1094
1093static noinline int v4l1_compat_get_vbi_format( 1095static noinline long v4l1_compat_get_vbi_format(
1094 struct vbi_format *fmt, 1096 struct vbi_format *fmt,
1095 struct file *file, 1097 struct file *file,
1096 v4l2_kioctl drv) 1098 v4l2_kioctl drv)
1097{ 1099{
1098 int err; 1100 long err;
1099 struct v4l2_format *fmt2; 1101 struct v4l2_format *fmt2;
1100 1102
1101 fmt2 = kzalloc(sizeof(*fmt2), GFP_KERNEL); 1103 fmt2 = kzalloc(sizeof(*fmt2), GFP_KERNEL);
@@ -1107,7 +1109,7 @@ static noinline int v4l1_compat_get_vbi_format(
1107 1109
1108 err = drv(file, VIDIOC_G_FMT, fmt2); 1110 err = drv(file, VIDIOC_G_FMT, fmt2);
1109 if (err < 0) { 1111 if (err < 0) {
1110 dprintk("VIDIOCGVBIFMT / VIDIOC_G_FMT: %d\n", err); 1112 dprintk("VIDIOCGVBIFMT / VIDIOC_G_FMT: %ld\n", err);
1111 goto done; 1113 goto done;
1112 } 1114 }
1113 if (fmt2->fmt.vbi.sample_format != V4L2_PIX_FMT_GREY) { 1115 if (fmt2->fmt.vbi.sample_format != V4L2_PIX_FMT_GREY) {
@@ -1128,12 +1130,12 @@ done:
1128 return err; 1130 return err;
1129} 1131}
1130 1132
1131static noinline int v4l1_compat_set_vbi_format( 1133static noinline long v4l1_compat_set_vbi_format(
1132 struct vbi_format *fmt, 1134 struct vbi_format *fmt,
1133 struct file *file, 1135 struct file *file,
1134 v4l2_kioctl drv) 1136 v4l2_kioctl drv)
1135{ 1137{
1136 int err; 1138 long err;
1137 struct v4l2_format *fmt2 = NULL; 1139 struct v4l2_format *fmt2 = NULL;
1138 1140
1139 if (VIDEO_PALETTE_RAW != fmt->sample_format) { 1141 if (VIDEO_PALETTE_RAW != fmt->sample_format) {
@@ -1157,7 +1159,7 @@ static noinline int v4l1_compat_set_vbi_format(
1157 fmt2->fmt.vbi.flags = fmt->flags; 1159 fmt2->fmt.vbi.flags = fmt->flags;
1158 err = drv(file, VIDIOC_TRY_FMT, fmt2); 1160 err = drv(file, VIDIOC_TRY_FMT, fmt2);
1159 if (err < 0) { 1161 if (err < 0) {
1160 dprintk("VIDIOCSVBIFMT / VIDIOC_TRY_FMT: %d\n", err); 1162 dprintk("VIDIOCSVBIFMT / VIDIOC_TRY_FMT: %ld\n", err);
1161 goto done; 1163 goto done;
1162 } 1164 }
1163 1165
@@ -1174,7 +1176,7 @@ static noinline int v4l1_compat_set_vbi_format(
1174 } 1176 }
1175 err = drv(file, VIDIOC_S_FMT, fmt2); 1177 err = drv(file, VIDIOC_S_FMT, fmt2);
1176 if (err < 0) 1178 if (err < 0)
1177 dprintk("VIDIOCSVBIFMT / VIDIOC_S_FMT: %d\n", err); 1179 dprintk("VIDIOCSVBIFMT / VIDIOC_S_FMT: %ld\n", err);
1178done: 1180done:
1179 kfree(fmt2); 1181 kfree(fmt2);
1180 return err; 1182 return err;
@@ -1183,13 +1185,13 @@ done:
1183/* 1185/*
1184 * This function is exported. 1186 * This function is exported.
1185 */ 1187 */
1186int 1188long
1187v4l_compat_translate_ioctl(struct file *file, 1189v4l_compat_translate_ioctl(struct file *file,
1188 int cmd, 1190 int cmd,
1189 void *arg, 1191 void *arg,
1190 v4l2_kioctl drv) 1192 v4l2_kioctl drv)
1191{ 1193{
1192 int err; 1194 long err;
1193 1195
1194 switch (cmd) { 1196 switch (cmd) {
1195 case VIDIOCGCAP: /* capability */ 1197 case VIDIOCGCAP: /* capability */
diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c
index c676b0b0f708..b8f2be8d5c0e 100644
--- a/drivers/media/video/v4l2-common.c
+++ b/drivers/media/video/v4l2-common.c
@@ -797,11 +797,11 @@ u32 v4l2_ctrl_next(const u32 * const * ctrl_classes, u32 id)
797} 797}
798EXPORT_SYMBOL(v4l2_ctrl_next); 798EXPORT_SYMBOL(v4l2_ctrl_next);
799 799
800int v4l2_chip_match_host(u32 match_type, u32 match_chip) 800int v4l2_chip_match_host(const struct v4l2_dbg_match *match)
801{ 801{
802 switch (match_type) { 802 switch (match->type) {
803 case V4L2_CHIP_MATCH_HOST: 803 case V4L2_CHIP_MATCH_HOST:
804 return match_chip == 0; 804 return match->addr == 0;
805 default: 805 default:
806 return 0; 806 return 0;
807 } 807 }
@@ -809,23 +809,34 @@ int v4l2_chip_match_host(u32 match_type, u32 match_chip)
809EXPORT_SYMBOL(v4l2_chip_match_host); 809EXPORT_SYMBOL(v4l2_chip_match_host);
810 810
811#if defined(CONFIG_I2C) || (defined(CONFIG_I2C_MODULE) && defined(MODULE)) 811#if defined(CONFIG_I2C) || (defined(CONFIG_I2C_MODULE) && defined(MODULE))
812int v4l2_chip_match_i2c_client(struct i2c_client *c, u32 match_type, u32 match_chip) 812int v4l2_chip_match_i2c_client(struct i2c_client *c, const struct v4l2_dbg_match *match)
813{ 813{
814 switch (match_type) { 814 int len;
815
816 if (c == NULL || match == NULL)
817 return 0;
818
819 switch (match->type) {
815 case V4L2_CHIP_MATCH_I2C_DRIVER: 820 case V4L2_CHIP_MATCH_I2C_DRIVER:
816 return (c != NULL && c->driver != NULL && c->driver->id == match_chip); 821 if (c->driver == NULL || c->driver->driver.name == NULL)
822 return 0;
823 len = strlen(c->driver->driver.name);
824 /* legacy drivers have a ' suffix, don't try to match that */
825 if (len && c->driver->driver.name[len - 1] == '\'')
826 len--;
827 return len && !strncmp(c->driver->driver.name, match->name, len);
817 case V4L2_CHIP_MATCH_I2C_ADDR: 828 case V4L2_CHIP_MATCH_I2C_ADDR:
818 return (c != NULL && c->addr == match_chip); 829 return c->addr == match->addr;
819 default: 830 default:
820 return 0; 831 return 0;
821 } 832 }
822} 833}
823EXPORT_SYMBOL(v4l2_chip_match_i2c_client); 834EXPORT_SYMBOL(v4l2_chip_match_i2c_client);
824 835
825int v4l2_chip_ident_i2c_client(struct i2c_client *c, struct v4l2_chip_ident *chip, 836int v4l2_chip_ident_i2c_client(struct i2c_client *c, struct v4l2_dbg_chip_ident *chip,
826 u32 ident, u32 revision) 837 u32 ident, u32 revision)
827{ 838{
828 if (!v4l2_chip_match_i2c_client(c, chip->match_type, chip->match_chip)) 839 if (!v4l2_chip_match_i2c_client(c, &chip->match))
829 return 0; 840 return 0;
830 if (chip->ident == V4L2_IDENT_NONE) { 841 if (chip->ident == V4L2_IDENT_NONE) {
831 chip->ident = ident; 842 chip->ident = ident;
diff --git a/drivers/media/video/v4l2-compat-ioctl32.c b/drivers/media/video/v4l2-compat-ioctl32.c
index d0e1bd3ace6a..110376be5d2b 100644
--- a/drivers/media/video/v4l2-compat-ioctl32.c
+++ b/drivers/media/video/v4l2-compat-ioctl32.c
@@ -222,9 +222,9 @@ static int get_microcode32(struct video_code *kp, struct video_code32 __user *up
222 222
223#endif 223#endif
224 224
225static int native_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 225static long native_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
226{ 226{
227 int ret = -ENOIOCTLCMD; 227 long ret = -ENOIOCTLCMD;
228 228
229 if (file->f_op->unlocked_ioctl) 229 if (file->f_op->unlocked_ioctl)
230 ret = file->f_op->unlocked_ioctl(file, cmd, arg); 230 ret = file->f_op->unlocked_ioctl(file, cmd, arg);
@@ -705,7 +705,7 @@ static int put_v4l2_ext_controls32(struct v4l2_ext_controls *kp, struct v4l2_ext
705#define VIDIOC_G_OUTPUT32 _IOR ('V', 46, s32) 705#define VIDIOC_G_OUTPUT32 _IOR ('V', 46, s32)
706#define VIDIOC_S_OUTPUT32 _IOWR('V', 47, s32) 706#define VIDIOC_S_OUTPUT32 _IOWR('V', 47, s32)
707 707
708static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 708static long do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
709{ 709{
710 union { 710 union {
711#ifdef CONFIG_VIDEO_V4L1_COMPAT 711#ifdef CONFIG_VIDEO_V4L1_COMPAT
@@ -726,7 +726,7 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg
726 } karg; 726 } karg;
727 void __user *up = compat_ptr(arg); 727 void __user *up = compat_ptr(arg);
728 int compatible_arg = 1; 728 int compatible_arg = 1;
729 int err = 0; 729 long err = 0;
730 730
731 /* First, convert the command. */ 731 /* First, convert the command. */
732 switch (cmd) { 732 switch (cmd) {
@@ -937,9 +937,9 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg
937 return err; 937 return err;
938} 938}
939 939
940long v4l_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg) 940long v4l2_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg)
941{ 941{
942 int ret = -ENOIOCTLCMD; 942 long ret = -ENOIOCTLCMD;
943 943
944 if (!file->f_op->ioctl && !file->f_op->unlocked_ioctl) 944 if (!file->f_op->ioctl && !file->f_op->unlocked_ioctl)
945 return ret; 945 return ret;
@@ -1046,7 +1046,8 @@ long v4l_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg)
1046 case VIDIOC_TRY_ENCODER_CMD: 1046 case VIDIOC_TRY_ENCODER_CMD:
1047 case VIDIOC_DBG_S_REGISTER: 1047 case VIDIOC_DBG_S_REGISTER:
1048 case VIDIOC_DBG_G_REGISTER: 1048 case VIDIOC_DBG_G_REGISTER:
1049 case VIDIOC_G_CHIP_IDENT: 1049 case VIDIOC_DBG_G_CHIP_IDENT:
1050 case VIDIOC_G_CHIP_IDENT_OLD:
1050 case VIDIOC_S_HW_FREQ_SEEK: 1051 case VIDIOC_S_HW_FREQ_SEEK:
1051 ret = do_video_ioctl(file, cmd, arg); 1052 ret = do_video_ioctl(file, cmd, arg);
1052 break; 1053 break;
@@ -1065,18 +1066,14 @@ long v4l_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg)
1065 break; 1066 break;
1066#endif 1067#endif
1067 default: 1068 default:
1068 v4l_print_ioctl("compat_ioctl32", cmd); 1069 printk(KERN_WARNING "compat_ioctl32: "
1069 printk(KERN_CONT "\n"); 1070 "unknown ioctl '%c', dir=%d, #%d (0x%08x)\n",
1071 _IOC_TYPE(cmd), _IOC_DIR(cmd), _IOC_NR(cmd), cmd);
1070 break; 1072 break;
1071 } 1073 }
1072 return ret; 1074 return ret;
1073} 1075}
1074#else 1076EXPORT_SYMBOL_GPL(v4l2_compat_ioctl32);
1075long v4l_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg)
1076{
1077 return -ENOIOCTLCMD;
1078}
1079#endif 1077#endif
1080EXPORT_SYMBOL_GPL(v4l_compat_ioctl32);
1081 1078
1082MODULE_LICENSE("GPL"); 1079MODULE_LICENSE("GPL");
diff --git a/drivers/media/video/v4l2-dev.c b/drivers/media/video/v4l2-dev.c
index 7ad6711ee327..13f87c22e78d 100644
--- a/drivers/media/video/v4l2-dev.c
+++ b/drivers/media/video/v4l2-dev.c
@@ -31,6 +31,7 @@
31 31
32#include <media/v4l2-common.h> 32#include <media/v4l2-common.h>
33#include <media/v4l2-device.h> 33#include <media/v4l2-device.h>
34#include <media/v4l2-ioctl.h>
34 35
35#define VIDEO_NUM_DEVICES 256 36#define VIDEO_NUM_DEVICES 256
36#define VIDEO_NAME "video4linux" 37#define VIDEO_NAME "video4linux"
@@ -182,7 +183,7 @@ static int v4l2_ioctl(struct inode *inode, struct file *filp,
182 return -ENOTTY; 183 return -ENOTTY;
183 /* Allow ioctl to continue even if the device was unregistered. 184 /* Allow ioctl to continue even if the device was unregistered.
184 Things like dequeueing buffers might still be useful. */ 185 Things like dequeueing buffers might still be useful. */
185 return vdev->fops->ioctl(inode, filp, cmd, arg); 186 return vdev->fops->ioctl(filp, cmd, arg);
186} 187}
187 188
188static long v4l2_unlocked_ioctl(struct file *filp, 189static long v4l2_unlocked_ioctl(struct file *filp,
@@ -197,20 +198,6 @@ static long v4l2_unlocked_ioctl(struct file *filp,
197 return vdev->fops->unlocked_ioctl(filp, cmd, arg); 198 return vdev->fops->unlocked_ioctl(filp, cmd, arg);
198} 199}
199 200
200#ifdef CONFIG_COMPAT
201static long v4l2_compat_ioctl(struct file *filp,
202 unsigned int cmd, unsigned long arg)
203{
204 struct video_device *vdev = video_devdata(filp);
205
206 if (!vdev->fops->compat_ioctl)
207 return -ENOIOCTLCMD;
208 /* Allow ioctl to continue even if the device was unregistered.
209 Things like dequeueing buffers might still be useful. */
210 return vdev->fops->compat_ioctl(filp, cmd, arg);
211}
212#endif
213
214static int v4l2_mmap(struct file *filp, struct vm_area_struct *vm) 201static int v4l2_mmap(struct file *filp, struct vm_area_struct *vm)
215{ 202{
216 struct video_device *vdev = video_devdata(filp); 203 struct video_device *vdev = video_devdata(filp);
@@ -239,7 +226,7 @@ static int v4l2_open(struct inode *inode, struct file *filp)
239 /* and increase the device refcount */ 226 /* and increase the device refcount */
240 video_get(vdev); 227 video_get(vdev);
241 mutex_unlock(&videodev_lock); 228 mutex_unlock(&videodev_lock);
242 ret = vdev->fops->open(inode, filp); 229 ret = vdev->fops->open(filp);
243 /* decrease the refcount in case of an error */ 230 /* decrease the refcount in case of an error */
244 if (ret) 231 if (ret)
245 video_put(vdev); 232 video_put(vdev);
@@ -250,7 +237,7 @@ static int v4l2_open(struct inode *inode, struct file *filp)
250static int v4l2_release(struct inode *inode, struct file *filp) 237static int v4l2_release(struct inode *inode, struct file *filp)
251{ 238{
252 struct video_device *vdev = video_devdata(filp); 239 struct video_device *vdev = video_devdata(filp);
253 int ret = vdev->fops->release(inode, filp); 240 int ret = vdev->fops->release(filp);
254 241
255 /* decrease the refcount unconditionally since the release() 242 /* decrease the refcount unconditionally since the release()
256 return value is ignored. */ 243 return value is ignored. */
@@ -266,7 +253,7 @@ static const struct file_operations v4l2_unlocked_fops = {
266 .mmap = v4l2_mmap, 253 .mmap = v4l2_mmap,
267 .unlocked_ioctl = v4l2_unlocked_ioctl, 254 .unlocked_ioctl = v4l2_unlocked_ioctl,
268#ifdef CONFIG_COMPAT 255#ifdef CONFIG_COMPAT
269 .compat_ioctl = v4l2_compat_ioctl, 256 .compat_ioctl = v4l2_compat_ioctl32,
270#endif 257#endif
271 .release = v4l2_release, 258 .release = v4l2_release,
272 .poll = v4l2_poll, 259 .poll = v4l2_poll,
@@ -281,7 +268,7 @@ static const struct file_operations v4l2_fops = {
281 .mmap = v4l2_mmap, 268 .mmap = v4l2_mmap,
282 .ioctl = v4l2_ioctl, 269 .ioctl = v4l2_ioctl,
283#ifdef CONFIG_COMPAT 270#ifdef CONFIG_COMPAT
284 .compat_ioctl = v4l2_compat_ioctl, 271 .compat_ioctl = v4l2_compat_ioctl32,
285#endif 272#endif
286 .release = v4l2_release, 273 .release = v4l2_release,
287 .poll = v4l2_poll, 274 .poll = v4l2_poll,
diff --git a/drivers/media/video/v4l2-ioctl.c b/drivers/media/video/v4l2-ioctl.c
index b063381f4b3b..52d687b165e0 100644
--- a/drivers/media/video/v4l2-ioctl.c
+++ b/drivers/media/video/v4l2-ioctl.c
@@ -266,7 +266,7 @@ static const char *v4l2_ioctls[] = {
266 [_IOC_NR(VIDIOC_DBG_S_REGISTER)] = "VIDIOC_DBG_S_REGISTER", 266 [_IOC_NR(VIDIOC_DBG_S_REGISTER)] = "VIDIOC_DBG_S_REGISTER",
267 [_IOC_NR(VIDIOC_DBG_G_REGISTER)] = "VIDIOC_DBG_G_REGISTER", 267 [_IOC_NR(VIDIOC_DBG_G_REGISTER)] = "VIDIOC_DBG_G_REGISTER",
268 268
269 [_IOC_NR(VIDIOC_G_CHIP_IDENT)] = "VIDIOC_G_CHIP_IDENT", 269 [_IOC_NR(VIDIOC_DBG_G_CHIP_IDENT)] = "VIDIOC_DBG_G_CHIP_IDENT",
270 [_IOC_NR(VIDIOC_S_HW_FREQ_SEEK)] = "VIDIOC_S_HW_FREQ_SEEK", 270 [_IOC_NR(VIDIOC_S_HW_FREQ_SEEK)] = "VIDIOC_S_HW_FREQ_SEEK",
271#endif 271#endif
272}; 272};
@@ -392,14 +392,14 @@ video_fix_command(unsigned int cmd)
392/* 392/*
393 * Obsolete usercopy function - Should be removed soon 393 * Obsolete usercopy function - Should be removed soon
394 */ 394 */
395int 395long
396video_usercopy(struct file *file, unsigned int cmd, unsigned long arg, 396video_usercopy(struct file *file, unsigned int cmd, unsigned long arg,
397 v4l2_kioctl func) 397 v4l2_kioctl func)
398{ 398{
399 char sbuf[128]; 399 char sbuf[128];
400 void *mbuf = NULL; 400 void *mbuf = NULL;
401 void *parg = NULL; 401 void *parg = NULL;
402 int err = -EINVAL; 402 long err = -EINVAL;
403 int is_ext_ctrl; 403 int is_ext_ctrl;
404 size_t ctrls_size = 0; 404 size_t ctrls_size = 0;
405 void __user *user_ptr = NULL; 405 void __user *user_ptr = NULL;
@@ -623,13 +623,13 @@ static int check_fmt(const struct v4l2_ioctl_ops *ops, enum v4l2_buf_type type)
623 return -EINVAL; 623 return -EINVAL;
624} 624}
625 625
626static int __video_do_ioctl(struct file *file, 626static long __video_do_ioctl(struct file *file,
627 unsigned int cmd, void *arg) 627 unsigned int cmd, void *arg)
628{ 628{
629 struct video_device *vfd = video_devdata(file); 629 struct video_device *vfd = video_devdata(file);
630 const struct v4l2_ioctl_ops *ops = vfd->ioctl_ops; 630 const struct v4l2_ioctl_ops *ops = vfd->ioctl_ops;
631 void *fh = file->private_data; 631 void *fh = file->private_data;
632 int ret = -EINVAL; 632 long ret = -EINVAL;
633 633
634 if ((vfd->debug & V4L2_DEBUG_IOCTL) && 634 if ((vfd->debug & V4L2_DEBUG_IOCTL) &&
635 !(vfd->debug & V4L2_DEBUG_IOCTL_ARG)) { 635 !(vfd->debug & V4L2_DEBUG_IOCTL_ARG)) {
@@ -1720,7 +1720,7 @@ static int __video_do_ioctl(struct file *file,
1720#ifdef CONFIG_VIDEO_ADV_DEBUG 1720#ifdef CONFIG_VIDEO_ADV_DEBUG
1721 case VIDIOC_DBG_G_REGISTER: 1721 case VIDIOC_DBG_G_REGISTER:
1722 { 1722 {
1723 struct v4l2_register *p = arg; 1723 struct v4l2_dbg_register *p = arg;
1724 1724
1725 if (!capable(CAP_SYS_ADMIN)) 1725 if (!capable(CAP_SYS_ADMIN))
1726 ret = -EPERM; 1726 ret = -EPERM;
@@ -1730,7 +1730,7 @@ static int __video_do_ioctl(struct file *file,
1730 } 1730 }
1731 case VIDIOC_DBG_S_REGISTER: 1731 case VIDIOC_DBG_S_REGISTER:
1732 { 1732 {
1733 struct v4l2_register *p = arg; 1733 struct v4l2_dbg_register *p = arg;
1734 1734
1735 if (!capable(CAP_SYS_ADMIN)) 1735 if (!capable(CAP_SYS_ADMIN))
1736 ret = -EPERM; 1736 ret = -EPERM;
@@ -1739,9 +1739,9 @@ static int __video_do_ioctl(struct file *file,
1739 break; 1739 break;
1740 } 1740 }
1741#endif 1741#endif
1742 case VIDIOC_G_CHIP_IDENT: 1742 case VIDIOC_DBG_G_CHIP_IDENT:
1743 { 1743 {
1744 struct v4l2_chip_ident *p = arg; 1744 struct v4l2_dbg_chip_ident *p = arg;
1745 1745
1746 if (!ops->vidioc_g_chip_ident) 1746 if (!ops->vidioc_g_chip_ident)
1747 break; 1747 break;
@@ -1750,6 +1750,11 @@ static int __video_do_ioctl(struct file *file,
1750 dbgarg(cmd, "chip_ident=%u, revision=0x%x\n", p->ident, p->revision); 1750 dbgarg(cmd, "chip_ident=%u, revision=0x%x\n", p->ident, p->revision);
1751 break; 1751 break;
1752 } 1752 }
1753 case VIDIOC_G_CHIP_IDENT_OLD:
1754 printk(KERN_ERR "VIDIOC_G_CHIP_IDENT has been deprecated and will disappear in 2.6.30.\n");
1755 printk(KERN_ERR "It is a debugging ioctl and must not be used in applications!\n");
1756 return -EINVAL;
1757
1753 case VIDIOC_S_HW_FREQ_SEEK: 1758 case VIDIOC_S_HW_FREQ_SEEK:
1754 { 1759 {
1755 struct v4l2_hw_freq_seek *p = arg; 1760 struct v4l2_hw_freq_seek *p = arg;
@@ -1845,20 +1850,20 @@ static int __video_do_ioctl(struct file *file,
1845 if (vfd->debug & V4L2_DEBUG_IOCTL_ARG) { 1850 if (vfd->debug & V4L2_DEBUG_IOCTL_ARG) {
1846 if (ret < 0) { 1851 if (ret < 0) {
1847 v4l_print_ioctl(vfd->name, cmd); 1852 v4l_print_ioctl(vfd->name, cmd);
1848 printk(KERN_CONT " error %d\n", ret); 1853 printk(KERN_CONT " error %ld\n", ret);
1849 } 1854 }
1850 } 1855 }
1851 1856
1852 return ret; 1857 return ret;
1853} 1858}
1854 1859
1855long __video_ioctl2(struct file *file, 1860long video_ioctl2(struct file *file,
1856 unsigned int cmd, unsigned long arg) 1861 unsigned int cmd, unsigned long arg)
1857{ 1862{
1858 char sbuf[128]; 1863 char sbuf[128];
1859 void *mbuf = NULL; 1864 void *mbuf = NULL;
1860 void *parg = NULL; 1865 void *parg = NULL;
1861 int err = -EINVAL; 1866 long err = -EINVAL;
1862 int is_ext_ctrl; 1867 int is_ext_ctrl;
1863 size_t ctrls_size = 0; 1868 size_t ctrls_size = 0;
1864 void __user *user_ptr = NULL; 1869 void __user *user_ptr = NULL;
@@ -1944,11 +1949,4 @@ out:
1944 kfree(mbuf); 1949 kfree(mbuf);
1945 return err; 1950 return err;
1946} 1951}
1947EXPORT_SYMBOL(__video_ioctl2);
1948
1949int video_ioctl2(struct inode *inode, struct file *file,
1950 unsigned int cmd, unsigned long arg)
1951{
1952 return __video_ioctl2(file, cmd, arg);
1953}
1954EXPORT_SYMBOL(video_ioctl2); 1952EXPORT_SYMBOL(video_ioctl2);
diff --git a/drivers/media/video/v4l2-subdev.c b/drivers/media/video/v4l2-subdev.c
index e3612f29d0df..fbe9cc0d433a 100644
--- a/drivers/media/video/v4l2-subdev.c
+++ b/drivers/media/video/v4l2-subdev.c
@@ -37,7 +37,7 @@ int v4l2_subdev_command(struct v4l2_subdev *sd, unsigned cmd, void *arg)
37 return v4l2_subdev_call(sd, core, queryctrl, arg); 37 return v4l2_subdev_call(sd, core, queryctrl, arg);
38 case VIDIOC_LOG_STATUS: 38 case VIDIOC_LOG_STATUS:
39 return v4l2_subdev_call(sd, core, log_status); 39 return v4l2_subdev_call(sd, core, log_status);
40 case VIDIOC_G_CHIP_IDENT: 40 case VIDIOC_DBG_G_CHIP_IDENT:
41 return v4l2_subdev_call(sd, core, g_chip_ident, arg); 41 return v4l2_subdev_call(sd, core, g_chip_ident, arg);
42 case VIDIOC_INT_S_STANDBY: 42 case VIDIOC_INT_S_STANDBY:
43 return v4l2_subdev_call(sd, core, s_standby, arg ? (*(u32 *)arg) : 0); 43 return v4l2_subdev_call(sd, core, s_standby, arg ? (*(u32 *)arg) : 0);
diff --git a/drivers/media/video/vino.c b/drivers/media/video/vino.c
index a72a361daade..88bf845a3d56 100644
--- a/drivers/media/video/vino.c
+++ b/drivers/media/video/vino.c
@@ -4019,7 +4019,7 @@ out:
4019 4019
4020/* File operations */ 4020/* File operations */
4021 4021
4022static int vino_open(struct inode *inode, struct file *file) 4022static int vino_open(struct file *file)
4023{ 4023{
4024 struct vino_channel_settings *vcs = video_drvdata(file); 4024 struct vino_channel_settings *vcs = video_drvdata(file);
4025 int ret = 0; 4025 int ret = 0;
@@ -4050,7 +4050,7 @@ static int vino_open(struct inode *inode, struct file *file)
4050 return ret; 4050 return ret;
4051} 4051}
4052 4052
4053static int vino_close(struct inode *inode, struct file *file) 4053static int vino_close(struct file *file)
4054{ 4054{
4055 struct vino_channel_settings *vcs = video_drvdata(file); 4055 struct vino_channel_settings *vcs = video_drvdata(file);
4056 dprintk("close():\n"); 4056 dprintk("close():\n");
@@ -4237,7 +4237,7 @@ error:
4237 return ret; 4237 return ret;
4238} 4238}
4239 4239
4240static int vino_do_ioctl(struct file *file, unsigned int cmd, void *arg) 4240static long vino_do_ioctl(struct file *file, unsigned int cmd, void *arg)
4241{ 4241{
4242 struct vino_channel_settings *vcs = video_drvdata(file); 4242 struct vino_channel_settings *vcs = video_drvdata(file);
4243 4243
@@ -4343,11 +4343,11 @@ static int vino_do_ioctl(struct file *file, unsigned int cmd, void *arg)
4343 return 0; 4343 return 0;
4344} 4344}
4345 4345
4346static int vino_ioctl(struct inode *inode, struct file *file, 4346static long vino_ioctl(struct file *file,
4347 unsigned int cmd, unsigned long arg) 4347 unsigned int cmd, unsigned long arg)
4348{ 4348{
4349 struct vino_channel_settings *vcs = video_drvdata(file); 4349 struct vino_channel_settings *vcs = video_drvdata(file);
4350 int ret; 4350 long ret;
4351 4351
4352 if (mutex_lock_interruptible(&vcs->mutex)) 4352 if (mutex_lock_interruptible(&vcs->mutex))
4353 return -EINTR; 4353 return -EINTR;
@@ -4364,14 +4364,13 @@ static int vino_ioctl(struct inode *inode, struct file *file,
4364/* __initdata */ 4364/* __initdata */
4365static int vino_init_stage; 4365static int vino_init_stage;
4366 4366
4367static const struct file_operations vino_fops = { 4367static const struct v4l2_file_operations vino_fops = {
4368 .owner = THIS_MODULE, 4368 .owner = THIS_MODULE,
4369 .open = vino_open, 4369 .open = vino_open,
4370 .release = vino_close, 4370 .release = vino_close,
4371 .ioctl = vino_ioctl, 4371 .ioctl = vino_ioctl,
4372 .mmap = vino_mmap, 4372 .mmap = vino_mmap,
4373 .poll = vino_poll, 4373 .poll = vino_poll,
4374 .llseek = no_llseek,
4375}; 4374};
4376 4375
4377static struct video_device v4l_device_template = { 4376static struct video_device v4l_device_template = {
diff --git a/drivers/media/video/vivi.c b/drivers/media/video/vivi.c
index e15e48f04be7..81d5aa5cf331 100644
--- a/drivers/media/video/vivi.c
+++ b/drivers/media/video/vivi.c
@@ -1024,9 +1024,9 @@ static int vidioc_s_ctrl(struct file *file, void *priv,
1024 File operations for the device 1024 File operations for the device
1025 ------------------------------------------------------------------*/ 1025 ------------------------------------------------------------------*/
1026 1026
1027static int vivi_open(struct inode *inode, struct file *file) 1027static int vivi_open(struct file *file)
1028{ 1028{
1029 int minor = iminor(inode); 1029 int minor = video_devdata(file)->minor;
1030 struct vivi_dev *dev; 1030 struct vivi_dev *dev;
1031 struct vivi_fh *fh = NULL; 1031 struct vivi_fh *fh = NULL;
1032 int i; 1032 int i;
@@ -1127,13 +1127,13 @@ vivi_poll(struct file *file, struct poll_table_struct *wait)
1127 return videobuf_poll_stream(file, q, wait); 1127 return videobuf_poll_stream(file, q, wait);
1128} 1128}
1129 1129
1130static int vivi_close(struct inode *inode, struct file *file) 1130static int vivi_close(struct file *file)
1131{ 1131{
1132 struct vivi_fh *fh = file->private_data; 1132 struct vivi_fh *fh = file->private_data;
1133 struct vivi_dev *dev = fh->dev; 1133 struct vivi_dev *dev = fh->dev;
1134 struct vivi_dmaqueue *vidq = &dev->vidq; 1134 struct vivi_dmaqueue *vidq = &dev->vidq;
1135 1135
1136 int minor = iminor(inode); 1136 int minor = video_devdata(file)->minor;
1137 1137
1138 vivi_stop_thread(vidq); 1138 vivi_stop_thread(vidq);
1139 videobuf_stop(&fh->vb_vidq); 1139 videobuf_stop(&fh->vb_vidq);
@@ -1195,16 +1195,14 @@ static int vivi_mmap(struct file *file, struct vm_area_struct *vma)
1195 return ret; 1195 return ret;
1196} 1196}
1197 1197
1198static const struct file_operations vivi_fops = { 1198static const struct v4l2_file_operations vivi_fops = {
1199 .owner = THIS_MODULE, 1199 .owner = THIS_MODULE,
1200 .open = vivi_open, 1200 .open = vivi_open,
1201 .release = vivi_close, 1201 .release = vivi_close,
1202 .read = vivi_read, 1202 .read = vivi_read,
1203 .poll = vivi_poll, 1203 .poll = vivi_poll,
1204 .ioctl = video_ioctl2, /* V4L2 ioctl handler */ 1204 .ioctl = video_ioctl2, /* V4L2 ioctl handler */
1205 .compat_ioctl = v4l_compat_ioctl32,
1206 .mmap = vivi_mmap, 1205 .mmap = vivi_mmap,
1207 .llseek = no_llseek,
1208}; 1206};
1209 1207
1210static const struct v4l2_ioctl_ops vivi_ioctl_ops = { 1208static const struct v4l2_ioctl_ops vivi_ioctl_ops = {
diff --git a/drivers/media/video/vp27smpx.c b/drivers/media/video/vp27smpx.c
index f72b859486ad..5d73f66d9f55 100644
--- a/drivers/media/video/vp27smpx.c
+++ b/drivers/media/video/vp27smpx.c
@@ -113,7 +113,7 @@ static int vp27smpx_g_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *vt)
113 return 0; 113 return 0;
114} 114}
115 115
116static int vp27smpx_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_chip_ident *chip) 116static int vp27smpx_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip)
117{ 117{
118 struct i2c_client *client = v4l2_get_subdevdata(sd); 118 struct i2c_client *client = v4l2_get_subdevdata(sd);
119 119
diff --git a/drivers/media/video/w9966.c b/drivers/media/video/w9966.c
index 56c570c267ea..038ff32b01b8 100644
--- a/drivers/media/video/w9966.c
+++ b/drivers/media/video/w9966.c
@@ -180,19 +180,19 @@ static int w9966_i2c_wbyte(struct w9966_dev* cam, int data);
180static int w9966_i2c_rbyte(struct w9966_dev* cam); 180static int w9966_i2c_rbyte(struct w9966_dev* cam);
181#endif 181#endif
182 182
183static int w9966_v4l_ioctl(struct inode *inode, struct file *file, 183static long w9966_v4l_ioctl(struct file *file,
184 unsigned int cmd, unsigned long arg); 184 unsigned int cmd, unsigned long arg);
185static ssize_t w9966_v4l_read(struct file *file, char __user *buf, 185static ssize_t w9966_v4l_read(struct file *file, char __user *buf,
186 size_t count, loff_t *ppos); 186 size_t count, loff_t *ppos);
187 187
188static int w9966_exclusive_open(struct inode *inode, struct file *file) 188static int w9966_exclusive_open(struct file *file)
189{ 189{
190 struct w9966_dev *cam = video_drvdata(file); 190 struct w9966_dev *cam = video_drvdata(file);
191 191
192 return test_and_set_bit(0, &cam->in_use) ? -EBUSY : 0; 192 return test_and_set_bit(0, &cam->in_use) ? -EBUSY : 0;
193} 193}
194 194
195static int w9966_exclusive_release(struct inode *inode, struct file *file) 195static int w9966_exclusive_release(struct file *file)
196{ 196{
197 struct w9966_dev *cam = video_drvdata(file); 197 struct w9966_dev *cam = video_drvdata(file);
198 198
@@ -200,16 +200,12 @@ static int w9966_exclusive_release(struct inode *inode, struct file *file)
200 return 0; 200 return 0;
201} 201}
202 202
203static const struct file_operations w9966_fops = { 203static const struct v4l2_file_operations w9966_fops = {
204 .owner = THIS_MODULE, 204 .owner = THIS_MODULE,
205 .open = w9966_exclusive_open, 205 .open = w9966_exclusive_open,
206 .release = w9966_exclusive_release, 206 .release = w9966_exclusive_release,
207 .ioctl = w9966_v4l_ioctl, 207 .ioctl = w9966_v4l_ioctl,
208#ifdef CONFIG_COMPAT
209 .compat_ioctl = v4l_compat_ioctl32,
210#endif
211 .read = w9966_v4l_read, 208 .read = w9966_v4l_read,
212 .llseek = no_llseek,
213}; 209};
214static struct video_device w9966_template = { 210static struct video_device w9966_template = {
215 .name = W9966_DRIVERNAME, 211 .name = W9966_DRIVERNAME,
@@ -727,7 +723,7 @@ static int w9966_wReg_i2c(struct w9966_dev* cam, int reg, int data)
727 * Video4linux interfacing 723 * Video4linux interfacing
728 */ 724 */
729 725
730static int w9966_v4l_do_ioctl(struct file *file, unsigned int cmd, void *arg) 726static long w9966_v4l_do_ioctl(struct file *file, unsigned int cmd, void *arg)
731{ 727{
732 struct w9966_dev *cam = video_drvdata(file); 728 struct w9966_dev *cam = video_drvdata(file);
733 729
@@ -877,7 +873,7 @@ static int w9966_v4l_do_ioctl(struct file *file, unsigned int cmd, void *arg)
877 return 0; 873 return 0;
878} 874}
879 875
880static int w9966_v4l_ioctl(struct inode *inode, struct file *file, 876static long w9966_v4l_ioctl(struct file *file,
881 unsigned int cmd, unsigned long arg) 877 unsigned int cmd, unsigned long arg)
882{ 878{
883 return video_usercopy(file, cmd, arg, w9966_v4l_do_ioctl); 879 return video_usercopy(file, cmd, arg, w9966_v4l_do_ioctl);
diff --git a/drivers/media/video/w9968cf.c b/drivers/media/video/w9968cf.c
index 4dfb43bd1846..a3997b7d4366 100644
--- a/drivers/media/video/w9968cf.c
+++ b/drivers/media/video/w9968cf.c
@@ -399,13 +399,13 @@ MODULE_PARM_DESC(specific_debug,
399 ****************************************************************************/ 399 ****************************************************************************/
400 400
401/* Video4linux interface */ 401/* Video4linux interface */
402static const struct file_operations w9968cf_fops; 402static const struct v4l2_file_operations w9968cf_fops;
403static int w9968cf_open(struct inode*, struct file*); 403static int w9968cf_open(struct file *);
404static int w9968cf_release(struct inode*, struct file*); 404static int w9968cf_release(struct file *);
405static int w9968cf_mmap(struct file*, struct vm_area_struct*); 405static int w9968cf_mmap(struct file *, struct vm_area_struct *);
406static int w9968cf_ioctl(struct inode*, struct file*, unsigned, unsigned long); 406static long w9968cf_ioctl(struct file *, unsigned, unsigned long);
407static ssize_t w9968cf_read(struct file*, char __user *, size_t, loff_t*); 407static ssize_t w9968cf_read(struct file *, char __user *, size_t, loff_t *);
408static int w9968cf_v4l_ioctl(struct inode*, struct file*, unsigned int, 408static long w9968cf_v4l_ioctl(struct file *, unsigned int,
409 void __user *); 409 void __user *);
410 410
411/* USB-specific */ 411/* USB-specific */
@@ -2662,7 +2662,7 @@ static void w9968cf_release_resources(struct w9968cf_device* cam)
2662 * Video4Linux interface * 2662 * Video4Linux interface *
2663 ****************************************************************************/ 2663 ****************************************************************************/
2664 2664
2665static int w9968cf_open(struct inode* inode, struct file* filp) 2665static int w9968cf_open(struct file *filp)
2666{ 2666{
2667 struct w9968cf_device* cam; 2667 struct w9968cf_device* cam;
2668 int err; 2668 int err;
@@ -2748,7 +2748,7 @@ deallocate_memory:
2748} 2748}
2749 2749
2750 2750
2751static int w9968cf_release(struct inode* inode, struct file* filp) 2751static int w9968cf_release(struct file *filp)
2752{ 2752{
2753 struct w9968cf_device* cam; 2753 struct w9968cf_device* cam;
2754 2754
@@ -2885,12 +2885,12 @@ static int w9968cf_mmap(struct file* filp, struct vm_area_struct *vma)
2885} 2885}
2886 2886
2887 2887
2888static int 2888static long
2889w9968cf_ioctl(struct inode* inode, struct file* filp, 2889w9968cf_ioctl(struct file *filp,
2890 unsigned int cmd, unsigned long arg) 2890 unsigned int cmd, unsigned long arg)
2891{ 2891{
2892 struct w9968cf_device* cam; 2892 struct w9968cf_device* cam;
2893 int err; 2893 long err;
2894 2894
2895 cam = (struct w9968cf_device*)video_get_drvdata(video_devdata(filp)); 2895 cam = (struct w9968cf_device*)video_get_drvdata(video_devdata(filp));
2896 2896
@@ -2909,15 +2909,15 @@ w9968cf_ioctl(struct inode* inode, struct file* filp,
2909 return -EIO; 2909 return -EIO;
2910 } 2910 }
2911 2911
2912 err = w9968cf_v4l_ioctl(inode, filp, cmd, (void __user *)arg); 2912 err = w9968cf_v4l_ioctl(filp, cmd, (void __user *)arg);
2913 2913
2914 mutex_unlock(&cam->fileop_mutex); 2914 mutex_unlock(&cam->fileop_mutex);
2915 return err; 2915 return err;
2916} 2916}
2917 2917
2918 2918
2919static int w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, 2919static long w9968cf_v4l_ioctl(struct file *filp,
2920 unsigned int cmd, void __user * arg) 2920 unsigned int cmd, void __user *arg)
2921{ 2921{
2922 struct w9968cf_device* cam; 2922 struct w9968cf_device* cam;
2923 const char* v4l1_ioctls[] = { 2923 const char* v4l1_ioctls[] = {
@@ -3456,17 +3456,13 @@ ioctl_fail:
3456} 3456}
3457 3457
3458 3458
3459static const struct file_operations w9968cf_fops = { 3459static const struct v4l2_file_operations w9968cf_fops = {
3460 .owner = THIS_MODULE, 3460 .owner = THIS_MODULE,
3461 .open = w9968cf_open, 3461 .open = w9968cf_open,
3462 .release = w9968cf_release, 3462 .release = w9968cf_release,
3463 .read = w9968cf_read, 3463 .read = w9968cf_read,
3464 .ioctl = w9968cf_ioctl, 3464 .ioctl = w9968cf_ioctl,
3465#ifdef CONFIG_COMPAT
3466 .compat_ioctl = v4l_compat_ioctl32,
3467#endif
3468 .mmap = w9968cf_mmap, 3465 .mmap = w9968cf_mmap,
3469 .llseek = no_llseek,
3470}; 3466};
3471 3467
3472 3468
diff --git a/drivers/media/video/wm8739.c b/drivers/media/video/wm8739.c
index 12a31e7a5f6d..f2864d5cd180 100644
--- a/drivers/media/video/wm8739.c
+++ b/drivers/media/video/wm8739.c
@@ -233,7 +233,7 @@ static int wm8739_queryctrl(struct v4l2_subdev *sd, struct v4l2_queryctrl *qc)
233 return -EINVAL; 233 return -EINVAL;
234} 234}
235 235
236static int wm8739_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_chip_ident *chip) 236static int wm8739_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip)
237{ 237{
238 struct i2c_client *client = v4l2_get_subdevdata(sd); 238 struct i2c_client *client = v4l2_get_subdevdata(sd);
239 239
diff --git a/drivers/media/video/wm8775.c b/drivers/media/video/wm8775.c
index d0220b0ec0bc..53fcd42843e0 100644
--- a/drivers/media/video/wm8775.c
+++ b/drivers/media/video/wm8775.c
@@ -130,7 +130,7 @@ static int wm8775_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
130 return 0; 130 return 0;
131} 131}
132 132
133static int wm8775_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_chip_ident *chip) 133static int wm8775_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip)
134{ 134{
135 struct i2c_client *client = v4l2_get_subdevdata(sd); 135 struct i2c_client *client = v4l2_get_subdevdata(sd);
136 136
diff --git a/drivers/media/video/zc0301/zc0301_core.c b/drivers/media/video/zc0301/zc0301_core.c
index 9d00e6056491..96971044fc78 100644
--- a/drivers/media/video/zc0301/zc0301_core.c
+++ b/drivers/media/video/zc0301/zc0301_core.c
@@ -649,7 +649,7 @@ static void zc0301_release_resources(struct kref *kref)
649} 649}
650 650
651 651
652static int zc0301_open(struct inode* inode, struct file* filp) 652static int zc0301_open(struct file *filp)
653{ 653{
654 struct zc0301_device* cam; 654 struct zc0301_device* cam;
655 int err = 0; 655 int err = 0;
@@ -733,7 +733,7 @@ out:
733} 733}
734 734
735 735
736static int zc0301_release(struct inode* inode, struct file* filp) 736static int zc0301_release(struct file *filp)
737{ 737{
738 struct zc0301_device* cam; 738 struct zc0301_device* cam;
739 739
@@ -1793,8 +1793,8 @@ zc0301_vidioc_s_parm(struct zc0301_device* cam, void __user * arg)
1793} 1793}
1794 1794
1795 1795
1796static int zc0301_ioctl_v4l2(struct inode* inode, struct file* filp, 1796static long zc0301_ioctl_v4l2(struct file *filp,
1797 unsigned int cmd, void __user * arg) 1797 unsigned int cmd, void __user *arg)
1798{ 1798{
1799 struct zc0301_device *cam = video_drvdata(filp); 1799 struct zc0301_device *cam = video_drvdata(filp);
1800 1800
@@ -1888,7 +1888,7 @@ static int zc0301_ioctl_v4l2(struct inode* inode, struct file* filp,
1888} 1888}
1889 1889
1890 1890
1891static int zc0301_ioctl(struct inode* inode, struct file* filp, 1891static long zc0301_ioctl(struct file *filp,
1892 unsigned int cmd, unsigned long arg) 1892 unsigned int cmd, unsigned long arg)
1893{ 1893{
1894 struct zc0301_device *cam = video_drvdata(filp); 1894 struct zc0301_device *cam = video_drvdata(filp);
@@ -1912,7 +1912,7 @@ static int zc0301_ioctl(struct inode* inode, struct file* filp,
1912 1912
1913 V4LDBG(3, "zc0301", cmd); 1913 V4LDBG(3, "zc0301", cmd);
1914 1914
1915 err = zc0301_ioctl_v4l2(inode, filp, cmd, (void __user *)arg); 1915 err = zc0301_ioctl_v4l2(filp, cmd, (void __user *)arg);
1916 1916
1917 mutex_unlock(&cam->fileop_mutex); 1917 mutex_unlock(&cam->fileop_mutex);
1918 1918
@@ -1920,18 +1920,14 @@ static int zc0301_ioctl(struct inode* inode, struct file* filp,
1920} 1920}
1921 1921
1922 1922
1923static const struct file_operations zc0301_fops = { 1923static const struct v4l2_file_operations zc0301_fops = {
1924 .owner = THIS_MODULE, 1924 .owner = THIS_MODULE,
1925 .open = zc0301_open, 1925 .open = zc0301_open,
1926 .release = zc0301_release, 1926 .release = zc0301_release,
1927 .ioctl = zc0301_ioctl, 1927 .ioctl = zc0301_ioctl,
1928#ifdef CONFIG_COMPAT
1929 .compat_ioctl = v4l_compat_ioctl32,
1930#endif
1931 .read = zc0301_read, 1928 .read = zc0301_read,
1932 .poll = zc0301_poll, 1929 .poll = zc0301_poll,
1933 .mmap = zc0301_mmap, 1930 .mmap = zc0301_mmap,
1934 .llseek = no_llseek,
1935}; 1931};
1936 1932
1937/*****************************************************************************/ 1933/*****************************************************************************/
diff --git a/drivers/media/video/zoran/zoran_driver.c b/drivers/media/video/zoran/zoran_driver.c
index 00b97d97aeaa..b58b9dda715c 100644
--- a/drivers/media/video/zoran/zoran_driver.c
+++ b/drivers/media/video/zoran/zoran_driver.c
@@ -1197,10 +1197,9 @@ zoran_close_end_session (struct file *file)
1197 */ 1197 */
1198 1198
1199static int 1199static int
1200zoran_open (struct inode *inode, 1200zoran_open(struct file *file)
1201 struct file *file)
1202{ 1201{
1203 unsigned int minor = iminor(inode); 1202 unsigned int minor = video_devdata(file)->minor;
1204 struct zoran *zr = NULL; 1203 struct zoran *zr = NULL;
1205 struct zoran_fh *fh; 1204 struct zoran_fh *fh;
1206 int i, res, first_open = 0, have_module_locks = 0; 1205 int i, res, first_open = 0, have_module_locks = 0;
@@ -1340,8 +1339,7 @@ open_unlock_and_return:
1340} 1339}
1341 1340
1342static int 1341static int
1343zoran_close (struct inode *inode, 1342zoran_close(struct file *file)
1344 struct file *file)
1345{ 1343{
1346 struct zoran_fh *fh = file->private_data; 1344 struct zoran_fh *fh = file->private_data;
1347 struct zoran *zr = fh->zr; 1345 struct zoran *zr = fh->zr;
@@ -1940,7 +1938,7 @@ zoran_set_input (struct zoran *zr,
1940 * ioctl routine 1938 * ioctl routine
1941 */ 1939 */
1942 1940
1943static int zoran_do_ioctl(struct file *file, unsigned int cmd, void *arg) 1941static long zoran_do_ioctl(struct file *file, unsigned int cmd, void *arg)
1944{ 1942{
1945 struct zoran_fh *fh = file->private_data; 1943 struct zoran_fh *fh = file->private_data;
1946 struct zoran *zr = fh->zr; 1944 struct zoran *zr = fh->zr;
@@ -4191,11 +4189,10 @@ static int zoran_do_ioctl(struct file *file, unsigned int cmd, void *arg)
4191} 4189}
4192 4190
4193 4191
4194static int 4192static long
4195zoran_ioctl (struct inode *inode, 4193zoran_ioctl(struct file *file,
4196 struct file *file, 4194 unsigned int cmd,
4197 unsigned int cmd, 4195 unsigned long arg)
4198 unsigned long arg)
4199{ 4196{
4200 return video_usercopy(file, cmd, arg, zoran_do_ioctl); 4197 return video_usercopy(file, cmd, arg, zoran_do_ioctl);
4201} 4198}
@@ -4620,15 +4617,11 @@ zoran_mmap (struct file *file,
4620 return 0; 4617 return 0;
4621} 4618}
4622 4619
4623static const struct file_operations zoran_fops = { 4620static const struct v4l2_file_operations zoran_fops = {
4624 .owner = THIS_MODULE, 4621 .owner = THIS_MODULE,
4625 .open = zoran_open, 4622 .open = zoran_open,
4626 .release = zoran_close, 4623 .release = zoran_close,
4627 .ioctl = zoran_ioctl, 4624 .ioctl = zoran_ioctl,
4628#ifdef CONFIG_COMPAT
4629 .compat_ioctl = v4l_compat_ioctl32,
4630#endif
4631 .llseek = no_llseek,
4632 .read = zoran_read, 4625 .read = zoran_read,
4633 .write = zoran_write, 4626 .write = zoran_write,
4634 .mmap = zoran_mmap, 4627 .mmap = zoran_mmap,
diff --git a/drivers/media/video/zr364xx.c b/drivers/media/video/zr364xx.c
index a1d81ed44c7c..93023560f324 100644
--- a/drivers/media/video/zr364xx.c
+++ b/drivers/media/video/zr364xx.c
@@ -634,7 +634,7 @@ static int zr364xx_vidioc_streamoff(struct file *file, void *priv,
634 634
635 635
636/* open the camera */ 636/* open the camera */
637static int zr364xx_open(struct inode *inode, struct file *file) 637static int zr364xx_open(struct file *file)
638{ 638{
639 struct video_device *vdev = video_devdata(file); 639 struct video_device *vdev = video_devdata(file);
640 struct zr364xx_camera *cam = video_get_drvdata(vdev); 640 struct zr364xx_camera *cam = video_get_drvdata(vdev);
@@ -688,7 +688,7 @@ out:
688 688
689 689
690/* release the camera */ 690/* release the camera */
691static int zr364xx_release(struct inode *inode, struct file *file) 691static int zr364xx_release(struct file *file)
692{ 692{
693 struct video_device *vdev = video_devdata(file); 693 struct video_device *vdev = video_devdata(file);
694 struct zr364xx_camera *cam; 694 struct zr364xx_camera *cam;
@@ -761,14 +761,13 @@ static int zr364xx_mmap(struct file *file, struct vm_area_struct *vma)
761} 761}
762 762
763 763
764static const struct file_operations zr364xx_fops = { 764static const struct v4l2_file_operations zr364xx_fops = {
765 .owner = THIS_MODULE, 765 .owner = THIS_MODULE,
766 .open = zr364xx_open, 766 .open = zr364xx_open,
767 .release = zr364xx_release, 767 .release = zr364xx_release,
768 .read = zr364xx_read, 768 .read = zr364xx_read,
769 .mmap = zr364xx_mmap, 769 .mmap = zr364xx_mmap,
770 .ioctl = video_ioctl2, 770 .ioctl = video_ioctl2,
771 .llseek = no_llseek,
772}; 771};
773 772
774static const struct v4l2_ioctl_ops zr364xx_ioctl_ops = { 773static const struct v4l2_ioctl_ops zr364xx_ioctl_ops = {
@@ -894,7 +893,6 @@ static void zr364xx_disconnect(struct usb_interface *intf)
894{ 893{
895 struct zr364xx_camera *cam = usb_get_intfdata(intf); 894 struct zr364xx_camera *cam = usb_get_intfdata(intf);
896 usb_set_intfdata(intf, NULL); 895 usb_set_intfdata(intf, NULL);
897 dev_set_drvdata(&intf->dev, NULL);
898 dev_info(&intf->dev, DRIVER_DESC " webcam unplugged\n"); 896 dev_info(&intf->dev, DRIVER_DESC " webcam unplugged\n");
899 if (cam->vdev) 897 if (cam->vdev)
900 video_unregister_device(cam->vdev); 898 video_unregister_device(cam->vdev);