From: Hans Verkuil Date: Wed, 30 Jan 2013 16:29:02 +0000 (-0300) Subject: [media] videobuf2: don't return POLLERR when only polling for events X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=cd13823f5db3e66552801c04f0e761408ef17eb0;p=linux-beck.git [media] videobuf2: don't return POLLERR when only polling for events If you only poll for events, then vb2_poll will return POLLPRI | POLLERR if no streaming is in progress. That's not right, it's perfectly valid to poll just for events. Cc: Pawel Osciak Cc: Marek Szyprowski Cc: Kyungmin Park Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c index d09be38dd377..db1235dcb328 100644 --- a/drivers/media/v4l2-core/videobuf2-core.c +++ b/drivers/media/v4l2-core/videobuf2-core.c @@ -1965,6 +1965,11 @@ unsigned int vb2_poll(struct vb2_queue *q, struct file *file, poll_table *wait) poll_wait(file, &fh->wait, wait); } + if (!V4L2_TYPE_IS_OUTPUT(q->type) && !(req_events & (POLLIN | POLLRDNORM))) + return res; + if (V4L2_TYPE_IS_OUTPUT(q->type) && !(req_events & (POLLOUT | POLLWRNORM))) + return res; + /* * Start file I/O emulator only if streaming API has not been used yet. */