[media] v4l2-mem2mem: use CAPTURE queue lock
authorJohn Sheu <sheu@chromium.org>
Wed, 6 Feb 2013 23:03:00 +0000 (20:03 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Mon, 18 Mar 2013 23:47:36 +0000 (20:47 -0300)
In v4l2_m2m_try_schedule(), use the CAPTURE queue lock when accessing
the CAPTURE queue, instead of relying on just holding the OUTPUT queue
lock.

Signed-off-by: John Sheu <sheu@google.com>
Acked-by: Pawel Osciak <pawel@osciak.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/v4l2-core/v4l2-mem2mem.c

index da99cf7..27ddb3d 100644 (file)
@@ -230,12 +230,15 @@ static void v4l2_m2m_try_schedule(struct v4l2_m2m_ctx *m2m_ctx)
                dprintk("No input buffers available\n");
                return;
        }
+       spin_lock_irqsave(&m2m_ctx->cap_q_ctx.rdy_spinlock, flags);
        if (list_empty(&m2m_ctx->cap_q_ctx.rdy_queue)) {
+               spin_unlock_irqrestore(&m2m_ctx->cap_q_ctx.rdy_spinlock, flags);
                spin_unlock_irqrestore(&m2m_ctx->out_q_ctx.rdy_spinlock, flags);
                spin_unlock_irqrestore(&m2m_dev->job_spinlock, flags_job);
                dprintk("No output buffers available\n");
                return;
        }
+       spin_unlock_irqrestore(&m2m_ctx->cap_q_ctx.rdy_spinlock, flags);
        spin_unlock_irqrestore(&m2m_ctx->out_q_ctx.rdy_spinlock, flags);
 
        if (m2m_dev->m2m_ops->job_ready