]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
V4L/DVB: v4l2-dev: after a disconnect any ioctl call will be blocked
authorHans Verkuil <hverkuil@xs4all.nl>
Sun, 26 Sep 2010 11:16:56 +0000 (08:16 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Thu, 21 Oct 2010 03:06:14 +0000 (01:06 -0200)
Until now all fops except release and (unlocked_)ioctl returned an error
after the device node was unregistered. Extend this as well to the ioctl
fops. There is nothing useful that an application can do here and it
complicates the driver code unnecessarily.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Documentation/video4linux/v4l2-framework.txt
drivers/media/video/v4l2-dev.c

index 8fb9de4f48759a998f31e854ba321ce03702bbec..9b1d81c26b7d3bf4447d01452368ee02b0b4a2ef 100644 (file)
@@ -551,9 +551,8 @@ from /dev).
 
 After video_unregister_device() returns no new opens can be done. However,
 in the case of USB devices some application might still have one of these
-device nodes open. So after the unregister all file operations will return
-an error as well, except for the ioctl and unlocked_ioctl file operations:
-those will still be passed on since some buffer ioctls may still be needed.
+device nodes open. So after the unregister all file operations (except
+release, of course) will return an error as well.
 
 When the last user of the video device node exits, then the vdev->release()
 callback is called and you can do the final cleanup there.
index d4a353260c1ef6b001e2ef97445c03b1509cf8f1..f069c61cdf68791839dc6d413201d9b71239418c 100644 (file)
@@ -221,8 +221,8 @@ static long v4l2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
        struct video_device *vdev = video_devdata(filp);
        int ret;
 
-       /* Allow ioctl to continue even if the device was unregistered.
-          Things like dequeueing buffers might still be useful. */
+       if (!vdev->fops->ioctl)
+               return -ENOTTY;
        if (vdev->fops->unlocked_ioctl) {
                ret = vdev->fops->unlocked_ioctl(filp, cmd, arg);
        } else if (vdev->fops->ioctl) {