aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx88/cx88-video.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/cx88/cx88-video.c')
-rw-r--r--drivers/media/video/cx88/cx88-video.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c
index d6d6d13a6a6b..0ccac702bea4 100644
--- a/drivers/media/video/cx88/cx88-video.c
+++ b/drivers/media/video/cx88/cx88-video.c
@@ -869,6 +869,7 @@ video_poll(struct file *file, struct poll_table_struct *wait)
869{ 869{
870 struct cx8800_fh *fh = file->private_data; 870 struct cx8800_fh *fh = file->private_data;
871 struct cx88_buffer *buf; 871 struct cx88_buffer *buf;
872 unsigned int rc = POLLERR;
872 873
873 if (V4L2_BUF_TYPE_VBI_CAPTURE == fh->type) { 874 if (V4L2_BUF_TYPE_VBI_CAPTURE == fh->type) {
874 if (!res_get(fh->dev,fh,RESOURCE_VBI)) 875 if (!res_get(fh->dev,fh,RESOURCE_VBI))
@@ -876,22 +877,27 @@ video_poll(struct file *file, struct poll_table_struct *wait)
876 return videobuf_poll_stream(file, &fh->vbiq, wait); 877 return videobuf_poll_stream(file, &fh->vbiq, wait);
877 } 878 }
878 879
880 mutex_lock(&fh->vidq.vb_lock);
879 if (res_check(fh,RESOURCE_VIDEO)) { 881 if (res_check(fh,RESOURCE_VIDEO)) {
880 /* streaming capture */ 882 /* streaming capture */
881 if (list_empty(&fh->vidq.stream)) 883 if (list_empty(&fh->vidq.stream))
882 return POLLERR; 884 goto done;
883 buf = list_entry(fh->vidq.stream.next,struct cx88_buffer,vb.stream); 885 buf = list_entry(fh->vidq.stream.next,struct cx88_buffer,vb.stream);
884 } else { 886 } else {
885 /* read() capture */ 887 /* read() capture */
886 buf = (struct cx88_buffer*)fh->vidq.read_buf; 888 buf = (struct cx88_buffer*)fh->vidq.read_buf;
887 if (NULL == buf) 889 if (NULL == buf)
888 return POLLERR; 890 goto done;
889 } 891 }
890 poll_wait(file, &buf->vb.done, wait); 892 poll_wait(file, &buf->vb.done, wait);
891 if (buf->vb.state == VIDEOBUF_DONE || 893 if (buf->vb.state == VIDEOBUF_DONE ||
892 buf->vb.state == VIDEOBUF_ERROR) 894 buf->vb.state == VIDEOBUF_ERROR)
893 return POLLIN|POLLRDNORM; 895 rc = POLLIN|POLLRDNORM;
894 return 0; 896 else
897 rc = 0;
898done:
899 mutex_unlock(&fh->vidq.vb_lock);
900 return rc;
895} 901}
896 902
897static int video_release(struct file *file) 903static int video_release(struct file *file)