diff options
Diffstat (limited to 'linux/drivers/media/video/bttv-driver.c')
-rw-r--r-- | linux/drivers/media/video/bttv-driver.c | 58 |
1 files changed, 31 insertions, 27 deletions
diff --git a/linux/drivers/media/video/bttv-driver.c b/linux/drivers/media/video/bttv-driver.c index 44e8c00cc..df30742ed 100644 --- a/linux/drivers/media/video/bttv-driver.c +++ b/linux/drivers/media/video/bttv-driver.c @@ -1,5 +1,5 @@ /* - $Id: bttv-driver.c,v 1.15 2004/09/20 11:39:43 kraxel Exp $ + $Id: bttv-driver.c,v 1.16 2004/09/23 13:58:19 kraxel Exp $ bttv - Bt848 frame grabber driver @@ -1414,9 +1414,9 @@ static int bttv_prepare_buffer(struct bttv *btv, struct bttv_buffer *buf, } static int -buffer_setup(struct file *file, unsigned int *count, unsigned int *size) +buffer_setup(void *priv, unsigned int *count, unsigned int *size) { - struct bttv_fh *fh = file->private_data; + struct bttv_fh *fh = priv; *size = fh->fmt->depth*fh->width*fh->height >> 3; if (0 == *count) @@ -1427,21 +1427,21 @@ buffer_setup(struct file *file, unsigned int *count, unsigned int *size) } static int -buffer_prepare(struct file *file, struct videobuf_buffer *vb, +buffer_prepare(void *priv, struct videobuf_buffer *vb, enum v4l2_field field) { struct bttv_buffer *buf = (struct bttv_buffer*)vb; - struct bttv_fh *fh = file->private_data; + struct bttv_fh *fh = priv; return bttv_prepare_buffer(fh->btv, buf, fh->fmt, fh->width, fh->height, field); } static void -buffer_queue(struct file *file, struct videobuf_buffer *vb) +buffer_queue(void *priv, struct videobuf_buffer *vb) { struct bttv_buffer *buf = (struct bttv_buffer*)vb; - struct bttv_fh *fh = file->private_data; + struct bttv_fh *fh = priv; buf->vb.state = STATE_QUEUED; list_add_tail(&buf->vb.queue,&fh->btv->capture); @@ -1449,10 +1449,10 @@ buffer_queue(struct file *file, struct videobuf_buffer *vb) bttv_set_dma(fh->btv, 0x03, fh->btv->curr.irqflags); } -static void buffer_release(struct file *file, struct videobuf_buffer *vb) +static void buffer_release(void *priv, struct videobuf_buffer *vb) { struct bttv_buffer *buf = (struct bttv_buffer*)vb; - struct bttv_fh *fh = file->private_data; + struct bttv_fh *fh = priv; bttv_dma_free(fh->btv,buf); } @@ -2384,7 +2384,8 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, unsigned int i; down(&fh->cap.lock); - retval = videobuf_mmap_setup(file,&fh->cap,gbuffers,gbufsize, + retval = videobuf_mmap_setup(file->private_data, + &fh->cap,gbuffers,gbufsize, V4L2_MEMORY_MMAP); if (retval < 0) goto fh_unlock_and_return; @@ -2425,7 +2426,7 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, if (0 != retval) goto fh_unlock_and_return; spin_lock_irqsave(&btv->s_lock,flags); - buffer_queue(file,&buf->vb); + buffer_queue(file->private_data,&buf->vb); spin_unlock_irqrestore(&btv->s_lock,flags); up(&fh->cap.lock); return 0; @@ -2682,16 +2683,17 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, } case VIDIOC_REQBUFS: - return videobuf_reqbufs(file,bttv_queue(fh),arg); + return videobuf_reqbufs(file->private_data,bttv_queue(fh),arg); case VIDIOC_QUERYBUF: return videobuf_querybuf(bttv_queue(fh),arg); case VIDIOC_QBUF: - return videobuf_qbuf(file,bttv_queue(fh),arg); + return videobuf_qbuf(file->private_data,bttv_queue(fh),arg); case VIDIOC_DQBUF: - return videobuf_dqbuf(file,bttv_queue(fh),arg); + return videobuf_dqbuf(file->private_data,bttv_queue(fh),arg, + file->f_flags & O_NONBLOCK); case VIDIOC_STREAMON: { @@ -2699,13 +2701,13 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, if (!check_alloc_btres(btv,fh,res)) return -EBUSY; - return videobuf_streamon(file,bttv_queue(fh)); + return videobuf_streamon(file->private_data,bttv_queue(fh)); } case VIDIOC_STREAMOFF: { int res = bttv_resource(fh); - retval = videobuf_streamoff(file,bttv_queue(fh)); + retval = videobuf_streamoff(file->private_data,bttv_queue(fh)); if (retval < 0) return retval; free_btres(btv,fh,res); @@ -2842,12 +2844,16 @@ static ssize_t bttv_read(struct file *file, char __user *data, case V4L2_BUF_TYPE_VIDEO_CAPTURE: if (locked_btres(fh->btv,RESOURCE_VIDEO)) return -EBUSY; - retval = videobuf_read_one(file, &fh->cap, data, count, ppos); + retval = videobuf_read_one(file->private_data, + &fh->cap, data, count, ppos, + file->f_flags & O_NONBLOCK); break; case V4L2_BUF_TYPE_VBI_CAPTURE: if (!check_alloc_btres(fh->btv,fh,RESOURCE_VBI)) return -EBUSY; - retval = videobuf_read_stream(file, &fh->vbi, data, count, ppos, 1); + retval = videobuf_read_stream(file->private_data, + &fh->vbi, data, count, ppos, 1, + file->f_flags & O_NONBLOCK); break; default: BUG(); @@ -2864,7 +2870,7 @@ static unsigned int bttv_poll(struct file *file, poll_table *wait) if (V4L2_BUF_TYPE_VBI_CAPTURE == fh->type) { if (!check_alloc_btres(fh->btv,fh,RESOURCE_VBI)) return -EBUSY; - return videobuf_poll_stream(file, &fh->vbi, wait); + return videobuf_poll_stream(file->private_data, &fh->vbi, wait); } if (check_btres(fh,RESOURCE_VIDEO)) { @@ -2888,11 +2894,11 @@ static unsigned int bttv_poll(struct file *file, poll_table *wait) } fh->cap.read_buf->memory = V4L2_MEMORY_USERPTR; field = videobuf_next_field(&fh->cap); - if (0 != fh->cap.ops->buf_prepare(file,fh->cap.read_buf,field)) { + if (0 != fh->cap.ops->buf_prepare(file->private_data,fh->cap.read_buf,field)) { up(&fh->cap.lock); return POLLERR; } - fh->cap.ops->buf_queue(file,fh->cap.read_buf); + fh->cap.ops->buf_queue(file->private_data,fh->cap.read_buf); fh->cap.read_off = 0; } up(&fh->cap.lock); @@ -2978,20 +2984,20 @@ static int bttv_release(struct inode *inode, struct file *file) /* stop video capture */ if (check_btres(fh, RESOURCE_VIDEO)) { - videobuf_streamoff(file,&fh->cap); + videobuf_streamoff(file->private_data,&fh->cap); free_btres(btv,fh,RESOURCE_VIDEO); } if (fh->cap.read_buf) { - buffer_release(file,fh->cap.read_buf); + buffer_release(file->private_data,fh->cap.read_buf); kfree(fh->cap.read_buf); } /* stop vbi capture */ if (check_btres(fh, RESOURCE_VBI)) { if (fh->vbi.streaming) - videobuf_streamoff(file,&fh->vbi); + videobuf_streamoff(file->private_data,&fh->vbi); if (fh->vbi.reading) - videobuf_read_stop(file,&fh->vbi); + videobuf_read_stop(file->private_data,&fh->vbi); free_btres(btv,fh,RESOURCE_VBI); } @@ -3859,12 +3865,10 @@ static int __devinit bttv_probe(struct pci_dev *dev, /* register video4linux + input */ if (!bttv_tvcards[btv->c.type].no_video) { bttv_register_video(btv); -#if 0 bt848_bright(btv,32768); bt848_contrast(btv,32768); bt848_hue(btv,32768); bt848_sat(btv,32768); -#endif audio_mux(btv,AUDIO_MUTE); set_input(btv,0); } |