|
@@ -796,6 +796,7 @@ static unsigned int video_poll(struct file *file,
|
|
|
{
|
|
|
struct cx23885_fh *fh = file->private_data;
|
|
|
struct cx23885_buffer *buf;
|
|
|
+ unsigned int rc = POLLERR;
|
|
|
|
|
|
if (V4L2_BUF_TYPE_VBI_CAPTURE == fh->type) {
|
|
|
if (!res_get(fh->dev, fh, RESOURCE_VBI))
|
|
@@ -803,23 +804,28 @@ static unsigned int video_poll(struct file *file,
|
|
|
return videobuf_poll_stream(file, &fh->vbiq, wait);
|
|
|
}
|
|
|
|
|
|
+ mutex_lock(&fh->vidq.vb_lock);
|
|
|
if (res_check(fh, RESOURCE_VIDEO)) {
|
|
|
/* streaming capture */
|
|
|
if (list_empty(&fh->vidq.stream))
|
|
|
- return POLLERR;
|
|
|
+ goto done;
|
|
|
buf = list_entry(fh->vidq.stream.next,
|
|
|
struct cx23885_buffer, vb.stream);
|
|
|
} else {
|
|
|
/* read() capture */
|
|
|
buf = (struct cx23885_buffer *)fh->vidq.read_buf;
|
|
|
if (NULL == buf)
|
|
|
- return POLLERR;
|
|
|
+ goto done;
|
|
|
}
|
|
|
poll_wait(file, &buf->vb.done, wait);
|
|
|
if (buf->vb.state == VIDEOBUF_DONE ||
|
|
|
buf->vb.state == VIDEOBUF_ERROR)
|
|
|
- return POLLIN|POLLRDNORM;
|
|
|
- return 0;
|
|
|
+ rc = POLLIN|POLLRDNORM;
|
|
|
+ else
|
|
|
+ rc = 0;
|
|
|
+done:
|
|
|
+ mutex_unlock(&fh->vidq.vb_lock);
|
|
|
+ return rc;
|
|
|
}
|
|
|
|
|
|
static int video_release(struct file *file)
|