aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/vivi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/vivi.c')
-rw-r--r--drivers/media/video/vivi.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/drivers/media/video/vivi.c b/drivers/media/video/vivi.c
index e17b6fee046b..9797e5a69265 100644
--- a/drivers/media/video/vivi.c
+++ b/drivers/media/video/vivi.c
@@ -820,14 +820,11 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
820 struct v4l2_format *f) 820 struct v4l2_format *f)
821{ 821{
822 struct vivi_dev *dev = video_drvdata(file); 822 struct vivi_dev *dev = video_drvdata(file);
823 struct videobuf_queue *q = &dev->vb_vidq;
824 823
825 int ret = vidioc_try_fmt_vid_cap(file, priv, f); 824 int ret = vidioc_try_fmt_vid_cap(file, priv, f);
826 if (ret < 0) 825 if (ret < 0)
827 return ret; 826 return ret;
828 827
829 mutex_lock(&q->vb_lock);
830
831 if (vivi_is_generating(dev)) { 828 if (vivi_is_generating(dev)) {
832 dprintk(dev, 1, "%s device busy\n", __func__); 829 dprintk(dev, 1, "%s device busy\n", __func__);
833 ret = -EBUSY; 830 ret = -EBUSY;
@@ -840,7 +837,6 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
840 dev->vb_vidq.field = f->fmt.pix.field; 837 dev->vb_vidq.field = f->fmt.pix.field;
841 ret = 0; 838 ret = 0;
842out: 839out:
843 mutex_unlock(&q->vb_lock);
844 return ret; 840 return ret;
845} 841}
846 842
@@ -1086,7 +1082,7 @@ static const struct v4l2_file_operations vivi_fops = {
1086 .release = vivi_close, 1082 .release = vivi_close,
1087 .read = vivi_read, 1083 .read = vivi_read,
1088 .poll = vivi_poll, 1084 .poll = vivi_poll,
1089 .ioctl = video_ioctl2, /* V4L2 ioctl handler */ 1085 .unlocked_ioctl = video_ioctl2, /* V4L2 ioctl handler */
1090 .mmap = vivi_mmap, 1086 .mmap = vivi_mmap,
1091}; 1087};
1092 1088
@@ -1173,19 +1169,19 @@ static int __init vivi_create_instance(int inst)
1173 dev->saturation = 127; 1169 dev->saturation = 127;
1174 dev->hue = 0; 1170 dev->hue = 0;
1175 1171
1172 /* initialize locks */
1173 spin_lock_init(&dev->slock);
1174 mutex_init(&dev->mutex);
1175
1176 videobuf_queue_vmalloc_init(&dev->vb_vidq, &vivi_video_qops, 1176 videobuf_queue_vmalloc_init(&dev->vb_vidq, &vivi_video_qops,
1177 NULL, &dev->slock, V4L2_BUF_TYPE_VIDEO_CAPTURE, 1177 NULL, &dev->slock, V4L2_BUF_TYPE_VIDEO_CAPTURE,
1178 V4L2_FIELD_INTERLACED, 1178 V4L2_FIELD_INTERLACED,
1179 sizeof(struct vivi_buffer), dev); 1179 sizeof(struct vivi_buffer), dev, &dev->mutex);
1180 1180
1181 /* init video dma queues */ 1181 /* init video dma queues */
1182 INIT_LIST_HEAD(&dev->vidq.active); 1182 INIT_LIST_HEAD(&dev->vidq.active);
1183 init_waitqueue_head(&dev->vidq.wq); 1183 init_waitqueue_head(&dev->vidq.wq);
1184 1184
1185 /* initialize locks */
1186 spin_lock_init(&dev->slock);
1187 mutex_init(&dev->mutex);
1188
1189 ret = -ENOMEM; 1185 ret = -ENOMEM;
1190 vfd = video_device_alloc(); 1186 vfd = video_device_alloc();
1191 if (!vfd) 1187 if (!vfd)
@@ -1194,6 +1190,7 @@ static int __init vivi_create_instance(int inst)
1194 *vfd = vivi_template; 1190 *vfd = vivi_template;
1195 vfd->debug = debug; 1191 vfd->debug = debug;
1196 vfd->v4l2_dev = &dev->v4l2_dev; 1192 vfd->v4l2_dev = &dev->v4l2_dev;
1193 vfd->lock = &dev->mutex;
1197 1194
1198 ret = video_register_device(vfd, VFL_TYPE_GRABBER, video_nr); 1195 ret = video_register_device(vfd, VFL_TYPE_GRABBER, video_nr);
1199 if (ret < 0) 1196 if (ret < 0)