Commit bb436cbe authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

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: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent 96ebc0ca
...@@ -1119,13 +1119,14 @@ ssize_t videobuf_read_stream(struct videobuf_queue *q, ...@@ -1119,13 +1119,14 @@ ssize_t videobuf_read_stream(struct videobuf_queue *q,
EXPORT_SYMBOL_GPL(videobuf_read_stream); EXPORT_SYMBOL_GPL(videobuf_read_stream);
__poll_t videobuf_poll_stream(struct file *file, __poll_t videobuf_poll_stream(struct file *file,
struct videobuf_queue *q, struct videobuf_queue *q,
poll_table *wait) poll_table *wait)
{ {
__poll_t req_events = poll_requested_events(wait); __poll_t req_events = poll_requested_events(wait);
struct videobuf_buffer *buf = NULL; struct videobuf_buffer *buf = NULL;
__poll_t rc = 0; __poll_t rc = 0;
poll_wait(file, &buf->done, wait);
videobuf_queue_lock(q); videobuf_queue_lock(q);
if (q->streaming) { if (q->streaming) {
if (!list_empty(&q->stream)) if (!list_empty(&q->stream))
...@@ -1149,7 +1150,6 @@ __poll_t videobuf_poll_stream(struct file *file, ...@@ -1149,7 +1150,6 @@ __poll_t videobuf_poll_stream(struct file *file,
rc = EPOLLERR; rc = EPOLLERR;
if (0 == rc) { if (0 == rc) {
poll_wait(file, &buf->done, wait);
if (buf->state == VIDEOBUF_DONE || if (buf->state == VIDEOBUF_DONE ||
buf->state == VIDEOBUF_ERROR) { buf->state == VIDEOBUF_ERROR) {
switch (q->type) { switch (q->type) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment