]> git.karo-electronics.de Git - linux-beck.git/commitdiff
[media] videobuf2: don't return POLLERR when only polling for events
authorHans Verkuil <hans.verkuil@cisco.com>
Wed, 30 Jan 2013 16:29:02 +0000 (13:29 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Tue, 5 Feb 2013 20:22:15 +0000 (18:22 -0200)
If you only poll for events, then vb2_poll will return POLLPRI | POLLERR if
no streaming is in progress. That's not right, it's perfectly valid to
poll just for events.

Cc: Pawel Osciak <pawel@osciak.com>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/v4l2-core/videobuf2-core.c

index d09be38dd3779faadd24720f18edb80c61f39d01..db1235dcb3280e71413ad946be39163a6b3c3b2a 100644 (file)
@@ -1965,6 +1965,11 @@ unsigned int vb2_poll(struct vb2_queue *q, struct file *file, poll_table *wait)
                        poll_wait(file, &fh->wait, wait);
        }
 
+       if (!V4L2_TYPE_IS_OUTPUT(q->type) && !(req_events & (POLLIN | POLLRDNORM)))
+               return res;
+       if (V4L2_TYPE_IS_OUTPUT(q->type) && !(req_events & (POLLOUT | POLLWRNORM)))
+               return res;
+
        /*
         * Start file I/O emulator only if streaming API has not been used yet.
         */