]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
videobuf2: only start streaming in poll() if so requested by the poll mask.
authorHans Verkuil <hans.verkuil@cisco.com>
Wed, 13 Jul 2011 09:01:30 +0000 (11:01 +0200)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Tue, 8 Nov 2011 19:26:47 +0000 (17:26 -0200)
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Pawel Osciak <pawel@osciak.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/videobuf2-core.c

index 979e544388cbfbdea4efa2ea1c1bb321e1d37897..ec9c2d4618a294891e635ccdc3e619c0d4f616ec 100644 (file)
@@ -1619,6 +1619,7 @@ static int __vb2_cleanup_fileio(struct vb2_queue *q);
  */
 unsigned int vb2_poll(struct vb2_queue *q, struct file *file, poll_table *wait)
 {
+       unsigned long req_events = poll_requested_events(wait);
        unsigned long flags;
        unsigned int ret;
        struct vb2_buffer *vb = NULL;
@@ -1627,12 +1628,14 @@ unsigned int vb2_poll(struct vb2_queue *q, struct file *file, poll_table *wait)
         * Start file I/O emulator only if streaming API has not been used yet.
         */
        if (q->num_buffers == 0 && q->fileio == NULL) {
-               if (!V4L2_TYPE_IS_OUTPUT(q->type) && (q->io_modes & VB2_READ)) {
+               if (!V4L2_TYPE_IS_OUTPUT(q->type) && (q->io_modes & VB2_READ) &&
+                               (req_events & (POLLIN | POLLRDNORM))) {
                        ret = __vb2_init_fileio(q, 1);
                        if (ret)
                                return POLLERR;
                }
-               if (V4L2_TYPE_IS_OUTPUT(q->type) && (q->io_modes & VB2_WRITE)) {
+               if (V4L2_TYPE_IS_OUTPUT(q->type) && (q->io_modes & VB2_WRITE) &&
+                               (req_events & (POLLOUT | POLLWRNORM))) {
                        ret = __vb2_init_fileio(q, 0);
                        if (ret)
                                return POLLERR;