[media] mem2mem: make queue lock in v4l2_m2m_poll interruptible
authorPhilipp Zabel <p.zabel@pengutronix.de>
Mon, 26 May 2014 13:49:22 +0000 (10:49 -0300)
committerMauro Carvalho Chehab <m.chehab@samsung.com>
Fri, 4 Jul 2014 19:11:44 +0000 (16:11 -0300)
This patch makes the queue lock taken in v4l2_m2m_poll interruptible.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
drivers/media/v4l2-core/v4l2-mem2mem.c

index 178ce96556c6424432a9220295219ccd0dadf4e7..97defed7c1ac82b14ceb36adf2a9e72128bb16a5 100644 (file)
@@ -568,8 +568,12 @@ unsigned int v4l2_m2m_poll(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
 
        if (m2m_ctx->m2m_dev->m2m_ops->lock)
                m2m_ctx->m2m_dev->m2m_ops->lock(m2m_ctx->priv);
-       else if (m2m_ctx->q_lock)
-               mutex_lock(m2m_ctx->q_lock);
+       else if (m2m_ctx->q_lock) {
+               if (mutex_lock_interruptible(m2m_ctx->q_lock)) {
+                       rc |= POLLERR;
+                       goto end;
+               }
+       }
 
        spin_lock_irqsave(&src_q->done_lock, flags);
        if (!list_empty(&src_q->done_list))