diff options
Diffstat (limited to 'drivers/media/video/bt8xx/bttv-driver.c')
-rw-r--r-- | drivers/media/video/bt8xx/bttv-driver.c | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c index fcf8f2d208a8..2ca3e9cfb2bb 100644 --- a/drivers/media/video/bt8xx/bttv-driver.c +++ b/drivers/media/video/bt8xx/bttv-driver.c | |||
@@ -2372,7 +2372,7 @@ static int setup_window(struct bttv_fh *fh, struct bttv *btv, | |||
2372 | if (check_btres(fh, RESOURCE_OVERLAY)) { | 2372 | if (check_btres(fh, RESOURCE_OVERLAY)) { |
2373 | struct bttv_buffer *new; | 2373 | struct bttv_buffer *new; |
2374 | 2374 | ||
2375 | new = videobuf_pci_alloc(sizeof(*new)); | 2375 | new = videobuf_sg_alloc(sizeof(*new)); |
2376 | new->crop = btv->crop[!!fh->do_crop].rect; | 2376 | new->crop = btv->crop[!!fh->do_crop].rect; |
2377 | bttv_overlay_risc(btv, &fh->ov, fh->ovfmt, new); | 2377 | bttv_overlay_risc(btv, &fh->ov, fh->ovfmt, new); |
2378 | retval = bttv_switch_overlay(btv,fh,new); | 2378 | retval = bttv_switch_overlay(btv,fh,new); |
@@ -2760,7 +2760,7 @@ static int bttv_overlay(struct file *file, void *f, unsigned int on) | |||
2760 | mutex_lock(&fh->cap.vb_lock); | 2760 | mutex_lock(&fh->cap.vb_lock); |
2761 | if (on) { | 2761 | if (on) { |
2762 | fh->ov.tvnorm = btv->tvnorm; | 2762 | fh->ov.tvnorm = btv->tvnorm; |
2763 | new = videobuf_pci_alloc(sizeof(*new)); | 2763 | new = videobuf_sg_alloc(sizeof(*new)); |
2764 | new->crop = btv->crop[!!fh->do_crop].rect; | 2764 | new->crop = btv->crop[!!fh->do_crop].rect; |
2765 | bttv_overlay_risc(btv, &fh->ov, fh->ovfmt, new); | 2765 | bttv_overlay_risc(btv, &fh->ov, fh->ovfmt, new); |
2766 | } else { | 2766 | } else { |
@@ -2834,7 +2834,7 @@ static int bttv_s_fbuf(struct file *file, void *f, | |||
2834 | if (check_btres(fh, RESOURCE_OVERLAY)) { | 2834 | if (check_btres(fh, RESOURCE_OVERLAY)) { |
2835 | struct bttv_buffer *new; | 2835 | struct bttv_buffer *new; |
2836 | 2836 | ||
2837 | new = videobuf_pci_alloc(sizeof(*new)); | 2837 | new = videobuf_sg_alloc(sizeof(*new)); |
2838 | new->crop = btv->crop[!!fh->do_crop].rect; | 2838 | new->crop = btv->crop[!!fh->do_crop].rect; |
2839 | bttv_overlay_risc(btv, &fh->ov, fh->ovfmt, new); | 2839 | bttv_overlay_risc(btv, &fh->ov, fh->ovfmt, new); |
2840 | retval = bttv_switch_overlay(btv, fh, new); | 2840 | retval = bttv_switch_overlay(btv, fh, new); |
@@ -3117,12 +3117,18 @@ static int bttv_s_crop(struct file *file, void *f, struct v4l2_crop *crop) | |||
3117 | 3117 | ||
3118 | static int bttv_g_audio(struct file *file, void *priv, struct v4l2_audio *a) | 3118 | static int bttv_g_audio(struct file *file, void *priv, struct v4l2_audio *a) |
3119 | { | 3119 | { |
3120 | if (unlikely(a->index)) | ||
3121 | return -EINVAL; | ||
3122 | |||
3120 | strcpy(a->name, "audio"); | 3123 | strcpy(a->name, "audio"); |
3121 | return 0; | 3124 | return 0; |
3122 | } | 3125 | } |
3123 | 3126 | ||
3124 | static int bttv_s_audio(struct file *file, void *priv, struct v4l2_audio *a) | 3127 | static int bttv_s_audio(struct file *file, void *priv, struct v4l2_audio *a) |
3125 | { | 3128 | { |
3129 | if (unlikely(a->index)) | ||
3130 | return -EINVAL; | ||
3131 | |||
3126 | return 0; | 3132 | return 0; |
3127 | } | 3133 | } |
3128 | 3134 | ||
@@ -3184,7 +3190,7 @@ static unsigned int bttv_poll(struct file *file, poll_table *wait) | |||
3184 | /* need to capture a new frame */ | 3190 | /* need to capture a new frame */ |
3185 | if (locked_btres(fh->btv,RESOURCE_VIDEO_STREAM)) | 3191 | if (locked_btres(fh->btv,RESOURCE_VIDEO_STREAM)) |
3186 | goto err; | 3192 | goto err; |
3187 | fh->cap.read_buf = videobuf_pci_alloc(fh->cap.msize); | 3193 | fh->cap.read_buf = videobuf_sg_alloc(fh->cap.msize); |
3188 | if (NULL == fh->cap.read_buf) | 3194 | if (NULL == fh->cap.read_buf) |
3189 | goto err; | 3195 | goto err; |
3190 | fh->cap.read_buf->memory = V4L2_MEMORY_USERPTR; | 3196 | fh->cap.read_buf->memory = V4L2_MEMORY_USERPTR; |
@@ -3251,14 +3257,14 @@ static int bttv_open(struct inode *inode, struct file *file) | |||
3251 | fh->ov.setup_ok = 0; | 3257 | fh->ov.setup_ok = 0; |
3252 | v4l2_prio_open(&btv->prio,&fh->prio); | 3258 | v4l2_prio_open(&btv->prio,&fh->prio); |
3253 | 3259 | ||
3254 | videobuf_queue_pci_init(&fh->cap, &bttv_video_qops, | 3260 | videobuf_queue_sg_init(&fh->cap, &bttv_video_qops, |
3255 | btv->c.pci, &btv->s_lock, | 3261 | &btv->c.pci->dev, &btv->s_lock, |
3256 | V4L2_BUF_TYPE_VIDEO_CAPTURE, | 3262 | V4L2_BUF_TYPE_VIDEO_CAPTURE, |
3257 | V4L2_FIELD_INTERLACED, | 3263 | V4L2_FIELD_INTERLACED, |
3258 | sizeof(struct bttv_buffer), | 3264 | sizeof(struct bttv_buffer), |
3259 | fh); | 3265 | fh); |
3260 | videobuf_queue_pci_init(&fh->vbi, &bttv_vbi_qops, | 3266 | videobuf_queue_sg_init(&fh->vbi, &bttv_vbi_qops, |
3261 | btv->c.pci, &btv->s_lock, | 3267 | &btv->c.pci->dev, &btv->s_lock, |
3262 | V4L2_BUF_TYPE_VBI_CAPTURE, | 3268 | V4L2_BUF_TYPE_VBI_CAPTURE, |
3263 | V4L2_FIELD_SEQ_TB, | 3269 | V4L2_FIELD_SEQ_TB, |
3264 | sizeof(struct bttv_buffer), | 3270 | sizeof(struct bttv_buffer), |
@@ -3457,6 +3463,9 @@ static int radio_release(struct inode *inode, struct file *file) | |||
3457 | struct bttv *btv = fh->btv; | 3463 | struct bttv *btv = fh->btv; |
3458 | struct rds_command cmd; | 3464 | struct rds_command cmd; |
3459 | 3465 | ||
3466 | file->private_data = NULL; | ||
3467 | kfree(fh); | ||
3468 | |||
3460 | btv->radio_user--; | 3469 | btv->radio_user--; |
3461 | 3470 | ||
3462 | bttv_call_i2c_clients(btv, RDS_CMD_CLOSE, &cmd); | 3471 | bttv_call_i2c_clients(btv, RDS_CMD_CLOSE, &cmd); |
@@ -3510,7 +3519,7 @@ static int radio_enum_input(struct file *file, void *priv, | |||
3510 | return -EINVAL; | 3519 | return -EINVAL; |
3511 | 3520 | ||
3512 | strcpy(i->name, "Radio"); | 3521 | strcpy(i->name, "Radio"); |
3513 | i->type = V4L2_INPUT_TYPE_TUNER; | 3522 | i->type = V4L2_INPUT_TYPE_TUNER; |
3514 | 3523 | ||
3515 | return 0; | 3524 | return 0; |
3516 | } | 3525 | } |
@@ -3518,10 +3527,9 @@ static int radio_enum_input(struct file *file, void *priv, | |||
3518 | static int radio_g_audio(struct file *file, void *priv, | 3527 | static int radio_g_audio(struct file *file, void *priv, |
3519 | struct v4l2_audio *a) | 3528 | struct v4l2_audio *a) |
3520 | { | 3529 | { |
3521 | if (a->index != 0) | 3530 | if (unlikely(a->index)) |
3522 | return -EINVAL; | 3531 | return -EINVAL; |
3523 | 3532 | ||
3524 | memset(a, 0, sizeof(*a)); | ||
3525 | strcpy(a->name, "Radio"); | 3533 | strcpy(a->name, "Radio"); |
3526 | 3534 | ||
3527 | return 0; | 3535 | return 0; |
@@ -3543,11 +3551,17 @@ static int radio_s_tuner(struct file *file, void *priv, | |||
3543 | static int radio_s_audio(struct file *file, void *priv, | 3551 | static int radio_s_audio(struct file *file, void *priv, |
3544 | struct v4l2_audio *a) | 3552 | struct v4l2_audio *a) |
3545 | { | 3553 | { |
3554 | if (unlikely(a->index)) | ||
3555 | return -EINVAL; | ||
3556 | |||
3546 | return 0; | 3557 | return 0; |
3547 | } | 3558 | } |
3548 | 3559 | ||
3549 | static int radio_s_input(struct file *filp, void *priv, unsigned int i) | 3560 | static int radio_s_input(struct file *filp, void *priv, unsigned int i) |
3550 | { | 3561 | { |
3562 | if (unlikely(i)) | ||
3563 | return -EINVAL; | ||
3564 | |||
3551 | return 0; | 3565 | return 0; |
3552 | } | 3566 | } |
3553 | 3567 | ||