diff options
Diffstat (limited to 'drivers/media/video/cx23885/cx23885-video.c')
| -rw-r--r-- | drivers/media/video/cx23885/cx23885-video.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/media/video/cx23885/cx23885-video.c b/drivers/media/video/cx23885/cx23885-video.c index 68068c6d0987..66bbd2e71105 100644 --- a/drivers/media/video/cx23885/cx23885-video.c +++ b/drivers/media/video/cx23885/cx23885-video.c | |||
| @@ -796,6 +796,7 @@ static unsigned int video_poll(struct file *file, | |||
| 796 | { | 796 | { |
| 797 | struct cx23885_fh *fh = file->private_data; | 797 | struct cx23885_fh *fh = file->private_data; |
| 798 | struct cx23885_buffer *buf; | 798 | struct cx23885_buffer *buf; |
| 799 | unsigned int rc = POLLERR; | ||
| 799 | 800 | ||
| 800 | if (V4L2_BUF_TYPE_VBI_CAPTURE == fh->type) { | 801 | if (V4L2_BUF_TYPE_VBI_CAPTURE == fh->type) { |
| 801 | if (!res_get(fh->dev, fh, RESOURCE_VBI)) | 802 | if (!res_get(fh->dev, fh, RESOURCE_VBI)) |
| @@ -803,23 +804,28 @@ static unsigned int video_poll(struct file *file, | |||
| 803 | return videobuf_poll_stream(file, &fh->vbiq, wait); | 804 | return videobuf_poll_stream(file, &fh->vbiq, wait); |
| 804 | } | 805 | } |
| 805 | 806 | ||
| 807 | mutex_lock(&fh->vidq.vb_lock); | ||
| 806 | if (res_check(fh, RESOURCE_VIDEO)) { | 808 | if (res_check(fh, RESOURCE_VIDEO)) { |
| 807 | /* streaming capture */ | 809 | /* streaming capture */ |
| 808 | if (list_empty(&fh->vidq.stream)) | 810 | if (list_empty(&fh->vidq.stream)) |
| 809 | return POLLERR; | 811 | goto done; |
| 810 | buf = list_entry(fh->vidq.stream.next, | 812 | buf = list_entry(fh->vidq.stream.next, |
| 811 | struct cx23885_buffer, vb.stream); | 813 | struct cx23885_buffer, vb.stream); |
| 812 | } else { | 814 | } else { |
| 813 | /* read() capture */ | 815 | /* read() capture */ |
| 814 | buf = (struct cx23885_buffer *)fh->vidq.read_buf; | 816 | buf = (struct cx23885_buffer *)fh->vidq.read_buf; |
| 815 | if (NULL == buf) | 817 | if (NULL == buf) |
| 816 | return POLLERR; | 818 | goto done; |
| 817 | } | 819 | } |
| 818 | poll_wait(file, &buf->vb.done, wait); | 820 | poll_wait(file, &buf->vb.done, wait); |
| 819 | if (buf->vb.state == VIDEOBUF_DONE || | 821 | if (buf->vb.state == VIDEOBUF_DONE || |
| 820 | buf->vb.state == VIDEOBUF_ERROR) | 822 | buf->vb.state == VIDEOBUF_ERROR) |
| 821 | return POLLIN|POLLRDNORM; | 823 | rc = POLLIN|POLLRDNORM; |
| 822 | return 0; | 824 | else |
| 825 | rc = 0; | ||
| 826 | done: | ||
| 827 | mutex_unlock(&fh->vidq.vb_lock); | ||
| 828 | return rc; | ||
| 823 | } | 829 | } |
| 824 | 830 | ||
| 825 | static int video_release(struct file *file) | 831 | static int video_release(struct file *file) |
