]> git.proxmox.com Git - mirror_ubuntu-kernels.git/blobdiff - drivers/media/video/v4l2-dev.c
V4L/DVB: v4l2-dev: after a disconnect any ioctl call will be blocked
[mirror_ubuntu-kernels.git] / drivers / media / video / v4l2-dev.c
index 249af6a1d56defcfdbccbee4591479d44b03cea9..f069c61cdf68791839dc6d413201d9b71239418c 100644 (file)
@@ -81,7 +81,7 @@ static inline unsigned long *devnode_bits(int vfl_type)
        /* Any types not assigned to fixed minor ranges must be mapped to
           one single bitmap for the purposes of finding a free node number
           since all those unassigned types use the same minor range. */
-       int idx = (vfl_type > VFL_TYPE_VTX) ? VFL_TYPE_MAX - 1 : vfl_type;
+       int idx = (vfl_type > VFL_TYPE_RADIO) ? VFL_TYPE_MAX - 1 : vfl_type;
 
        return devnode_nums[idx];
 }
@@ -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) {
@@ -377,8 +377,6 @@ static int get_index(struct video_device *vdev)
  *
  *     %VFL_TYPE_GRABBER - A frame grabber
  *
- *     %VFL_TYPE_VTX - A teletext device
- *
  *     %VFL_TYPE_VBI - Vertical blank data (undecoded)
  *
  *     %VFL_TYPE_RADIO - A radio card
@@ -411,9 +409,6 @@ static int __video_register_device(struct video_device *vdev, int type, int nr,
        case VFL_TYPE_GRABBER:
                name_base = "video";
                break;
-       case VFL_TYPE_VTX:
-               name_base = "vtx";
-               break;
        case VFL_TYPE_VBI:
                name_base = "vbi";
                break;
@@ -428,8 +423,12 @@ static int __video_register_device(struct video_device *vdev, int type, int nr,
 
        vdev->vfl_type = type;
        vdev->cdev = NULL;
-       if (vdev->v4l2_dev && vdev->v4l2_dev->dev)
-               vdev->parent = vdev->v4l2_dev->dev;
+       if (vdev->v4l2_dev) {
+               if (vdev->v4l2_dev->dev)
+                       vdev->parent = vdev->v4l2_dev->dev;
+               if (vdev->ctrl_handler == NULL)
+                       vdev->ctrl_handler = vdev->v4l2_dev->ctrl_handler;
+       }
 
        /* Part 2: find a free minor, device node number and device index. */
 #ifdef CONFIG_VIDEO_FIXED_MINOR_RANGES
@@ -447,10 +446,6 @@ static int __video_register_device(struct video_device *vdev, int type, int nr,
                minor_offset = 64;
                minor_cnt = 64;
                break;
-       case VFL_TYPE_VTX:
-               minor_offset = 192;
-               minor_cnt = 32;
-               break;
        case VFL_TYPE_VBI:
                minor_offset = 224;
                minor_cnt = 32;