LinuxTV Patchwork [RFC,4/8] v4l2-ctrls.c: fix epoll() by calling poll_wait first

login
register
mail settings
Submitter Hans Verkuil
Date Feb. 7, 2019, 11:49 a.m.
Message ID <20190207114948.37750-5-hverkuil-cisco@xs4all.nl>
Download mbox | patch
Permalink /patch/54364/
State Accepted
Delegated to: Hans Verkuil
Headers show

Comments

Hans Verkuil - Feb. 7, 2019, 11:49 a.m.
From: Hans Verkuil <hverkuil-cisco@xs4all.nl>

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 v4l2_ctrl_poll(). Fix this, otherwise epoll()
would timeout when it shouldn't.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
---
 drivers/media/v4l2-core/v4l2-ctrls.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch

diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c
index 99308dac2daa..b79d3bbd8350 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls.c
@@ -4166,9 +4166,9 @@  __poll_t v4l2_ctrl_poll(struct file *file, struct poll_table_struct *wait)
 {
 	struct v4l2_fh *fh = file->private_data;
 
+	poll_wait(file, &fh->wait, wait);
 	if (v4l2_event_pending(fh))
 		return EPOLLPRI;
-	poll_wait(file, &fh->wait, wait);
 	return 0;
 }
 EXPORT_SYMBOL(v4l2_ctrl_poll);

Privacy Policy