Commit 3c822205 authored by Gerd Knorr's avatar Gerd Knorr Committed by Linus Torvalds

[PATCH] v4l: avoid using struct file ptrs in video-buf

This patch makes the video-buf helper module pass through a void pointer
instead of a struct file pointer, that makes the code also usable when no
file pointer is available.  This is needed for when using the video-buf
infrastructure to manage DMA buffers for DVB cards.

The file pointer was used by the videobuf_queue_ops callbacks to get the
drivers private data via file->private_data, now a pointer to the drivers's
private data can be passed directly.

Adaptions of the drivers follow with separate patches.
Signed-off-by: default avatarGerd Knorr <kraxel@bytesex.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent ae7d4c86
/* /*
* $Id: video-buf.c,v 1.12 2004/10/11 14:53:13 kraxel Exp $
*
* generic helper functions for video4linux capture buffers, to handle * generic helper functions for video4linux capture buffers, to handle
* memory management and PCI DMA. Right now bttv + saa7134 use it. * memory management and PCI DMA. Right now bttv + saa7134 use it.
* *
...@@ -418,7 +420,7 @@ videobuf_queue_is_busy(struct videobuf_queue *q) ...@@ -418,7 +420,7 @@ videobuf_queue_is_busy(struct videobuf_queue *q)
} }
void void
videobuf_queue_cancel(struct file *file, struct videobuf_queue *q) videobuf_queue_cancel(void *priv, struct videobuf_queue *q)
{ {
unsigned long flags; unsigned long flags;
int i; int i;
...@@ -439,7 +441,7 @@ videobuf_queue_cancel(struct file *file, struct videobuf_queue *q) ...@@ -439,7 +441,7 @@ videobuf_queue_cancel(struct file *file, struct videobuf_queue *q)
for (i = 0; i < VIDEO_MAX_FRAME; i++) { for (i = 0; i < VIDEO_MAX_FRAME; i++) {
if (NULL == q->bufs[i]) if (NULL == q->bufs[i])
continue; continue;
q->ops->buf_release(file,q->bufs[i]); q->ops->buf_release(priv,q->bufs[i]);
} }
INIT_LIST_HEAD(&q->stream); INIT_LIST_HEAD(&q->stream);
} }
...@@ -521,7 +523,7 @@ videobuf_status(struct v4l2_buffer *b, struct videobuf_buffer *vb, ...@@ -521,7 +523,7 @@ videobuf_status(struct v4l2_buffer *b, struct videobuf_buffer *vb,
} }
int int
videobuf_reqbufs(struct file *file, struct videobuf_queue *q, videobuf_reqbufs(void *priv, struct videobuf_queue *q,
struct v4l2_requestbuffers *req) struct v4l2_requestbuffers *req)
{ {
unsigned int size,count; unsigned int size,count;
...@@ -546,12 +548,12 @@ videobuf_reqbufs(struct file *file, struct videobuf_queue *q, ...@@ -546,12 +548,12 @@ videobuf_reqbufs(struct file *file, struct videobuf_queue *q,
if (count > VIDEO_MAX_FRAME) if (count > VIDEO_MAX_FRAME)
count = VIDEO_MAX_FRAME; count = VIDEO_MAX_FRAME;
size = 0; size = 0;
q->ops->buf_setup(file,&count,&size); q->ops->buf_setup(priv,&count,&size);
size = PAGE_ALIGN(size); size = PAGE_ALIGN(size);
dprintk(1,"reqbufs: bufs=%d, size=0x%x [%d pages total]\n", dprintk(1,"reqbufs: bufs=%d, size=0x%x [%d pages total]\n",
count, size, (count*size)>>PAGE_SHIFT); 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) if (retval < 0)
goto done; goto done;
...@@ -576,7 +578,7 @@ videobuf_querybuf(struct videobuf_queue *q, struct v4l2_buffer *b) ...@@ -576,7 +578,7 @@ videobuf_querybuf(struct videobuf_queue *q, struct v4l2_buffer *b)
} }
int int
videobuf_qbuf(struct file *file, struct videobuf_queue *q, videobuf_qbuf(void *priv, struct videobuf_queue *q,
struct v4l2_buffer *b) struct v4l2_buffer *b)
{ {
struct videobuf_buffer *buf; struct videobuf_buffer *buf;
...@@ -620,7 +622,7 @@ videobuf_qbuf(struct file *file, struct videobuf_queue *q, ...@@ -620,7 +622,7 @@ videobuf_qbuf(struct file *file, struct videobuf_queue *q,
if (b->length < buf->bsize) if (b->length < buf->bsize)
goto done; goto done;
if (STATE_NEEDS_INIT != buf->state && buf->baddr != b->m.userptr) 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; buf->baddr = b->m.userptr;
break; break;
case V4L2_MEMORY_OVERLAY: case V4L2_MEMORY_OVERLAY:
...@@ -631,14 +633,14 @@ videobuf_qbuf(struct file *file, struct videobuf_queue *q, ...@@ -631,14 +633,14 @@ videobuf_qbuf(struct file *file, struct videobuf_queue *q,
} }
field = videobuf_next_field(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) if (0 != retval)
goto done; goto done;
list_add_tail(&buf->stream,&q->stream); list_add_tail(&buf->stream,&q->stream);
if (q->streaming) { if (q->streaming) {
spin_lock_irqsave(q->irqlock,flags); spin_lock_irqsave(q->irqlock,flags);
q->ops->buf_queue(file,buf); q->ops->buf_queue(priv,buf);
spin_unlock_irqrestore(q->irqlock,flags); spin_unlock_irqrestore(q->irqlock,flags);
} }
retval = 0; retval = 0;
...@@ -649,8 +651,8 @@ videobuf_qbuf(struct file *file, struct videobuf_queue *q, ...@@ -649,8 +651,8 @@ videobuf_qbuf(struct file *file, struct videobuf_queue *q,
} }
int int
videobuf_dqbuf(struct file *file, struct videobuf_queue *q, videobuf_dqbuf(void *priv, struct videobuf_queue *q,
struct v4l2_buffer *b) struct v4l2_buffer *b, int nonblocking)
{ {
struct videobuf_buffer *buf; struct videobuf_buffer *buf;
int retval; int retval;
...@@ -665,7 +667,7 @@ videobuf_dqbuf(struct file *file, struct videobuf_queue *q, ...@@ -665,7 +667,7 @@ videobuf_dqbuf(struct file *file, struct videobuf_queue *q,
if (list_empty(&q->stream)) if (list_empty(&q->stream))
goto done; goto done;
buf = list_entry(q->stream.next, struct videobuf_buffer, stream); 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) if (retval < 0)
goto done; goto done;
switch (buf->state) { switch (buf->state) {
...@@ -689,7 +691,7 @@ videobuf_dqbuf(struct file *file, struct videobuf_queue *q, ...@@ -689,7 +691,7 @@ videobuf_dqbuf(struct file *file, struct videobuf_queue *q,
return retval; 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 videobuf_buffer *buf;
struct list_head *list; struct list_head *list;
...@@ -708,7 +710,7 @@ int videobuf_streamon(struct file *file, struct videobuf_queue *q) ...@@ -708,7 +710,7 @@ int videobuf_streamon(struct file *file, struct videobuf_queue *q)
list_for_each(list,&q->stream) { list_for_each(list,&q->stream) {
buf = list_entry(list, struct videobuf_buffer, stream); buf = list_entry(list, struct videobuf_buffer, stream);
if (buf->state == STATE_PREPARED) if (buf->state == STATE_PREPARED)
q->ops->buf_queue(file,buf); q->ops->buf_queue(priv,buf);
} }
spin_unlock_irqrestore(q->irqlock,flags); spin_unlock_irqrestore(q->irqlock,flags);
...@@ -717,14 +719,14 @@ int videobuf_streamon(struct file *file, struct videobuf_queue *q) ...@@ -717,14 +719,14 @@ int videobuf_streamon(struct file *file, struct videobuf_queue *q)
return retval; return retval;
} }
int videobuf_streamoff(struct file *file, struct videobuf_queue *q) int videobuf_streamoff(void *priv, struct videobuf_queue *q)
{ {
int retval = -EINVAL; int retval = -EINVAL;
down(&q->lock); down(&q->lock);
if (!q->streaming) if (!q->streaming)
goto done; goto done;
videobuf_queue_cancel(file,q); videobuf_queue_cancel(priv,q);
q->streaming = 0; q->streaming = 0;
retval = 0; retval = 0;
...@@ -734,7 +736,7 @@ int videobuf_streamoff(struct file *file, struct videobuf_queue *q) ...@@ -734,7 +736,7 @@ int videobuf_streamoff(struct file *file, struct videobuf_queue *q)
} }
static ssize_t 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) char __user *data, size_t count, loff_t *ppos)
{ {
enum v4l2_field field; enum v4l2_field field;
...@@ -751,13 +753,13 @@ videobuf_read_zerocopy(struct file *file, struct videobuf_queue *q, ...@@ -751,13 +753,13 @@ videobuf_read_zerocopy(struct file *file, struct videobuf_queue *q,
q->read_buf->baddr = (unsigned long)data; q->read_buf->baddr = (unsigned long)data;
q->read_buf->bsize = count; q->read_buf->bsize = count;
field = videobuf_next_field(q); 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) if (0 != retval)
goto done; goto done;
/* start capture & wait */ /* start capture & wait */
spin_lock_irqsave(q->irqlock,flags); 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); spin_unlock_irqrestore(q->irqlock,flags);
retval = videobuf_waiton(q->read_buf,0,0); retval = videobuf_waiton(q->read_buf,0,0);
if (0 == retval) { if (0 == retval) {
...@@ -770,14 +772,15 @@ videobuf_read_zerocopy(struct file *file, struct videobuf_queue *q, ...@@ -770,14 +772,15 @@ videobuf_read_zerocopy(struct file *file, struct videobuf_queue *q,
done: done:
/* cleanup */ /* cleanup */
q->ops->buf_release(file,q->read_buf); q->ops->buf_release(priv,q->read_buf);
kfree(q->read_buf); kfree(q->read_buf);
q->read_buf = NULL; q->read_buf = NULL;
return retval; return retval;
} }
ssize_t videobuf_read_one(struct file *file, struct videobuf_queue *q, ssize_t videobuf_read_one(void *priv, struct videobuf_queue *q,
char __user *data, size_t count, loff_t *ppos) char __user *data, size_t count, loff_t *ppos,
int nonblocking)
{ {
enum v4l2_field field; enum v4l2_field field;
unsigned long flags; unsigned long flags;
...@@ -787,11 +790,11 @@ ssize_t videobuf_read_one(struct file *file, struct videobuf_queue *q, ...@@ -787,11 +790,11 @@ ssize_t videobuf_read_one(struct file *file, struct videobuf_queue *q,
down(&q->lock); down(&q->lock);
nbufs = 1; size = 0; nbufs = 1; size = 0;
q->ops->buf_setup(file,&nbufs,&size); q->ops->buf_setup(priv,&nbufs,&size);
if (NULL == q->read_buf && if (NULL == q->read_buf &&
count >= size && count >= size &&
!(file->f_flags & O_NONBLOCK)) { !nonblocking) {
retval = videobuf_read_zerocopy(file,q,data,count,ppos); retval = videobuf_read_zerocopy(priv,q,data,count,ppos);
if (retval >= 0 || retval == -EIO) if (retval >= 0 || retval == -EIO)
/* ok, all done */ /* ok, all done */
goto done; goto done;
...@@ -806,24 +809,24 @@ ssize_t videobuf_read_one(struct file *file, struct videobuf_queue *q, ...@@ -806,24 +809,24 @@ ssize_t videobuf_read_one(struct file *file, struct videobuf_queue *q,
goto done; goto done;
q->read_buf->memory = V4L2_MEMORY_USERPTR; q->read_buf->memory = V4L2_MEMORY_USERPTR;
field = videobuf_next_field(q); 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) if (0 != retval)
goto done; goto done;
spin_lock_irqsave(q->irqlock,flags); 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); spin_unlock_irqrestore(q->irqlock,flags);
q->read_off = 0; q->read_off = 0;
} }
/* wait until capture is done */ /* 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) if (0 != retval)
goto done; goto done;
videobuf_dma_pci_sync(q->pci,&q->read_buf->dma); videobuf_dma_pci_sync(q->pci,&q->read_buf->dma);
if (STATE_ERROR == q->read_buf->state) { if (STATE_ERROR == q->read_buf->state) {
/* catch I/O errors */ /* catch I/O errors */
q->ops->buf_release(file,q->read_buf); q->ops->buf_release(priv,q->read_buf);
kfree(q->read_buf); kfree(q->read_buf);
q->read_buf = NULL; q->read_buf = NULL;
retval = -EIO; retval = -EIO;
...@@ -842,7 +845,7 @@ ssize_t videobuf_read_one(struct file *file, struct videobuf_queue *q, ...@@ -842,7 +845,7 @@ ssize_t videobuf_read_one(struct file *file, struct videobuf_queue *q,
q->read_off += bytes; q->read_off += bytes;
if (q->read_off == q->read_buf->size) { if (q->read_off == q->read_buf->size) {
/* all data copied, cleanup */ /* all data copied, cleanup */
q->ops->buf_release(file,q->read_buf); q->ops->buf_release(priv,q->read_buf);
kfree(q->read_buf); kfree(q->read_buf);
q->read_buf = NULL; q->read_buf = NULL;
} }
...@@ -852,43 +855,43 @@ ssize_t videobuf_read_one(struct file *file, struct videobuf_queue *q, ...@@ -852,43 +855,43 @@ ssize_t videobuf_read_one(struct file *file, struct videobuf_queue *q,
return retval; 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; enum v4l2_field field;
unsigned long flags; unsigned long flags;
int count = 0, size = 0; int count = 0, size = 0;
int err, i; int err, i;
q->ops->buf_setup(file,&count,&size); q->ops->buf_setup(priv,&count,&size);
if (count < 2) if (count < 2)
count = 2; count = 2;
if (count > VIDEO_MAX_FRAME) if (count > VIDEO_MAX_FRAME)
count = VIDEO_MAX_FRAME; count = VIDEO_MAX_FRAME;
size = PAGE_ALIGN(size); 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) if (err)
return err; return err;
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
field = videobuf_next_field(q); 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) if (err)
return err; return err;
list_add_tail(&q->bufs[i]->stream, &q->stream); list_add_tail(&q->bufs[i]->stream, &q->stream);
} }
spin_lock_irqsave(q->irqlock,flags); spin_lock_irqsave(q->irqlock,flags);
for (i = 0; i < count; i++) 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); spin_unlock_irqrestore(q->irqlock,flags);
q->reading = 1; q->reading = 1;
return 0; 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; int i;
videobuf_queue_cancel(file,q); videobuf_queue_cancel(priv,q);
INIT_LIST_HEAD(&q->stream); INIT_LIST_HEAD(&q->stream);
for (i = 0; i < VIDEO_MAX_FRAME; i++) { for (i = 0; i < VIDEO_MAX_FRAME; i++) {
if (NULL == q->bufs[i]) if (NULL == q->bufs[i])
...@@ -900,20 +903,21 @@ void videobuf_read_stop(struct file *file, struct videobuf_queue *q) ...@@ -900,20 +903,21 @@ void videobuf_read_stop(struct file *file, struct videobuf_queue *q)
q->reading = 0; 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, char __user *data, size_t count, loff_t *ppos,
int vbihack) int vbihack, int nonblocking)
{ {
unsigned int *fc, bytes; unsigned int *fc, bytes;
int err, retval; int err, retval;
unsigned long flags; unsigned long flags;
dprintk(2,"%s\n",__FUNCTION__);
down(&q->lock); down(&q->lock);
retval = -EBUSY; retval = -EBUSY;
if (q->streaming) if (q->streaming)
goto done; goto done;
if (!q->reading) { if (!q->reading) {
retval = videobuf_read_start(file,q); retval = videobuf_read_start(priv,q);
if (retval < 0) if (retval < 0)
goto done; goto done;
} }
...@@ -928,8 +932,7 @@ ssize_t videobuf_read_stream(struct file *file, struct videobuf_queue *q, ...@@ -928,8 +932,7 @@ ssize_t videobuf_read_stream(struct file *file, struct videobuf_queue *q,
list_del(&q->read_buf->stream); list_del(&q->read_buf->stream);
q->read_off = 0; q->read_off = 0;
} }
err = videobuf_waiton(q->read_buf, err = videobuf_waiton(q->read_buf, nonblocking, 1);
file->f_flags & O_NONBLOCK,1);
if (err < 0) { if (err < 0) {
if (0 == retval) if (0 == retval)
retval = err; retval = err;
...@@ -974,7 +977,7 @@ ssize_t videobuf_read_stream(struct file *file, struct videobuf_queue *q, ...@@ -974,7 +977,7 @@ ssize_t videobuf_read_stream(struct file *file, struct videobuf_queue *q,
list_add_tail(&q->read_buf->stream, list_add_tail(&q->read_buf->stream,
&q->stream); &q->stream);
spin_lock_irqsave(q->irqlock,flags); 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); spin_unlock_irqrestore(q->irqlock,flags);
q->read_buf = NULL; q->read_buf = NULL;
} }
...@@ -987,7 +990,7 @@ ssize_t videobuf_read_stream(struct file *file, struct videobuf_queue *q, ...@@ -987,7 +990,7 @@ ssize_t videobuf_read_stream(struct file *file, struct videobuf_queue *q,
return retval; return retval;
} }
unsigned int videobuf_poll_stream(struct file *file, unsigned int videobuf_poll_stream(struct file *file, void *priv,
struct videobuf_queue *q, struct videobuf_queue *q,
poll_table *wait) poll_table *wait)
{ {
...@@ -1001,7 +1004,7 @@ unsigned int videobuf_poll_stream(struct file *file, ...@@ -1001,7 +1004,7 @@ unsigned int videobuf_poll_stream(struct file *file,
struct videobuf_buffer, stream); struct videobuf_buffer, stream);
} else { } else {
if (!q->reading) if (!q->reading)
videobuf_read_start(file,q); videobuf_read_start(priv,q);
if (!q->reading) { if (!q->reading) {
rc = POLLERR; rc = POLLERR;
} else if (NULL == q->read_buf) { } else if (NULL == q->read_buf) {
...@@ -1100,14 +1103,14 @@ static struct vm_operations_struct videobuf_vm_ops = ...@@ -1100,14 +1103,14 @@ static struct vm_operations_struct videobuf_vm_ops =
.nopage = videobuf_vm_nopage, .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, unsigned int bcount, unsigned int bsize,
enum v4l2_memory memory) enum v4l2_memory memory)
{ {
unsigned int i; unsigned int i;
int err; int err;
err = videobuf_mmap_free(file,q); err = videobuf_mmap_free(priv,q);
if (0 != err) if (0 != err)
return err; return err;
...@@ -1132,7 +1135,7 @@ int videobuf_mmap_setup(struct file *file, struct videobuf_queue *q, ...@@ -1132,7 +1135,7 @@ int videobuf_mmap_setup(struct file *file, struct videobuf_queue *q,
return 0; 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; int i;
...@@ -1142,7 +1145,7 @@ int videobuf_mmap_free(struct file *file, struct videobuf_queue *q) ...@@ -1142,7 +1145,7 @@ int videobuf_mmap_free(struct file *file, struct videobuf_queue *q)
for (i = 0; i < VIDEO_MAX_FRAME; i++) { for (i = 0; i < VIDEO_MAX_FRAME; i++) {
if (NULL == q->bufs[i]) if (NULL == q->bufs[i])
continue; continue;
q->ops->buf_release(file,q->bufs[i]); q->ops->buf_release(priv,q->bufs[i]);
kfree(q->bufs[i]); kfree(q->bufs[i]);
q->bufs[i] = NULL; q->bufs[i] = NULL;
} }
......
/* /*
* $Id: video-buf.h,v 1.7 2004/10/11 14:53:13 kraxel Exp $
*
* generic helper functions for video4linux capture buffers, to handle * generic helper functions for video4linux capture buffers, to handle
* memory management and PCI DMA. Right now bttv + saa7134 use it. * memory management and PCI DMA. Right now bttv + saa7134 use it.
* *
...@@ -165,12 +167,12 @@ struct videobuf_buffer { ...@@ -165,12 +167,12 @@ struct videobuf_buffer {
}; };
struct videobuf_queue_ops { struct videobuf_queue_ops {
int (*buf_setup)(struct file *file, int (*buf_setup)(void *priv,
unsigned int *count, unsigned int *size); unsigned int *count, unsigned int *size);
int (*buf_prepare)(struct file *file,struct videobuf_buffer *vb, int (*buf_prepare)(void *priv,struct videobuf_buffer *vb,
enum v4l2_field field); enum v4l2_field field);
void (*buf_queue)(struct file *file,struct videobuf_buffer *vb); void (*buf_queue)(void *priv,struct videobuf_buffer *vb);
void (*buf_release)(struct file *file,struct videobuf_buffer *vb); void (*buf_release)(void *priv,struct videobuf_buffer *vb);
}; };
struct videobuf_queue { struct videobuf_queue {
...@@ -208,36 +210,37 @@ void videobuf_queue_init(struct videobuf_queue *q, ...@@ -208,36 +210,37 @@ void videobuf_queue_init(struct videobuf_queue *q,
enum v4l2_field field, enum v4l2_field field,
unsigned int msize); unsigned int msize);
int videobuf_queue_is_busy(struct videobuf_queue *q); int videobuf_queue_is_busy(struct videobuf_queue *q);
void videobuf_queue_cancel(struct file *file, struct videobuf_queue *q); void videobuf_queue_cancel(void *priv, struct videobuf_queue *q);
enum v4l2_field videobuf_next_field(struct videobuf_queue *q); enum v4l2_field videobuf_next_field(struct videobuf_queue *q);
void videobuf_status(struct v4l2_buffer *b, struct videobuf_buffer *vb, void videobuf_status(struct v4l2_buffer *b, struct videobuf_buffer *vb,
enum v4l2_buf_type type); enum v4l2_buf_type type);
int videobuf_reqbufs(struct file *file, struct videobuf_queue *q, int videobuf_reqbufs(void *priv, struct videobuf_queue *q,
struct v4l2_requestbuffers *req); struct v4l2_requestbuffers *req);
int videobuf_querybuf(struct videobuf_queue *q, struct v4l2_buffer *b); int videobuf_querybuf(struct videobuf_queue *q, struct v4l2_buffer *b);
int videobuf_qbuf(struct file *file, struct videobuf_queue *q, int videobuf_qbuf(void *priv, struct videobuf_queue *q,
struct v4l2_buffer *b); struct v4l2_buffer *b);
int videobuf_dqbuf(struct file *file, struct videobuf_queue *q, int videobuf_dqbuf(void *priv, struct videobuf_queue *q,
struct v4l2_buffer *b); struct v4l2_buffer *b, int nonblocking);
int videobuf_streamon(struct file *file, struct videobuf_queue *q); int videobuf_streamon(void *priv, struct videobuf_queue *q);
int videobuf_streamoff(struct file *file, struct videobuf_queue *q); int videobuf_streamoff(void *priv, struct videobuf_queue *q);
int videobuf_read_start(struct file *file, struct videobuf_queue *q); int videobuf_read_start(void *priv, struct videobuf_queue *q);
void videobuf_read_stop(struct file *file, struct videobuf_queue *q); void videobuf_read_stop(void *priv, struct videobuf_queue *q);
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, char __user *data, size_t count, loff_t *ppos,
int vbihack); int vbihack, int nonblocking);
ssize_t videobuf_read_one(struct file *file, struct videobuf_queue *q, ssize_t videobuf_read_one(void *priv, struct videobuf_queue *q,
char __user *data, size_t count, loff_t *ppos); char __user *data, size_t count, loff_t *ppos,
unsigned int videobuf_poll_stream(struct file *file, int nonblocking);
unsigned int videobuf_poll_stream(struct file *file, void *priv,
struct videobuf_queue *q, struct videobuf_queue *q,
poll_table *wait); poll_table *wait);
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, unsigned int bcount, unsigned int bsize,
enum v4l2_memory memory); enum v4l2_memory memory);
int videobuf_mmap_free(struct file *file, struct videobuf_queue *q); int videobuf_mmap_free(void *priv, struct videobuf_queue *q);
int videobuf_mmap_mapper(struct vm_area_struct *vma, int videobuf_mmap_mapper(struct vm_area_struct *vma,
struct videobuf_queue *q); struct videobuf_queue *q);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment