diff mbox

v4l: videobuf: make poll() report proper flags for output video devices

Message ID 1268834402-31355-1-git-send-email-p.osciak@samsung.com (mailing list archive)
State Rejected
Headers show

Commit Message

Pawel Osciak March 17, 2010, 2 p.m. UTC
None
diff mbox

Patch

diff --git a/drivers/media/video/videobuf-core.c b/drivers/media/video/videobuf-core.c
index 37afb4e..e93672a 100644
--- a/drivers/media/video/videobuf-core.c
+++ b/drivers/media/video/videobuf-core.c
@@ -1075,8 +1075,14 @@  unsigned int videobuf_poll_stream(struct file *file,
 	if (0 == rc) {
 		poll_wait(file, &buf->done, wait);
 		if (buf->state == VIDEOBUF_DONE ||
-		    buf->state == VIDEOBUF_ERROR)
-			rc = POLLIN|POLLRDNORM;
+		    buf->state == VIDEOBUF_ERROR) {
+			if (q->type == V4L2_BUF_TYPE_VIDEO_CAPTURE)
+				rc = POLLIN | POLLRDNORM;
+			else if (q->type == V4L2_BUF_TYPE_VIDEO_OUTPUT)
+				rc = POLLOUT | POLLWRNORM;
+			else
+				BUG();
+		}
 	}
 	mutex_unlock(&q->vb_lock);
 	return rc;