aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/vivi.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-10-28 12:35:11 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-10-28 12:35:11 -0400
commit0851668fdd97e526b2a41f794b785c204dd3d3e0 (patch)
tree4ef7c20a8be8393006c6fe9627eb29dd30877d61 /drivers/media/video/vivi.c
parent00ebb6382b8d9c7c15b5f8ad230670d8161d38dd (diff)
parent7655e594945289b418af39f6669fea4666a7b520 (diff)
Merge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6
* 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6: (505 commits) [media] af9015: Fix max I2C message size when used with tda18271 [media] IR: initialize ir_raw_event in few more drivers [media] Guard a divide in v4l1 compat layer [media] imon: fix nomouse modprobe option [media] imon: remove redundant change_protocol call [media] imon: fix my egregious brown paper bag w/rdev/idev split [media] cafe_ccic: Configure ov7670 correctly [media] ov7670: allow configuration of image size, clock speed, and I/O method [media] af9015: support for DigitalNow TinyTwin v3 [1f4d:9016] [media] af9015: map DigitalNow TinyTwin v2 remote [media] DigitalNow TinyTwin remote controller [media] af9015: RC fixes and improvements videodev2.h.xml: Update to reflect the latest changes at videodev2.h [media] v4l: document new Bayer and monochrome pixel formats [media] DocBook/v4l: Add missing formats used on gspca cpia1 and sn9c2028 [media] firedtv: add parameter to fake ca_system_ids in CA_INFO [media] tm6000: fix a macro coding style issue tm6000: Remove some ugly debug code [media] Nova-S-Plus audio line input [media] [RFC,1/1] V4L2: Use new CAP bits in existing RDS capable drivers ...
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)