[media] media: vb2: return for polling if a buffer is available
authorSeung-Woo Kim <sw0312.kim@samsung.com>
Tue, 21 May 2013 02:47:29 +0000 (23:47 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Mon, 3 Jun 2013 18:30:30 +0000 (15:30 -0300)
The vb2_poll() does not need to wait next vb_buffer_done() if there is already
a buffer in done_list of queue, but current vb2_poll() always waits.
So done_list is checked before calling poll_wait().

Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/v4l2-core/videobuf2-core.c

index 7d833eefaf4e9bf2124f035db614179127268e4a..e3bdc3be91e12822bcf92c4538433522a2aaa886 100644 (file)
@@ -2014,7 +2014,8 @@ unsigned int vb2_poll(struct vb2_queue *q, struct file *file, poll_table *wait)
        if (list_empty(&q->queued_list))
                return res | POLLERR;
 
-       poll_wait(file, &q->done_wq, wait);
+       if (list_empty(&q->done_list))
+               poll_wait(file, &q->done_wq, wait);
 
        /*
         * Take first buffer available for dequeuing.