diff options
Diffstat (limited to 'drivers/media/video/bttv-driver.c')
-rw-r--r-- | drivers/media/video/bttv-driver.c | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/drivers/media/video/bttv-driver.c b/drivers/media/video/bttv-driver.c index 578b20085082..c0415d6e7fee 100644 --- a/drivers/media/video/bttv-driver.c +++ b/drivers/media/video/bttv-driver.c | |||
@@ -1965,7 +1965,7 @@ static int setup_window(struct bttv_fh *fh, struct bttv *btv, | |||
1965 | BUG(); | 1965 | BUG(); |
1966 | } | 1966 | } |
1967 | 1967 | ||
1968 | down(&fh->cap.lock); | 1968 | mutex_lock(&fh->cap.lock); |
1969 | kfree(fh->ov.clips); | 1969 | kfree(fh->ov.clips); |
1970 | fh->ov.clips = clips; | 1970 | fh->ov.clips = clips; |
1971 | fh->ov.nclips = n; | 1971 | fh->ov.nclips = n; |
@@ -1986,7 +1986,7 @@ static int setup_window(struct bttv_fh *fh, struct bttv *btv, | |||
1986 | bttv_overlay_risc(btv, &fh->ov, fh->ovfmt, new); | 1986 | bttv_overlay_risc(btv, &fh->ov, fh->ovfmt, new); |
1987 | retval = bttv_switch_overlay(btv,fh,new); | 1987 | retval = bttv_switch_overlay(btv,fh,new); |
1988 | } | 1988 | } |
1989 | up(&fh->cap.lock); | 1989 | mutex_unlock(&fh->cap.lock); |
1990 | return retval; | 1990 | return retval; |
1991 | } | 1991 | } |
1992 | 1992 | ||
@@ -2166,7 +2166,7 @@ static int bttv_s_fmt(struct bttv_fh *fh, struct bttv *btv, | |||
2166 | fmt = format_by_fourcc(f->fmt.pix.pixelformat); | 2166 | fmt = format_by_fourcc(f->fmt.pix.pixelformat); |
2167 | 2167 | ||
2168 | /* update our state informations */ | 2168 | /* update our state informations */ |
2169 | down(&fh->cap.lock); | 2169 | mutex_lock(&fh->cap.lock); |
2170 | fh->fmt = fmt; | 2170 | fh->fmt = fmt; |
2171 | fh->cap.field = f->fmt.pix.field; | 2171 | fh->cap.field = f->fmt.pix.field; |
2172 | fh->cap.last = V4L2_FIELD_NONE; | 2172 | fh->cap.last = V4L2_FIELD_NONE; |
@@ -2175,7 +2175,7 @@ static int bttv_s_fmt(struct bttv_fh *fh, struct bttv *btv, | |||
2175 | btv->init.fmt = fmt; | 2175 | btv->init.fmt = fmt; |
2176 | btv->init.width = f->fmt.pix.width; | 2176 | btv->init.width = f->fmt.pix.width; |
2177 | btv->init.height = f->fmt.pix.height; | 2177 | btv->init.height = f->fmt.pix.height; |
2178 | up(&fh->cap.lock); | 2178 | mutex_unlock(&fh->cap.lock); |
2179 | 2179 | ||
2180 | return 0; | 2180 | return 0; |
2181 | } | 2181 | } |
@@ -2282,7 +2282,7 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, | |||
2282 | fmt = format_by_palette(pic->palette); | 2282 | fmt = format_by_palette(pic->palette); |
2283 | if (NULL == fmt) | 2283 | if (NULL == fmt) |
2284 | return -EINVAL; | 2284 | return -EINVAL; |
2285 | down(&fh->cap.lock); | 2285 | mutex_lock(&fh->cap.lock); |
2286 | if (fmt->depth != pic->depth) { | 2286 | if (fmt->depth != pic->depth) { |
2287 | retval = -EINVAL; | 2287 | retval = -EINVAL; |
2288 | goto fh_unlock_and_return; | 2288 | goto fh_unlock_and_return; |
@@ -2313,7 +2313,7 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, | |||
2313 | bt848_contrast(btv,pic->contrast); | 2313 | bt848_contrast(btv,pic->contrast); |
2314 | bt848_hue(btv,pic->hue); | 2314 | bt848_hue(btv,pic->hue); |
2315 | bt848_sat(btv,pic->colour); | 2315 | bt848_sat(btv,pic->colour); |
2316 | up(&fh->cap.lock); | 2316 | mutex_unlock(&fh->cap.lock); |
2317 | return 0; | 2317 | return 0; |
2318 | } | 2318 | } |
2319 | 2319 | ||
@@ -2379,7 +2379,7 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, | |||
2379 | return -EPERM; | 2379 | return -EPERM; |
2380 | end = (unsigned long)fbuf->base + | 2380 | end = (unsigned long)fbuf->base + |
2381 | fbuf->height * fbuf->bytesperline; | 2381 | fbuf->height * fbuf->bytesperline; |
2382 | down(&fh->cap.lock); | 2382 | mutex_lock(&fh->cap.lock); |
2383 | retval = -EINVAL; | 2383 | retval = -EINVAL; |
2384 | 2384 | ||
2385 | switch (fbuf->depth) { | 2385 | switch (fbuf->depth) { |
@@ -2417,7 +2417,7 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, | |||
2417 | btv->fbuf.fmt.bytesperline = fbuf->bytesperline; | 2417 | btv->fbuf.fmt.bytesperline = fbuf->bytesperline; |
2418 | else | 2418 | else |
2419 | btv->fbuf.fmt.bytesperline = btv->fbuf.fmt.width*fbuf->depth/8; | 2419 | btv->fbuf.fmt.bytesperline = btv->fbuf.fmt.width*fbuf->depth/8; |
2420 | up(&fh->cap.lock); | 2420 | mutex_unlock(&fh->cap.lock); |
2421 | return 0; | 2421 | return 0; |
2422 | } | 2422 | } |
2423 | 2423 | ||
@@ -2440,7 +2440,7 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, | |||
2440 | if (!check_alloc_btres(btv,fh,RESOURCE_OVERLAY)) | 2440 | if (!check_alloc_btres(btv,fh,RESOURCE_OVERLAY)) |
2441 | return -EBUSY; | 2441 | return -EBUSY; |
2442 | 2442 | ||
2443 | down(&fh->cap.lock); | 2443 | mutex_lock(&fh->cap.lock); |
2444 | if (*on) { | 2444 | if (*on) { |
2445 | fh->ov.tvnorm = btv->tvnorm; | 2445 | fh->ov.tvnorm = btv->tvnorm; |
2446 | new = videobuf_alloc(sizeof(*new)); | 2446 | new = videobuf_alloc(sizeof(*new)); |
@@ -2451,7 +2451,7 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, | |||
2451 | 2451 | ||
2452 | /* switch over */ | 2452 | /* switch over */ |
2453 | retval = bttv_switch_overlay(btv,fh,new); | 2453 | retval = bttv_switch_overlay(btv,fh,new); |
2454 | up(&fh->cap.lock); | 2454 | mutex_unlock(&fh->cap.lock); |
2455 | return retval; | 2455 | return retval; |
2456 | } | 2456 | } |
2457 | 2457 | ||
@@ -2460,7 +2460,7 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, | |||
2460 | struct video_mbuf *mbuf = arg; | 2460 | struct video_mbuf *mbuf = arg; |
2461 | unsigned int i; | 2461 | unsigned int i; |
2462 | 2462 | ||
2463 | down(&fh->cap.lock); | 2463 | mutex_lock(&fh->cap.lock); |
2464 | retval = videobuf_mmap_setup(&fh->cap,gbuffers,gbufsize, | 2464 | retval = videobuf_mmap_setup(&fh->cap,gbuffers,gbufsize, |
2465 | V4L2_MEMORY_MMAP); | 2465 | V4L2_MEMORY_MMAP); |
2466 | if (retval < 0) | 2466 | if (retval < 0) |
@@ -2470,7 +2470,7 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, | |||
2470 | mbuf->size = gbuffers * gbufsize; | 2470 | mbuf->size = gbuffers * gbufsize; |
2471 | for (i = 0; i < gbuffers; i++) | 2471 | for (i = 0; i < gbuffers; i++) |
2472 | mbuf->offsets[i] = i * gbufsize; | 2472 | mbuf->offsets[i] = i * gbufsize; |
2473 | up(&fh->cap.lock); | 2473 | mutex_unlock(&fh->cap.lock); |
2474 | return 0; | 2474 | return 0; |
2475 | } | 2475 | } |
2476 | case VIDIOCMCAPTURE: | 2476 | case VIDIOCMCAPTURE: |
@@ -2482,7 +2482,7 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, | |||
2482 | if (vm->frame >= VIDEO_MAX_FRAME) | 2482 | if (vm->frame >= VIDEO_MAX_FRAME) |
2483 | return -EINVAL; | 2483 | return -EINVAL; |
2484 | 2484 | ||
2485 | down(&fh->cap.lock); | 2485 | mutex_lock(&fh->cap.lock); |
2486 | retval = -EINVAL; | 2486 | retval = -EINVAL; |
2487 | buf = (struct bttv_buffer *)fh->cap.bufs[vm->frame]; | 2487 | buf = (struct bttv_buffer *)fh->cap.bufs[vm->frame]; |
2488 | if (NULL == buf) | 2488 | if (NULL == buf) |
@@ -2504,7 +2504,7 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, | |||
2504 | spin_lock_irqsave(&btv->s_lock,flags); | 2504 | spin_lock_irqsave(&btv->s_lock,flags); |
2505 | buffer_queue(&fh->cap,&buf->vb); | 2505 | buffer_queue(&fh->cap,&buf->vb); |
2506 | spin_unlock_irqrestore(&btv->s_lock,flags); | 2506 | spin_unlock_irqrestore(&btv->s_lock,flags); |
2507 | up(&fh->cap.lock); | 2507 | mutex_unlock(&fh->cap.lock); |
2508 | return 0; | 2508 | return 0; |
2509 | } | 2509 | } |
2510 | case VIDIOCSYNC: | 2510 | case VIDIOCSYNC: |
@@ -2515,7 +2515,7 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, | |||
2515 | if (*frame >= VIDEO_MAX_FRAME) | 2515 | if (*frame >= VIDEO_MAX_FRAME) |
2516 | return -EINVAL; | 2516 | return -EINVAL; |
2517 | 2517 | ||
2518 | down(&fh->cap.lock); | 2518 | mutex_lock(&fh->cap.lock); |
2519 | retval = -EINVAL; | 2519 | retval = -EINVAL; |
2520 | buf = (struct bttv_buffer *)fh->cap.bufs[*frame]; | 2520 | buf = (struct bttv_buffer *)fh->cap.bufs[*frame]; |
2521 | if (NULL == buf) | 2521 | if (NULL == buf) |
@@ -2535,7 +2535,7 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, | |||
2535 | retval = -EINVAL; | 2535 | retval = -EINVAL; |
2536 | break; | 2536 | break; |
2537 | } | 2537 | } |
2538 | up(&fh->cap.lock); | 2538 | mutex_unlock(&fh->cap.lock); |
2539 | return retval; | 2539 | return retval; |
2540 | } | 2540 | } |
2541 | 2541 | ||
@@ -2719,7 +2719,7 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, | |||
2719 | if (0 == (fmt->flags & FORMAT_FLAGS_PACKED)) | 2719 | if (0 == (fmt->flags & FORMAT_FLAGS_PACKED)) |
2720 | return -EINVAL; | 2720 | return -EINVAL; |
2721 | 2721 | ||
2722 | down(&fh->cap.lock); | 2722 | mutex_lock(&fh->cap.lock); |
2723 | retval = -EINVAL; | 2723 | retval = -EINVAL; |
2724 | if (fb->flags & V4L2_FBUF_FLAG_OVERLAY) { | 2724 | if (fb->flags & V4L2_FBUF_FLAG_OVERLAY) { |
2725 | if (fb->fmt.width > bttv_tvnorms[btv->tvnorm].swidth) | 2725 | if (fb->fmt.width > bttv_tvnorms[btv->tvnorm].swidth) |
@@ -2759,7 +2759,7 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, | |||
2759 | retval = bttv_switch_overlay(btv,fh,new); | 2759 | retval = bttv_switch_overlay(btv,fh,new); |
2760 | } | 2760 | } |
2761 | } | 2761 | } |
2762 | up(&fh->cap.lock); | 2762 | mutex_unlock(&fh->cap.lock); |
2763 | return retval; | 2763 | return retval; |
2764 | } | 2764 | } |
2765 | 2765 | ||
@@ -2890,7 +2890,7 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, | |||
2890 | return 0; | 2890 | return 0; |
2891 | 2891 | ||
2892 | fh_unlock_and_return: | 2892 | fh_unlock_and_return: |
2893 | up(&fh->cap.lock); | 2893 | mutex_unlock(&fh->cap.lock); |
2894 | return retval; | 2894 | return retval; |
2895 | } | 2895 | } |
2896 | 2896 | ||
@@ -2957,16 +2957,16 @@ static unsigned int bttv_poll(struct file *file, poll_table *wait) | |||
2957 | buf = list_entry(fh->cap.stream.next,struct bttv_buffer,vb.stream); | 2957 | buf = list_entry(fh->cap.stream.next,struct bttv_buffer,vb.stream); |
2958 | } else { | 2958 | } else { |
2959 | /* read() capture */ | 2959 | /* read() capture */ |
2960 | down(&fh->cap.lock); | 2960 | mutex_lock(&fh->cap.lock); |
2961 | if (NULL == fh->cap.read_buf) { | 2961 | if (NULL == fh->cap.read_buf) { |
2962 | /* need to capture a new frame */ | 2962 | /* need to capture a new frame */ |
2963 | if (locked_btres(fh->btv,RESOURCE_VIDEO)) { | 2963 | if (locked_btres(fh->btv,RESOURCE_VIDEO)) { |
2964 | up(&fh->cap.lock); | 2964 | mutex_unlock(&fh->cap.lock); |
2965 | return POLLERR; | 2965 | return POLLERR; |
2966 | } | 2966 | } |
2967 | fh->cap.read_buf = videobuf_alloc(fh->cap.msize); | 2967 | fh->cap.read_buf = videobuf_alloc(fh->cap.msize); |
2968 | if (NULL == fh->cap.read_buf) { | 2968 | if (NULL == fh->cap.read_buf) { |
2969 | up(&fh->cap.lock); | 2969 | mutex_unlock(&fh->cap.lock); |
2970 | return POLLERR; | 2970 | return POLLERR; |
2971 | } | 2971 | } |
2972 | fh->cap.read_buf->memory = V4L2_MEMORY_USERPTR; | 2972 | fh->cap.read_buf->memory = V4L2_MEMORY_USERPTR; |
@@ -2974,13 +2974,13 @@ static unsigned int bttv_poll(struct file *file, poll_table *wait) | |||
2974 | if (0 != fh->cap.ops->buf_prepare(&fh->cap,fh->cap.read_buf,field)) { | 2974 | if (0 != fh->cap.ops->buf_prepare(&fh->cap,fh->cap.read_buf,field)) { |
2975 | kfree (fh->cap.read_buf); | 2975 | kfree (fh->cap.read_buf); |
2976 | fh->cap.read_buf = NULL; | 2976 | fh->cap.read_buf = NULL; |
2977 | up(&fh->cap.lock); | 2977 | mutex_unlock(&fh->cap.lock); |
2978 | return POLLERR; | 2978 | return POLLERR; |
2979 | } | 2979 | } |
2980 | fh->cap.ops->buf_queue(&fh->cap,fh->cap.read_buf); | 2980 | fh->cap.ops->buf_queue(&fh->cap,fh->cap.read_buf); |
2981 | fh->cap.read_off = 0; | 2981 | fh->cap.read_off = 0; |
2982 | } | 2982 | } |
2983 | up(&fh->cap.lock); | 2983 | mutex_unlock(&fh->cap.lock); |
2984 | buf = (struct bttv_buffer*)fh->cap.read_buf; | 2984 | buf = (struct bttv_buffer*)fh->cap.read_buf; |
2985 | } | 2985 | } |
2986 | 2986 | ||