aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/bt8xx
diff options
context:
space:
mode:
authorFigo.zhang <figo1802@gmail.com>2009-06-16 12:31:29 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-06-16 18:14:44 -0400
commit9fd6418a6a7655b69cfa0ae27a3639a6d0b2924f (patch)
tree3b3754a6518f7cefb130b314199733daaf831d2b /drivers/media/video/bt8xx
parent1c905a4522a3913cf321365c5bb62eb2f70d55d9 (diff)
V4L/DVB (12004): poll method lose race condition
bttv-driver.c,cx23885-video.c,cx88-video.c: poll method lose race condition for capture video. Signed-off-by: Figo.zhang <figo1802@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/bt8xx')
-rw-r--r--drivers/media/video/bt8xx/bttv-driver.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c
index 7c1f82661ee..5eb1464af67 100644
--- a/drivers/media/video/bt8xx/bttv-driver.c
+++ b/drivers/media/video/bt8xx/bttv-driver.c
@@ -3152,6 +3152,7 @@ static unsigned int bttv_poll(struct file *file, poll_table *wait)
3152 struct bttv_fh *fh = file->private_data; 3152 struct bttv_fh *fh = file->private_data;
3153 struct bttv_buffer *buf; 3153 struct bttv_buffer *buf;
3154 enum v4l2_field field; 3154 enum v4l2_field field;
3155 unsigned int rc = POLLERR;
3155 3156
3156 if (V4L2_BUF_TYPE_VBI_CAPTURE == fh->type) { 3157 if (V4L2_BUF_TYPE_VBI_CAPTURE == fh->type) {
3157 if (!check_alloc_btres(fh->btv,fh,RESOURCE_VBI)) 3158 if (!check_alloc_btres(fh->btv,fh,RESOURCE_VBI))
@@ -3160,9 +3161,10 @@ static unsigned int bttv_poll(struct file *file, poll_table *wait)
3160 } 3161 }
3161 3162
3162 if (check_btres(fh,RESOURCE_VIDEO_STREAM)) { 3163 if (check_btres(fh,RESOURCE_VIDEO_STREAM)) {
3164 mutex_lock(&fh->cap.vb_lock);
3163 /* streaming capture */ 3165 /* streaming capture */
3164 if (list_empty(&fh->cap.stream)) 3166 if (list_empty(&fh->cap.stream))
3165 return POLLERR; 3167 goto err;
3166 buf = list_entry(fh->cap.stream.next,struct bttv_buffer,vb.stream); 3168 buf = list_entry(fh->cap.stream.next,struct bttv_buffer,vb.stream);
3167 } else { 3169 } else {
3168 /* read() capture */ 3170 /* read() capture */
@@ -3191,11 +3193,12 @@ static unsigned int bttv_poll(struct file *file, poll_table *wait)
3191 poll_wait(file, &buf->vb.done, wait); 3193 poll_wait(file, &buf->vb.done, wait);
3192 if (buf->vb.state == VIDEOBUF_DONE || 3194 if (buf->vb.state == VIDEOBUF_DONE ||
3193 buf->vb.state == VIDEOBUF_ERROR) 3195 buf->vb.state == VIDEOBUF_ERROR)
3194 return POLLIN|POLLRDNORM; 3196 rc = POLLIN|POLLRDNORM;
3195 return 0; 3197 else
3198 rc = 0;
3196err: 3199err:
3197 mutex_unlock(&fh->cap.vb_lock); 3200 mutex_unlock(&fh->cap.vb_lock);
3198 return POLLERR; 3201 return rc;
3199} 3202}
3200 3203
3201static int bttv_open(struct file *file) 3204static int bttv_open(struct file *file)