summaryrefslogtreecommitdiffstats
path: root/drivers/media/common/videobuf2/videobuf2-core.c
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil-cisco@xs4all.nl>2019-02-07 06:49:43 -0500
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>2019-02-18 14:46:20 -0500
commit914c68686441c93f6954267dabef6c936ebb479f (patch)
treee61319c90b987128ebde9c7af9455a2c20fac8f7 /drivers/media/common/videobuf2/videobuf2-core.c
parentf4dd471b5c368c396e8e03a65fec64bced949639 (diff)
downloadlinux-914c68686441c93f6954267dabef6c936ebb479f.tar.bz2
media: vb2: 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 vb2_core_poll() and vb2_poll(). Fix this, otherwise epoll() would timeout when it shouldn't. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Reported-by: Yi Qingliang <niqingliang2003@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'drivers/media/common/videobuf2/videobuf2-core.c')
-rw-r--r--drivers/media/common/videobuf2/videobuf2-core.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/media/common/videobuf2/videobuf2-core.c b/drivers/media/common/videobuf2/videobuf2-core.c
index 275cddd8808c..15b6b9c0a2e4 100644
--- a/drivers/media/common/videobuf2/videobuf2-core.c
+++ b/drivers/media/common/videobuf2/videobuf2-core.c
@@ -2291,6 +2291,8 @@ __poll_t vb2_core_poll(struct vb2_queue *q, struct file *file,
if (q->is_output && !(req_events & (EPOLLOUT | EPOLLWRNORM)))
return 0;
+ poll_wait(file, &q->done_wq, wait);
+
/*
* Start file I/O emulator only if streaming API has not been used yet.
*/
@@ -2342,8 +2344,6 @@ __poll_t vb2_core_poll(struct vb2_queue *q, struct file *file,
*/
if (q->last_buffer_dequeued)
return EPOLLIN | EPOLLRDNORM;
-
- poll_wait(file, &q->done_wq, wait);
}
/*