media: dvb-core: 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 dvb_demux_poll(), dvb_dvr_poll() and dvb_ca_en50221_io_poll(). Fix this, otherwise epoll() can timeout when it shouldn't. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Reviewed-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
This commit is contained in:
Родитель
bb436cbeb9
Коммит
c6f5c7c237
|
@ -1195,13 +1195,13 @@ static __poll_t dvb_demux_poll(struct file *file, poll_table *wait)
|
|||
struct dmxdev_filter *dmxdevfilter = file->private_data;
|
||||
__poll_t mask = 0;
|
||||
|
||||
poll_wait(file, &dmxdevfilter->buffer.queue, wait);
|
||||
|
||||
if ((!dmxdevfilter) || dmxdevfilter->dev->exit)
|
||||
return EPOLLERR;
|
||||
if (dvb_vb2_is_streaming(&dmxdevfilter->vb2_ctx))
|
||||
return dvb_vb2_poll(&dmxdevfilter->vb2_ctx, file, wait);
|
||||
|
||||
poll_wait(file, &dmxdevfilter->buffer.queue, wait);
|
||||
|
||||
if (dmxdevfilter->state != DMXDEV_STATE_GO &&
|
||||
dmxdevfilter->state != DMXDEV_STATE_DONE &&
|
||||
dmxdevfilter->state != DMXDEV_STATE_TIMEDOUT)
|
||||
|
@ -1346,13 +1346,13 @@ static __poll_t dvb_dvr_poll(struct file *file, poll_table *wait)
|
|||
|
||||
dprintk("%s\n", __func__);
|
||||
|
||||
poll_wait(file, &dmxdev->dvr_buffer.queue, wait);
|
||||
|
||||
if (dmxdev->exit)
|
||||
return EPOLLERR;
|
||||
if (dvb_vb2_is_streaming(&dmxdev->dvr_vb2_ctx))
|
||||
return dvb_vb2_poll(&dmxdev->dvr_vb2_ctx, file, wait);
|
||||
|
||||
poll_wait(file, &dmxdev->dvr_buffer.queue, wait);
|
||||
|
||||
if (((file->f_flags & O_ACCMODE) == O_RDONLY) ||
|
||||
dmxdev->may_do_mmap) {
|
||||
if (dmxdev->dvr_buffer.error)
|
||||
|
|
|
@ -1797,6 +1797,8 @@ static __poll_t dvb_ca_en50221_io_poll(struct file *file, poll_table *wait)
|
|||
|
||||
dprintk("%s\n", __func__);
|
||||
|
||||
poll_wait(file, &ca->wait_queue, wait);
|
||||
|
||||
if (dvb_ca_en50221_io_read_condition(ca, &result, &slot) == 1)
|
||||
mask |= EPOLLIN;
|
||||
|
||||
|
@ -1804,9 +1806,6 @@ static __poll_t dvb_ca_en50221_io_poll(struct file *file, poll_table *wait)
|
|||
if (mask)
|
||||
return mask;
|
||||
|
||||
/* wait for something to happen */
|
||||
poll_wait(file, &ca->wait_queue, wait);
|
||||
|
||||
if (dvb_ca_en50221_io_read_condition(ca, &result, &slot) == 1)
|
||||
mask |= EPOLLIN;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче