[media] cx18: Move spinlock and vb_type initialisation into stream_init
authorSimon Farnsworth <simon.farnsworth@onelan.co.uk>
Tue, 10 May 2011 13:49:50 +0000 (10:49 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Fri, 20 May 2011 23:21:27 +0000 (20:21 -0300)
The initialisation of vb_type in serialized_open was preventing
REQBUFS from working reliably. Remove it, and move the spinlock into
stream_init for good measure - it's only used when we have a stream
that supports videobuf anyway.

Signed-off-by: Simon Farnsworth <simon.farnsworth@onelan.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/cx18/cx18-fileops.c
drivers/media/video/cx18/cx18-streams.c

index 6609222eccf8721624938b1a2af42c76dcb6f5ae..07411f34885a88797f39022ffc45ae10dd88b166 100644 (file)
@@ -810,9 +810,6 @@ static int cx18_serialized_open(struct cx18_stream *s, struct file *filp)
        item->cx = cx;
        item->type = s->type;
 
-       spin_lock_init(&s->vbuf_q_lock);
-       s->vb_type = 0;
-
        item->open_id = cx->open_id++;
        filp->private_data = &item->fh;
 
index 3995af71b820a3ad4da36938655ae3c096a00787..852f420fd2715c6190cc97e25b7e8ddc280f9771 100644 (file)
@@ -275,6 +275,8 @@ static void cx18_stream_init(struct cx18 *cx, int type)
        init_timer(&s->vb_timeout);
        spin_lock_init(&s->vb_lock);
        if (type == CX18_ENC_STREAM_TYPE_YUV) {
+               spin_lock_init(&s->vbuf_q_lock);
+
                s->vb_type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
                videobuf_queue_vmalloc_init(&s->vbuf_q, &cx18_videobuf_qops,
                        &cx->pci_dev->dev, &s->vbuf_q_lock,