OSDN Git Service

V4L/DVB: uvcvideo: Use POLLOUT and POLLWRNORM for output devices
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Wed, 31 Mar 2010 15:29:26 +0000 (12:29 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Tue, 18 May 2010 03:52:52 +0000 (00:52 -0300)
The V4L2 specification requires drivers to use the write events in the
file operations poll handler for output devices. The uvcvideo driver
erroneously used read events for all devices. Fix this.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/uvc/uvc_queue.c

index 4a925a3..133c78d 100644 (file)
@@ -388,8 +388,12 @@ unsigned int uvc_queue_poll(struct uvc_video_queue *queue, struct file *file,
 
        poll_wait(file, &buf->wait, wait);
        if (buf->state == UVC_BUF_STATE_DONE ||
-           buf->state == UVC_BUF_STATE_ERROR)
-               mask |= POLLIN | POLLRDNORM;
+           buf->state == UVC_BUF_STATE_ERROR) {
+               if (queue->type == V4L2_BUF_TYPE_VIDEO_CAPTURE)
+                       mask |= POLLIN | POLLRDNORM;
+               else
+                       mask |= POLLOUT | POLLWRNORM;
+       }
 
 done:
        mutex_unlock(&queue->mutex);