diff options
author | Gerd Knorr <devnull@localhost> | 2004-09-23 13:58:19 +0000 |
---|---|---|
committer | Gerd Knorr <devnull@localhost> | 2004-09-23 13:58:19 +0000 |
commit | 2f9202097e4418d085a0d6ef636de1d0b0fb84dd (patch) | |
tree | 346e618d5502ac1f9abce855416aad2bb0b20a47 /linux/drivers/media/video/video-buf.c | |
parent | 953f8692136acd6aa9201f9388697a7005756894 (diff) | |
download | mediapointer-dvb-s2-2f9202097e4418d085a0d6ef636de1d0b0fb84dd.tar.gz mediapointer-dvb-s2-2f9202097e4418d085a0d6ef636de1d0b0fb84dd.tar.bz2 |
- make video-bufg don't touch struct file any more, pass through
a void ptr instead of a file ptr everythere.
- add cx22702 fe driver,
Diffstat (limited to 'linux/drivers/media/video/video-buf.c')
-rw-r--r-- | linux/drivers/media/video/video-buf.c | 102 |
1 files changed, 51 insertions, 51 deletions
diff --git a/linux/drivers/media/video/video-buf.c b/linux/drivers/media/video/video-buf.c index f00a5b9a5..0758b1daf 100644 --- a/linux/drivers/media/video/video-buf.c +++ b/linux/drivers/media/video/video-buf.c @@ -1,5 +1,5 @@ /* - * $Id: video-buf.c,v 1.10 2004/09/15 16:15:24 kraxel Exp $ + * $Id: video-buf.c,v 1.11 2004/09/23 13:58:19 kraxel Exp $ * * generic helper functions for video4linux capture buffers, to handle * memory management and PCI DMA. Right now bttv + saa7134 use it. @@ -430,7 +430,7 @@ videobuf_queue_is_busy(struct videobuf_queue *q) } void -videobuf_queue_cancel(struct file *file, struct videobuf_queue *q) +videobuf_queue_cancel(void *priv, struct videobuf_queue *q) { unsigned long flags; int i; @@ -451,7 +451,7 @@ videobuf_queue_cancel(struct file *file, struct videobuf_queue *q) for (i = 0; i < VIDEO_MAX_FRAME; i++) { if (NULL == q->bufs[i]) continue; - q->ops->buf_release(file,q->bufs[i]); + q->ops->buf_release(priv,q->bufs[i]); } INIT_LIST_HEAD(&q->stream); } @@ -533,7 +533,7 @@ videobuf_status(struct v4l2_buffer *b, struct videobuf_buffer *vb, } int -videobuf_reqbufs(struct file *file, struct videobuf_queue *q, +videobuf_reqbufs(void *priv, struct videobuf_queue *q, struct v4l2_requestbuffers *req) { unsigned int size,count; @@ -558,12 +558,12 @@ videobuf_reqbufs(struct file *file, struct videobuf_queue *q, if (count > VIDEO_MAX_FRAME) count = VIDEO_MAX_FRAME; size = 0; - q->ops->buf_setup(file,&count,&size); + q->ops->buf_setup(priv,&count,&size); size = PAGE_ALIGN(size); dprintk(1,"reqbufs: bufs=%d, size=0x%x [%d pages total]\n", count, size, (count*size)>>PAGE_SHIFT); - retval = videobuf_mmap_setup(file,q,count,size,req->memory); + retval = videobuf_mmap_setup(priv,q,count,size,req->memory); if (retval < 0) goto done; @@ -588,7 +588,7 @@ videobuf_querybuf(struct videobuf_queue *q, struct v4l2_buffer *b) } int -videobuf_qbuf(struct file *file, struct videobuf_queue *q, +videobuf_qbuf(void *priv, struct videobuf_queue *q, struct v4l2_buffer *b) { struct videobuf_buffer *buf; @@ -632,7 +632,7 @@ videobuf_qbuf(struct file *file, struct videobuf_queue *q, if (b->length < buf->bsize) goto done; if (STATE_NEEDS_INIT != buf->state && buf->baddr != b->m.userptr) - q->ops->buf_release(file,buf); + q->ops->buf_release(priv,buf); buf->baddr = b->m.userptr; break; case V4L2_MEMORY_OVERLAY: @@ -643,14 +643,14 @@ videobuf_qbuf(struct file *file, struct videobuf_queue *q, } field = videobuf_next_field(q); - retval = q->ops->buf_prepare(file,buf,field); + retval = q->ops->buf_prepare(priv,buf,field); if (0 != retval) goto done; list_add_tail(&buf->stream,&q->stream); if (q->streaming) { spin_lock_irqsave(q->irqlock,flags); - q->ops->buf_queue(file,buf); + q->ops->buf_queue(priv,buf); spin_unlock_irqrestore(q->irqlock,flags); } retval = 0; @@ -661,8 +661,8 @@ videobuf_qbuf(struct file *file, struct videobuf_queue *q, } int -videobuf_dqbuf(struct file *file, struct videobuf_queue *q, - struct v4l2_buffer *b) +videobuf_dqbuf(void *priv, struct videobuf_queue *q, + struct v4l2_buffer *b, int nonblocking) { struct videobuf_buffer *buf; int retval; @@ -677,7 +677,7 @@ videobuf_dqbuf(struct file *file, struct videobuf_queue *q, if (list_empty(&q->stream)) goto done; buf = list_entry(q->stream.next, struct videobuf_buffer, stream); - retval = videobuf_waiton(buf, file->f_flags & O_NONBLOCK, 1); + retval = videobuf_waiton(buf, nonblocking, 1); if (retval < 0) goto done; switch (buf->state) { @@ -701,7 +701,7 @@ videobuf_dqbuf(struct file *file, struct videobuf_queue *q, return retval; } -int videobuf_streamon(struct file *file, struct videobuf_queue *q) +int videobuf_streamon(void *priv, struct videobuf_queue *q) { struct videobuf_buffer *buf; struct list_head *list; @@ -720,7 +720,7 @@ int videobuf_streamon(struct file *file, struct videobuf_queue *q) list_for_each(list,&q->stream) { buf = list_entry(list, struct videobuf_buffer, stream); if (buf->state == STATE_PREPARED) - q->ops->buf_queue(file,buf); + q->ops->buf_queue(priv,buf); } spin_unlock_irqrestore(q->irqlock,flags); @@ -729,14 +729,14 @@ int videobuf_streamon(struct file *file, struct videobuf_queue *q) return retval; } -int videobuf_streamoff(struct file *file, struct videobuf_queue *q) +int videobuf_streamoff(void *priv, struct videobuf_queue *q) { int retval = -EINVAL; down(&q->lock); if (!q->streaming) goto done; - videobuf_queue_cancel(file,q); + videobuf_queue_cancel(priv,q); q->streaming = 0; retval = 0; @@ -746,7 +746,7 @@ int videobuf_streamoff(struct file *file, struct videobuf_queue *q) } static ssize_t -videobuf_read_zerocopy(struct file *file, struct videobuf_queue *q, +videobuf_read_zerocopy(void *priv, struct videobuf_queue *q, char __user *data, size_t count, loff_t *ppos) { enum v4l2_field field; @@ -763,13 +763,13 @@ videobuf_read_zerocopy(struct file *file, struct videobuf_queue *q, q->read_buf->baddr = (unsigned long)data; q->read_buf->bsize = count; field = videobuf_next_field(q); - retval = q->ops->buf_prepare(file,q->read_buf,field); + retval = q->ops->buf_prepare(priv,q->read_buf,field); if (0 != retval) goto done; /* start capture & wait */ spin_lock_irqsave(q->irqlock,flags); - q->ops->buf_queue(file,q->read_buf); + q->ops->buf_queue(priv,q->read_buf); spin_unlock_irqrestore(q->irqlock,flags); retval = videobuf_waiton(q->read_buf,0,0); if (0 == retval) { @@ -782,14 +782,15 @@ videobuf_read_zerocopy(struct file *file, struct videobuf_queue *q, done: /* cleanup */ - q->ops->buf_release(file,q->read_buf); + q->ops->buf_release(priv,q->read_buf); kfree(q->read_buf); q->read_buf = NULL; return retval; } -ssize_t videobuf_read_one(struct file *file, struct videobuf_queue *q, - char __user *data, size_t count, loff_t *ppos) +ssize_t videobuf_read_one(void *priv, struct videobuf_queue *q, + char __user *data, size_t count, loff_t *ppos, + int nonblocking) { enum v4l2_field field; unsigned long flags; @@ -799,11 +800,11 @@ ssize_t videobuf_read_one(struct file *file, struct videobuf_queue *q, down(&q->lock); nbufs = 1; size = 0; - q->ops->buf_setup(file,&nbufs,&size); + q->ops->buf_setup(priv,&nbufs,&size); if (NULL == q->read_buf && count >= size && - !(file->f_flags & O_NONBLOCK)) { - retval = videobuf_read_zerocopy(file,q,data,count,ppos); + !nonblocking) { + retval = videobuf_read_zerocopy(priv,q,data,count,ppos); if (retval >= 0 || retval == -EIO) /* ok, all done */ goto done; @@ -818,24 +819,24 @@ ssize_t videobuf_read_one(struct file *file, struct videobuf_queue *q, goto done; q->read_buf->memory = V4L2_MEMORY_USERPTR; field = videobuf_next_field(q); - retval = q->ops->buf_prepare(file,q->read_buf,field); + retval = q->ops->buf_prepare(priv,q->read_buf,field); if (0 != retval) goto done; spin_lock_irqsave(q->irqlock,flags); - q->ops->buf_queue(file,q->read_buf); + q->ops->buf_queue(priv,q->read_buf); spin_unlock_irqrestore(q->irqlock,flags); q->read_off = 0; } /* wait until capture is done */ - retval = videobuf_waiton(q->read_buf, file->f_flags & O_NONBLOCK, 1); + retval = videobuf_waiton(q->read_buf, nonblocking, 1); if (0 != retval) goto done; videobuf_dma_pci_sync(q->pci,&q->read_buf->dma); if (STATE_ERROR == q->read_buf->state) { /* catch I/O errors */ - q->ops->buf_release(file,q->read_buf); + q->ops->buf_release(priv,q->read_buf); kfree(q->read_buf); q->read_buf = NULL; retval = -EIO; @@ -854,7 +855,7 @@ ssize_t videobuf_read_one(struct file *file, struct videobuf_queue *q, q->read_off += bytes; if (q->read_off == q->read_buf->size) { /* all data copied, cleanup */ - q->ops->buf_release(file,q->read_buf); + q->ops->buf_release(priv,q->read_buf); kfree(q->read_buf); q->read_buf = NULL; } @@ -864,43 +865,43 @@ ssize_t videobuf_read_one(struct file *file, struct videobuf_queue *q, return retval; } -int videobuf_read_start(struct file *file, struct videobuf_queue *q) +int videobuf_read_start(void *priv, struct videobuf_queue *q) { enum v4l2_field field; unsigned long flags; int count = 0, size = 0; int err, i; - q->ops->buf_setup(file,&count,&size); + q->ops->buf_setup(priv,&count,&size); if (count < 2) count = 2; if (count > VIDEO_MAX_FRAME) count = VIDEO_MAX_FRAME; size = PAGE_ALIGN(size); - err = videobuf_mmap_setup(file, q, count, size, V4L2_MEMORY_USERPTR); + err = videobuf_mmap_setup(priv, q, count, size, V4L2_MEMORY_USERPTR); if (err) return err; for (i = 0; i < count; i++) { field = videobuf_next_field(q); - err = q->ops->buf_prepare(file,q->bufs[i],field); + err = q->ops->buf_prepare(priv,q->bufs[i],field); if (err) return err; list_add_tail(&q->bufs[i]->stream, &q->stream); } spin_lock_irqsave(q->irqlock,flags); for (i = 0; i < count; i++) - q->ops->buf_queue(file,q->bufs[i]); + q->ops->buf_queue(priv,q->bufs[i]); spin_unlock_irqrestore(q->irqlock,flags); q->reading = 1; return 0; } -void videobuf_read_stop(struct file *file, struct videobuf_queue *q) +void videobuf_read_stop(void *priv, struct videobuf_queue *q) { int i; - videobuf_queue_cancel(file,q); + videobuf_queue_cancel(priv,q); INIT_LIST_HEAD(&q->stream); for (i = 0; i < VIDEO_MAX_FRAME; i++) { if (NULL == q->bufs[i]) @@ -912,9 +913,9 @@ void videobuf_read_stop(struct file *file, struct videobuf_queue *q) q->reading = 0; } -ssize_t videobuf_read_stream(struct file *file, struct videobuf_queue *q, +ssize_t videobuf_read_stream(void *priv, struct videobuf_queue *q, char __user *data, size_t count, loff_t *ppos, - int vbihack) + int vbihack, int nonblocking) { unsigned int *fc, bytes; int err, retval; @@ -925,7 +926,7 @@ ssize_t videobuf_read_stream(struct file *file, struct videobuf_queue *q, if (q->streaming) goto done; if (!q->reading) { - retval = videobuf_read_start(file,q); + retval = videobuf_read_start(priv,q); if (retval < 0) goto done; } @@ -940,8 +941,7 @@ ssize_t videobuf_read_stream(struct file *file, struct videobuf_queue *q, list_del(&q->read_buf->stream); q->read_off = 0; } - err = videobuf_waiton(q->read_buf, - file->f_flags & O_NONBLOCK,1); + err = videobuf_waiton(q->read_buf, nonblocking, 1); if (err < 0) { if (0 == retval) retval = err; @@ -986,7 +986,7 @@ ssize_t videobuf_read_stream(struct file *file, struct videobuf_queue *q, list_add_tail(&q->read_buf->stream, &q->stream); spin_lock_irqsave(q->irqlock,flags); - q->ops->buf_queue(file,q->read_buf); + q->ops->buf_queue(priv,q->read_buf); spin_unlock_irqrestore(q->irqlock,flags); q->read_buf = NULL; } @@ -999,7 +999,7 @@ ssize_t videobuf_read_stream(struct file *file, struct videobuf_queue *q, return retval; } -unsigned int videobuf_poll_stream(struct file *file, +unsigned int videobuf_poll_stream(void *priv, struct videobuf_queue *q, poll_table *wait) { @@ -1013,7 +1013,7 @@ unsigned int videobuf_poll_stream(struct file *file, struct videobuf_buffer, stream); } else { if (!q->reading) - videobuf_read_start(file,q); + videobuf_read_start(priv,q); if (!q->reading) { rc = POLLERR; } else if (NULL == q->read_buf) { @@ -1029,7 +1029,7 @@ unsigned int videobuf_poll_stream(struct file *file, rc = POLLERR; if (0 == rc) { - poll_wait(file, &buf->done, wait); + poll_wait(priv, &buf->done, wait); if (buf->state == STATE_DONE || buf->state == STATE_ERROR) rc = POLLIN|POLLRDNORM; @@ -1123,14 +1123,14 @@ static struct vm_operations_struct videobuf_vm_ops = .nopage = videobuf_vm_nopage, }; -int videobuf_mmap_setup(struct file *file, struct videobuf_queue *q, +int videobuf_mmap_setup(void *priv, struct videobuf_queue *q, unsigned int bcount, unsigned int bsize, enum v4l2_memory memory) { unsigned int i; int err; - err = videobuf_mmap_free(file,q); + err = videobuf_mmap_free(priv,q); if (0 != err) return err; @@ -1155,7 +1155,7 @@ int videobuf_mmap_setup(struct file *file, struct videobuf_queue *q, return 0; } -int videobuf_mmap_free(struct file *file, struct videobuf_queue *q) +int videobuf_mmap_free(void *priv, struct videobuf_queue *q) { int i; @@ -1165,7 +1165,7 @@ int videobuf_mmap_free(struct file *file, struct videobuf_queue *q) for (i = 0; i < VIDEO_MAX_FRAME; i++) { if (NULL == q->bufs[i]) continue; - q->ops->buf_release(file,q->bufs[i]); + q->ops->buf_release(priv,q->bufs[i]); kfree(q->bufs[i]); q->bufs[i] = NULL; } |