diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2011-10-24 11:49:19 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-12-11 11:12:05 -0200 |
commit | 3d95e932573c316ad56b8e2f283e26de0b9c891c (patch) | |
tree | ad5fd2e33f2fe21c67d5b5bc367a8597591f7926 /drivers/media/video/uvc/uvc_queue.c | |
parent | 4be9c8fb58e48cd0110bd9504b0af1e18fa54467 (diff) |
[media] uvcvideo: Move fields from uvc_buffer::buf to uvc_buffer
Add mem, length and bytesused fields to the uvc_buffer structure and use
them instead of accessing the uvc_buffer::buf m.offset, length and
bytesused fields directly. This prepares the driver to the conversion to
videobuf2.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/uvc/uvc_queue.c')
-rw-r--r-- | drivers/media/video/uvc/uvc_queue.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/media/video/uvc/uvc_queue.c b/drivers/media/video/uvc/uvc_queue.c index 677691c4450..0fbb04bc0b0 100644 --- a/drivers/media/video/uvc/uvc_queue.c +++ b/drivers/media/video/uvc/uvc_queue.c @@ -173,6 +173,9 @@ int uvc_alloc_buffers(struct uvc_video_queue *queue, unsigned int nbuffers, queue->buffer[i].buf.field = V4L2_FIELD_NONE; queue->buffer[i].buf.memory = V4L2_MEMORY_MMAP; queue->buffer[i].buf.flags = 0; + + queue->buffer[i].mem = queue->mem + i * bufsize; + queue->buffer[i].length = buflength; init_waitqueue_head(&queue->buffer[i].wait); } @@ -293,9 +296,9 @@ int uvc_queue_buffer(struct uvc_video_queue *queue, } buf->state = UVC_BUF_STATE_QUEUED; if (v4l2_buf->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) - buf->buf.bytesused = 0; + buf->bytesused = 0; else - buf->buf.bytesused = v4l2_buf->bytesused; + buf->bytesused = v4l2_buf->bytesused; list_add_tail(&buf->stream, &queue->mainqueue); list_add_tail(&buf->queue, &queue->irqqueue); @@ -437,7 +440,7 @@ int uvc_queue_mmap(struct uvc_video_queue *queue, struct vm_area_struct *vma) */ vma->vm_flags |= VM_IO; - addr = (unsigned long)queue->mem + buffer->buf.m.offset; + addr = (unsigned long)buffer->mem; #ifdef CONFIG_MMU while (size > 0) { page = vmalloc_to_page((void *)addr); @@ -515,7 +518,7 @@ unsigned long uvc_queue_get_unmapped_area(struct uvc_video_queue *queue, ret = -EINVAL; goto done; } - ret = (unsigned long)queue->mem + buffer->buf.m.offset; + ret = (unsigned long)buf->mem; done: mutex_unlock(&queue->mutex); return ret; @@ -621,6 +624,7 @@ struct uvc_buffer *uvc_queue_next_buffer(struct uvc_video_queue *queue, list_del(&buf->queue); buf->error = 0; buf->state = UVC_BUF_STATE_DONE; + buf->buf.bytesused = buf->bytesused; if (!list_empty(&queue->irqqueue)) nextbuf = list_first_entry(&queue->irqqueue, struct uvc_buffer, queue); |