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/v4l2-dev.c | |
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/v4l2-dev.c')
-rw-r--r-- | drivers/media/video/v4l2-dev.c | 25 |
1 files changed, 6 insertions, 19 deletions
diff --git a/drivers/media/video/v4l2-dev.c b/drivers/media/video/v4l2-dev.c index 7ad6711ee327..000013448b60 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 | ||
188 | static long v4l2_unlocked_ioctl(struct file *filp, | 189 | static 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 | ||
201 | static 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 | |||
214 | static int v4l2_mmap(struct file *filp, struct vm_area_struct *vm) | 201 | static 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) | |||
250 | static int v4l2_release(struct inode *inode, struct file *filp) | 237 | static 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 = v4l_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 = v4l_compat_ioctl32, |
285 | #endif | 272 | #endif |
286 | .release = v4l2_release, | 273 | .release = v4l2_release, |
287 | .poll = v4l2_poll, | 274 | .poll = v4l2_poll, |