V4L/DVB: videobuf: make poll() report proper flags for output video devices
authorPawel Osciak <p.osciak@samsung.com>
Mon, 29 Mar 2010 08:16:31 +0000 (05:16 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Wed, 19 May 2010 15:58:40 +0000 (12:58 -0300)
According to the V4L2 specification, poll() should set POLLOUT | POLLWRNORM
flags for output devices after the frame has been displayed.

Signed-off-by: Pawel Osciak <p.osciak@samsung.com>
Reviewed-by: Kyungmin Park <kyungmin.park@samsung.com>
Reviewed-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/videobuf-core.c

index f47cf1ca12393e5e2cd73fde11938a87e58dfb59..7d3378437ded6f6a95093c461ed345bf0f393ad8 100644 (file)
@@ -1120,8 +1120,18 @@ 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) {
+                       switch (q->type) {
+                       case V4L2_BUF_TYPE_VIDEO_OUTPUT:
+                       case V4L2_BUF_TYPE_VBI_OUTPUT:
+                       case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT:
+                               rc = POLLOUT | POLLWRNORM;
+                               break;
+                       default:
+                               rc = POLLIN | POLLRDNORM;
+                               break;
+                       }
+               }
        }
        mutex_unlock(&q->vb_lock);
        return rc;