diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2008-12-30 04:58:20 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-01-02 14:11:12 -0500 |
commit | bec43661b1dc0075b7445223ba775674133b164d (patch) | |
tree | 2a09ad5cc78799985e5cfb789f0a23db58e70499 /drivers/media/video/usbvideo | |
parent | dfa9a5ae679ff2d23caa995d0f55a19abaf0596e (diff) |
V4L/DVB (10135): v4l2: introduce v4l2_file_operations.
Introduce a struct v4l2_file_operations for v4l2 drivers.
Remove the unnecessary inode argument.
Move compat32 handling (and llseek) into the v4l2-dev core: this is now
handled in the v4l2 core and no longer in the drivers themselves.
Note that this changeset reverts an earlier patch that changed the return
type of__video_ioctl2 from int to long. This change will be reinstated
later in a much improved version.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/usbvideo')
-rw-r--r-- | drivers/media/video/usbvideo/usbvideo.c | 18 | ||||
-rw-r--r-- | drivers/media/video/usbvideo/vicam.c | 12 |
2 files changed, 11 insertions, 19 deletions
diff --git a/drivers/media/video/usbvideo/usbvideo.c b/drivers/media/video/usbvideo/usbvideo.c index 148a1f98c70..9bf82430eb1 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); | |||
41 | static void usbvideo_Disconnect(struct usb_interface *intf); | 41 | static void usbvideo_Disconnect(struct usb_interface *intf); |
42 | static void usbvideo_CameraRelease(struct uvd *uvd); | 42 | static void usbvideo_CameraRelease(struct uvd *uvd); |
43 | 43 | ||
44 | static int usbvideo_v4l_ioctl(struct inode *inode, struct file *file, | 44 | static int usbvideo_v4l_ioctl(struct file *file, |
45 | unsigned int cmd, unsigned long arg); | 45 | unsigned int cmd, unsigned long arg); |
46 | static int usbvideo_v4l_mmap(struct file *file, struct vm_area_struct *vma); | 46 | static int usbvideo_v4l_mmap(struct file *file, struct vm_area_struct *vma); |
47 | static int usbvideo_v4l_open(struct inode *inode, struct file *file); | 47 | static int usbvideo_v4l_open(struct file *file); |
48 | static ssize_t usbvideo_v4l_read(struct file *file, char __user *buf, | 48 | static 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); |
50 | static int usbvideo_v4l_close(struct inode *inode, struct file *file); | 50 | static int usbvideo_v4l_close(struct file *file); |
51 | 51 | ||
52 | static int usbvideo_StartDataPump(struct uvd *uvd); | 52 | static int usbvideo_StartDataPump(struct uvd *uvd); |
53 | static void usbvideo_StopDataPump(struct uvd *uvd); | 53 | static 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 | ||
945 | static const struct file_operations usbvideo_fops = { | 945 | static 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 | }; |
957 | static const struct video_device usbvideo_template = { | 953 | static 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 | */ |
1116 | static int usbvideo_v4l_open(struct inode *inode, struct file *file) | 1112 | static 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 | */ |
1236 | static int usbvideo_v4l_close(struct inode *inode, struct file *file) | 1232 | static 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; |
@@ -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 | ||
1504 | static int usbvideo_v4l_ioctl(struct inode *inode, struct file *file, | 1500 | static int 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 4602597ed8d..53197a4e6b9 100644 --- a/drivers/media/video/usbvideo/vicam.c +++ b/drivers/media/video/usbvideo/vicam.c | |||
@@ -230,7 +230,7 @@ set_camera_power(struct vicam_camera *cam, int state) | |||
230 | } | 230 | } |
231 | 231 | ||
232 | static int | 232 | static int |
233 | vicam_ioctl(struct inode *inode, struct file *file, unsigned int ioctlnr, unsigned long arg) | 233 | vicam_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; |
@@ -470,7 +470,7 @@ vicam_ioctl(struct inode *inode, struct file *file, unsigned int ioctlnr, unsign | |||
470 | } | 470 | } |
471 | 471 | ||
472 | static int | 472 | static int |
473 | vicam_open(struct inode *inode, struct file *file) | 473 | vicam_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 | ||
538 | static int | 538 | static int |
539 | vicam_close(struct inode *inode, struct file *file) | 539 | vicam_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 | ||
786 | static const struct file_operations vicam_fops = { | 786 | static 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 | ||
799 | static struct video_device vicam_template = { | 795 | static struct video_device vicam_template = { |