summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/v4l2-dev.c
diff options
context:
space:
mode:
Diffstat (limited to 'linux/drivers/media/video/v4l2-dev.c')
-rw-r--r--linux/drivers/media/video/v4l2-dev.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/linux/drivers/media/video/v4l2-dev.c b/linux/drivers/media/video/v4l2-dev.c
index 279f436fe..594f2477f 100644
--- a/linux/drivers/media/video/v4l2-dev.c
+++ b/linux/drivers/media/video/v4l2-dev.c
@@ -150,7 +150,6 @@ static int video_open(struct inode *inode, struct file *file)
if (minor >= VIDEO_NUM_DEVICES)
return -ENODEV;
- lock_kernel();
mutex_lock(&videodev_lock);
vfl = video_device[minor];
if (vfl == NULL) {
@@ -160,7 +159,6 @@ static int video_open(struct inode *inode, struct file *file)
vfl = video_device[minor];
if (vfl == NULL) {
mutex_unlock(&videodev_lock);
- unlock_kernel();
return -ENODEV;
}
}
@@ -178,7 +176,6 @@ static int video_open(struct inode *inode, struct file *file)
}
fops_put(old_fops);
mutex_unlock(&videodev_lock);
- unlock_kernel();
return err;
}
@@ -260,11 +257,13 @@ int video_register_device(struct video_device *vfd, int type, int nr)
EXPORT_SYMBOL(video_register_device);
/**
- * video_register_device - register video4linux devices
+ * video_register_device_index - register video4linux devices
* @vfd: video device structure we want to register
* @type: type of device to register
* @nr: which device number (0 == /dev/video0, 1 == /dev/video1, ...
* -1 == first free)
+ * @index: stream number based on parent device;
+ * -1 if auto assign, requested number otherwise
*
* The registration code assigns minor numbers based on the type
* requested. -ENFILE is returned in all the device slots for this
@@ -317,7 +316,7 @@ int video_register_device_index(struct video_device *vfd, int type, int nr,
default:
printk(KERN_ERR "%s called with unknown type: %d\n",
__func__, type);
- return -1;
+ return -EINVAL;
}
/* pick a minor number */
@@ -340,6 +339,7 @@ int video_register_device_index(struct video_device *vfd, int type, int nr,
}
}
video_device[i] = vfd;
+ vfd->vfl_type = type;
vfd->minor = i;
ret = get_index(vfd, index);
@@ -356,10 +356,8 @@ int video_register_device_index(struct video_device *vfd, int type, int nr,
/* sysfs class */
memset(&vfd->dev, 0x00, sizeof(vfd->dev));
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 18)
vfd->dev.class = &video_class;
vfd->dev.devt = MKDEV(VIDEO_MAJOR, vfd->minor);
-#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19)
if (vfd->parent)
vfd->dev.dev = vfd->parent;