media: videobuf: fix epoll() by calling poll_wait first

The epoll function expects that whenever the poll file op is
called, the poll_wait function is also called. That didn't
always happen in videobuf_poll_stream(). Fix this, otherwise
epoll() would timeout when it shouldn't.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
This commit is contained in:
Hans Verkuil 2019-02-07 06:49:47 -05:00 committed by Mauro Carvalho Chehab
parent 96ebc0ca6f
commit bb436cbeb9
1 changed files with 3 additions and 3 deletions

View File

@ -1126,6 +1126,7 @@ __poll_t videobuf_poll_stream(struct file *file,
struct videobuf_buffer *buf = NULL;
__poll_t rc = 0;
poll_wait(file, &buf->done, wait);
videobuf_queue_lock(q);
if (q->streaming) {
if (!list_empty(&q->stream))
@ -1149,7 +1150,6 @@ __poll_t videobuf_poll_stream(struct file *file,
rc = EPOLLERR;
if (0 == rc) {
poll_wait(file, &buf->done, wait);
if (buf->state == VIDEOBUF_DONE ||
buf->state == VIDEOBUF_ERROR) {
switch (q->type) {