diff options
Diffstat (limited to 'drivers/media/video/cx88/cx88-video.c')
-rw-r--r-- | drivers/media/video/cx88/cx88-video.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c index b993d42fe73c..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; | ||
898 | done: | ||
899 | mutex_unlock(&fh->vidq.vb_lock); | ||
900 | return rc; | ||
895 | } | 901 | } |
896 | 902 | ||
897 | static int video_release(struct file *file) | 903 | static int video_release(struct file *file) |
@@ -926,8 +932,10 @@ static int video_release(struct file *file) | |||
926 | file->private_data = NULL; | 932 | file->private_data = NULL; |
927 | kfree(fh); | 933 | kfree(fh); |
928 | 934 | ||
935 | mutex_lock(&dev->core->lock); | ||
929 | if(atomic_dec_and_test(&dev->core->users)) | 936 | if(atomic_dec_and_test(&dev->core->users)) |
930 | call_all(dev->core, tuner, s_standby); | 937 | call_all(dev->core, tuner, s_standby); |
938 | mutex_unlock(&dev->core->lock); | ||
931 | 939 | ||
932 | return 0; | 940 | return 0; |
933 | } | 941 | } |