diff options
Diffstat (limited to 'drivers/media/video/bt8xx')
-rw-r--r-- | drivers/media/video/bt8xx/bttv-driver.c | 50 | ||||
-rw-r--r-- | drivers/media/video/bt8xx/bttv-vbi.c | 4 |
2 files changed, 26 insertions, 28 deletions
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c index 907dc62c1783..d9ce9a48ef59 100644 --- a/drivers/media/video/bt8xx/bttv-driver.c +++ b/drivers/media/video/bt8xx/bttv-driver.c | |||
@@ -2354,8 +2354,8 @@ static int setup_window(struct bttv_fh *fh, struct bttv *btv, | |||
2354 | BUG(); | 2354 | BUG(); |
2355 | } | 2355 | } |
2356 | 2356 | ||
2357 | mutex_lock(&fh->cap.lock); | 2357 | mutex_lock(&fh->cap.vb_lock); |
2358 | kfree(fh->ov.clips); | 2358 | kfree(fh->ov.clips); |
2359 | fh->ov.clips = clips; | 2359 | fh->ov.clips = clips; |
2360 | fh->ov.nclips = n; | 2360 | fh->ov.nclips = n; |
2361 | 2361 | ||
@@ -2376,7 +2376,7 @@ static int setup_window(struct bttv_fh *fh, struct bttv *btv, | |||
2376 | bttv_overlay_risc(btv, &fh->ov, fh->ovfmt, new); | 2376 | bttv_overlay_risc(btv, &fh->ov, fh->ovfmt, new); |
2377 | retval = bttv_switch_overlay(btv,fh,new); | 2377 | retval = bttv_switch_overlay(btv,fh,new); |
2378 | } | 2378 | } |
2379 | mutex_unlock(&fh->cap.lock); | 2379 | mutex_unlock(&fh->cap.vb_lock); |
2380 | return retval; | 2380 | return retval; |
2381 | } | 2381 | } |
2382 | 2382 | ||
@@ -2576,7 +2576,7 @@ static int bttv_s_fmt_cap(struct file *file, void *priv, | |||
2576 | fmt = format_by_fourcc(f->fmt.pix.pixelformat); | 2576 | fmt = format_by_fourcc(f->fmt.pix.pixelformat); |
2577 | 2577 | ||
2578 | /* update our state informations */ | 2578 | /* update our state informations */ |
2579 | mutex_lock(&fh->cap.lock); | 2579 | mutex_lock(&fh->cap.vb_lock); |
2580 | fh->fmt = fmt; | 2580 | fh->fmt = fmt; |
2581 | fh->cap.field = f->fmt.pix.field; | 2581 | fh->cap.field = f->fmt.pix.field; |
2582 | fh->cap.last = V4L2_FIELD_NONE; | 2582 | fh->cap.last = V4L2_FIELD_NONE; |
@@ -2585,7 +2585,7 @@ static int bttv_s_fmt_cap(struct file *file, void *priv, | |||
2585 | btv->init.fmt = fmt; | 2585 | btv->init.fmt = fmt; |
2586 | btv->init.width = f->fmt.pix.width; | 2586 | btv->init.width = f->fmt.pix.width; |
2587 | btv->init.height = f->fmt.pix.height; | 2587 | btv->init.height = f->fmt.pix.height; |
2588 | mutex_unlock(&fh->cap.lock); | 2588 | mutex_unlock(&fh->cap.vb_lock); |
2589 | 2589 | ||
2590 | return 0; | 2590 | return 0; |
2591 | } | 2591 | } |
@@ -2611,11 +2611,11 @@ static int vidiocgmbuf(struct file *file, void *priv, struct video_mbuf *mbuf) | |||
2611 | unsigned int i; | 2611 | unsigned int i; |
2612 | struct bttv_fh *fh = priv; | 2612 | struct bttv_fh *fh = priv; |
2613 | 2613 | ||
2614 | mutex_lock(&fh->cap.lock); | 2614 | mutex_lock(&fh->cap.vb_lock); |
2615 | retval = videobuf_mmap_setup(&fh->cap, gbuffers, gbufsize, | 2615 | retval = videobuf_mmap_setup(&fh->cap, gbuffers, gbufsize, |
2616 | V4L2_MEMORY_MMAP); | 2616 | V4L2_MEMORY_MMAP); |
2617 | if (retval < 0) { | 2617 | if (retval < 0) { |
2618 | mutex_unlock(&fh->cap.lock); | 2618 | mutex_unlock(&fh->cap.vb_lock); |
2619 | return retval; | 2619 | return retval; |
2620 | } | 2620 | } |
2621 | 2621 | ||
@@ -2627,7 +2627,7 @@ static int vidiocgmbuf(struct file *file, void *priv, struct video_mbuf *mbuf) | |||
2627 | for (i = 0; i < gbuffers; i++) | 2627 | for (i = 0; i < gbuffers; i++) |
2628 | mbuf->offsets[i] = i * gbufsize; | 2628 | mbuf->offsets[i] = i * gbufsize; |
2629 | 2629 | ||
2630 | mutex_unlock(&fh->cap.lock); | 2630 | mutex_unlock(&fh->cap.vb_lock); |
2631 | return 0; | 2631 | return 0; |
2632 | } | 2632 | } |
2633 | #endif | 2633 | #endif |
@@ -2756,7 +2756,7 @@ static int bttv_overlay(struct file *file, void *f, unsigned int on) | |||
2756 | if (!check_alloc_btres(btv, fh, RESOURCE_OVERLAY)) | 2756 | if (!check_alloc_btres(btv, fh, RESOURCE_OVERLAY)) |
2757 | return -EBUSY; | 2757 | return -EBUSY; |
2758 | 2758 | ||
2759 | mutex_lock(&fh->cap.lock); | 2759 | mutex_lock(&fh->cap.vb_lock); |
2760 | if (on) { | 2760 | if (on) { |
2761 | fh->ov.tvnorm = btv->tvnorm; | 2761 | fh->ov.tvnorm = btv->tvnorm; |
2762 | new = videobuf_pci_alloc(sizeof(*new)); | 2762 | new = videobuf_pci_alloc(sizeof(*new)); |
@@ -2767,7 +2767,7 @@ static int bttv_overlay(struct file *file, void *f, unsigned int on) | |||
2767 | 2767 | ||
2768 | /* switch over */ | 2768 | /* switch over */ |
2769 | retval = bttv_switch_overlay(btv, fh, new); | 2769 | retval = bttv_switch_overlay(btv, fh, new); |
2770 | mutex_unlock(&fh->cap.lock); | 2770 | mutex_unlock(&fh->cap.vb_lock); |
2771 | return retval; | 2771 | return retval; |
2772 | } | 2772 | } |
2773 | 2773 | ||
@@ -2806,7 +2806,7 @@ static int bttv_s_fbuf(struct file *file, void *f, | |||
2806 | } | 2806 | } |
2807 | 2807 | ||
2808 | /* ok, accept it */ | 2808 | /* ok, accept it */ |
2809 | mutex_lock(&fh->cap.lock); | 2809 | mutex_lock(&fh->cap.vb_lock); |
2810 | btv->fbuf.base = fb->base; | 2810 | btv->fbuf.base = fb->base; |
2811 | btv->fbuf.fmt.width = fb->fmt.width; | 2811 | btv->fbuf.fmt.width = fb->fmt.width; |
2812 | btv->fbuf.fmt.height = fb->fmt.height; | 2812 | btv->fbuf.fmt.height = fb->fmt.height; |
@@ -2838,7 +2838,7 @@ static int bttv_s_fbuf(struct file *file, void *f, | |||
2838 | retval = bttv_switch_overlay(btv, fh, new); | 2838 | retval = bttv_switch_overlay(btv, fh, new); |
2839 | } | 2839 | } |
2840 | } | 2840 | } |
2841 | mutex_unlock(&fh->cap.lock); | 2841 | mutex_unlock(&fh->cap.vb_lock); |
2842 | return retval; | 2842 | return retval; |
2843 | } | 2843 | } |
2844 | 2844 | ||
@@ -3090,7 +3090,7 @@ static int bttv_s_crop(struct file *file, void *f, struct v4l2_crop *crop) | |||
3090 | 3090 | ||
3091 | fh->do_crop = 1; | 3091 | fh->do_crop = 1; |
3092 | 3092 | ||
3093 | mutex_lock(&fh->cap.lock); | 3093 | mutex_lock(&fh->cap.vb_lock); |
3094 | 3094 | ||
3095 | if (fh->width < c.min_scaled_width) { | 3095 | if (fh->width < c.min_scaled_width) { |
3096 | fh->width = c.min_scaled_width; | 3096 | fh->width = c.min_scaled_width; |
@@ -3108,7 +3108,7 @@ static int bttv_s_crop(struct file *file, void *f, struct v4l2_crop *crop) | |||
3108 | btv->init.height = c.max_scaled_height; | 3108 | btv->init.height = c.max_scaled_height; |
3109 | } | 3109 | } |
3110 | 3110 | ||
3111 | mutex_unlock(&fh->cap.lock); | 3111 | mutex_unlock(&fh->cap.vb_lock); |
3112 | 3112 | ||
3113 | return 0; | 3113 | return 0; |
3114 | } | 3114 | } |
@@ -3177,30 +3177,25 @@ static unsigned int bttv_poll(struct file *file, poll_table *wait) | |||
3177 | buf = list_entry(fh->cap.stream.next,struct bttv_buffer,vb.stream); | 3177 | buf = list_entry(fh->cap.stream.next,struct bttv_buffer,vb.stream); |
3178 | } else { | 3178 | } else { |
3179 | /* read() capture */ | 3179 | /* read() capture */ |
3180 | mutex_lock(&fh->cap.lock); | 3180 | mutex_lock(&fh->cap.vb_lock); |
3181 | if (NULL == fh->cap.read_buf) { | 3181 | if (NULL == fh->cap.read_buf) { |
3182 | /* need to capture a new frame */ | 3182 | /* need to capture a new frame */ |
3183 | if (locked_btres(fh->btv,RESOURCE_VIDEO_STREAM)) { | 3183 | if (locked_btres(fh->btv,RESOURCE_VIDEO_STREAM)) |
3184 | mutex_unlock(&fh->cap.lock); | 3184 | goto err; |
3185 | return POLLERR; | ||
3186 | } | ||
3187 | fh->cap.read_buf = videobuf_pci_alloc(fh->cap.msize); | 3185 | fh->cap.read_buf = videobuf_pci_alloc(fh->cap.msize); |
3188 | if (NULL == fh->cap.read_buf) { | 3186 | if (NULL == fh->cap.read_buf) |
3189 | mutex_unlock(&fh->cap.lock); | 3187 | goto err; |
3190 | return POLLERR; | ||
3191 | } | ||
3192 | fh->cap.read_buf->memory = V4L2_MEMORY_USERPTR; | 3188 | fh->cap.read_buf->memory = V4L2_MEMORY_USERPTR; |
3193 | field = videobuf_next_field(&fh->cap); | 3189 | field = videobuf_next_field(&fh->cap); |
3194 | if (0 != fh->cap.ops->buf_prepare(&fh->cap,fh->cap.read_buf,field)) { | 3190 | if (0 != fh->cap.ops->buf_prepare(&fh->cap,fh->cap.read_buf,field)) { |
3195 | kfree (fh->cap.read_buf); | 3191 | kfree (fh->cap.read_buf); |
3196 | fh->cap.read_buf = NULL; | 3192 | fh->cap.read_buf = NULL; |
3197 | mutex_unlock(&fh->cap.lock); | 3193 | goto err; |
3198 | return POLLERR; | ||
3199 | } | 3194 | } |
3200 | fh->cap.ops->buf_queue(&fh->cap,fh->cap.read_buf); | 3195 | fh->cap.ops->buf_queue(&fh->cap,fh->cap.read_buf); |
3201 | fh->cap.read_off = 0; | 3196 | fh->cap.read_off = 0; |
3202 | } | 3197 | } |
3203 | mutex_unlock(&fh->cap.lock); | 3198 | mutex_unlock(&fh->cap.vb_lock); |
3204 | buf = (struct bttv_buffer*)fh->cap.read_buf; | 3199 | buf = (struct bttv_buffer*)fh->cap.read_buf; |
3205 | } | 3200 | } |
3206 | 3201 | ||
@@ -3209,6 +3204,9 @@ static unsigned int bttv_poll(struct file *file, poll_table *wait) | |||
3209 | buf->vb.state == VIDEOBUF_ERROR) | 3204 | buf->vb.state == VIDEOBUF_ERROR) |
3210 | return POLLIN|POLLRDNORM; | 3205 | return POLLIN|POLLRDNORM; |
3211 | return 0; | 3206 | return 0; |
3207 | err: | ||
3208 | mutex_unlock(&fh->cap.vb_lock); | ||
3209 | return POLLERR; | ||
3212 | } | 3210 | } |
3213 | 3211 | ||
3214 | static int bttv_open(struct inode *inode, struct file *file) | 3212 | static int bttv_open(struct inode *inode, struct file *file) |
diff --git a/drivers/media/video/bt8xx/bttv-vbi.c b/drivers/media/video/bt8xx/bttv-vbi.c index 1f0cc79e2a33..75fa82c7c735 100644 --- a/drivers/media/video/bt8xx/bttv-vbi.c +++ b/drivers/media/video/bt8xx/bttv-vbi.c | |||
@@ -352,13 +352,13 @@ int bttv_s_fmt_vbi(struct file *file, void *f, struct v4l2_format *frt) | |||
352 | because vbi_fmt.end counts field lines times two. */ | 352 | because vbi_fmt.end counts field lines times two. */ |
353 | end = max(frt->fmt.vbi.start[0], start1) * 2 + 2; | 353 | end = max(frt->fmt.vbi.start[0], start1) * 2 + 2; |
354 | 354 | ||
355 | mutex_lock(&fh->vbi.lock); | 355 | mutex_lock(&fh->vbi.vb_lock); |
356 | 356 | ||
357 | fh->vbi_fmt.fmt = frt->fmt.vbi; | 357 | fh->vbi_fmt.fmt = frt->fmt.vbi; |
358 | fh->vbi_fmt.tvnorm = tvnorm; | 358 | fh->vbi_fmt.tvnorm = tvnorm; |
359 | fh->vbi_fmt.end = end; | 359 | fh->vbi_fmt.end = end; |
360 | 360 | ||
361 | mutex_unlock(&fh->vbi.lock); | 361 | mutex_unlock(&fh->vbi.vb_lock); |
362 | 362 | ||
363 | rc = 0; | 363 | rc = 0; |
364 | 364 | ||