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-Tag: v3.9-rc5~2^2~123 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cd13823f5db3e66552801c04f0e761408ef17eb0;p=platform%2Fupstream%2Fkernel-adaptation-pc.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 d09be38..db1235d 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. */