diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2011-10-24 10:49:19 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-12-11 08:12:05 -0500 |
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 677691c44500..0fbb04bc0b04 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, | |||
173 | queue->buffer[i].buf.field = V4L2_FIELD_NONE; | 173 | queue->buffer[i].buf.field = V4L2_FIELD_NONE; |
174 | queue->buffer[i].buf.memory = V4L2_MEMORY_MMAP; | 174 | queue->buffer[i].buf.memory = V4L2_MEMORY_MMAP; |
175 | queue->buffer[i].buf.flags = 0; | 175 | queue->buffer[i].buf.flags = 0; |
176 | |||
177 | queue->buffer[i].mem = queue->mem + i * bufsize; | ||
178 | queue->buffer[i].length = buflength; | ||
176 | init_waitqueue_head(&queue->buffer[i].wait); | 179 | init_waitqueue_head(&queue->buffer[i].wait); |
177 | } | 180 | } |
178 | 181 | ||
@@ -293,9 +296,9 @@ int uvc_queue_buffer(struct uvc_video_queue *queue, | |||
293 | } | 296 | } |
294 | buf->state = UVC_BUF_STATE_QUEUED; | 297 | buf->state = UVC_BUF_STATE_QUEUED; |
295 | if (v4l2_buf->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) | 298 | if (v4l2_buf->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) |
296 | buf->buf.bytesused = 0; | 299 | buf->bytesused = 0; |
297 | else | 300 | else |
298 | buf->buf.bytesused = v4l2_buf->bytesused; | 301 | buf->bytesused = v4l2_buf->bytesused; |
299 | 302 | ||
300 | list_add_tail(&buf->stream, &queue->mainqueue); | 303 | list_add_tail(&buf->stream, &queue->mainqueue); |
301 | list_add_tail(&buf->queue, &queue->irqqueue); | 304 | 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) | |||
437 | */ | 440 | */ |
438 | vma->vm_flags |= VM_IO; | 441 | vma->vm_flags |= VM_IO; |
439 | 442 | ||
440 | addr = (unsigned long)queue->mem + buffer->buf.m.offset; | 443 | addr = (unsigned long)buffer->mem; |
441 | #ifdef CONFIG_MMU | 444 | #ifdef CONFIG_MMU |
442 | while (size > 0) { | 445 | while (size > 0) { |
443 | page = vmalloc_to_page((void *)addr); | 446 | page = vmalloc_to_page((void *)addr); |
@@ -515,7 +518,7 @@ unsigned long uvc_queue_get_unmapped_area(struct uvc_video_queue *queue, | |||
515 | ret = -EINVAL; | 518 | ret = -EINVAL; |
516 | goto done; | 519 | goto done; |
517 | } | 520 | } |
518 | ret = (unsigned long)queue->mem + buffer->buf.m.offset; | 521 | ret = (unsigned long)buf->mem; |
519 | done: | 522 | done: |
520 | mutex_unlock(&queue->mutex); | 523 | mutex_unlock(&queue->mutex); |
521 | return ret; | 524 | return ret; |
@@ -621,6 +624,7 @@ struct uvc_buffer *uvc_queue_next_buffer(struct uvc_video_queue *queue, | |||
621 | list_del(&buf->queue); | 624 | list_del(&buf->queue); |
622 | buf->error = 0; | 625 | buf->error = 0; |
623 | buf->state = UVC_BUF_STATE_DONE; | 626 | buf->state = UVC_BUF_STATE_DONE; |
627 | buf->buf.bytesused = buf->bytesused; | ||
624 | if (!list_empty(&queue->irqqueue)) | 628 | if (!list_empty(&queue->irqqueue)) |
625 | nextbuf = list_first_entry(&queue->irqqueue, struct uvc_buffer, | 629 | nextbuf = list_first_entry(&queue->irqqueue, struct uvc_buffer, |
626 | queue); | 630 | queue); |