lkml.org 
[lkml]   [2008]   [Nov]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] Video/UVC: Port mainlined uvc video driver to NOMMU
Date
Hi Bryan, Michael,

On Thursday 06 November 2008, Bryan Wu wrote:
> From: Michael Hennerich <michael.hennerich@analog.com>
>
> Add NOMMU mmap support.
>
> Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
> Signed-off-by: Bryan Wu <cooloney@kernel.org>
> ---
> drivers/media/video/uvc/uvc_v4l2.c | 14 ++++++++++++++
> 1 files changed, 14 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/media/video/uvc/uvc_v4l2.c
> b/drivers/media/video/uvc/uvc_v4l2.c index 758dfef..2237f5e 100644
> --- a/drivers/media/video/uvc/uvc_v4l2.c
> +++ b/drivers/media/video/uvc/uvc_v4l2.c
> @@ -1050,6 +1050,7 @@ static int uvc_v4l2_mmap(struct file *file, struct
> vm_area_struct *vma) break;
> }
>
> +#ifdef CONFIG_MMU
> if (i == video->queue.count || size != video->queue.buf_size) {
> ret = -EINVAL;
> goto done;
> @@ -1071,7 +1072,20 @@ static int uvc_v4l2_mmap(struct file *file, struct
> vm_area_struct *vma) addr += PAGE_SIZE;
> size -= PAGE_SIZE;
> }
> +#else
> + if (i == video->queue.count ||
> + PAGE_ALIGN(size) != video->queue.buf_size) {

Just out of curiosity, why do you need to PAGE_ALIGN size for non-MMU
platforms ?

> + ret = -EINVAL;
> + goto done;
> + }
> +
> + vma->vm_flags |= VM_IO | VM_MAYSHARE; /* documentation/nommu-mmap.txt */

VM_MAYSHARE is not documented anywhere in Documentation/ in Linux 2.6.28-rc3.
Why is it needed for non-MMU architectures only ?

> +
> + addr = (unsigned long)video->queue.mem + buffer->buf.m.offset;
>
> + vma->vm_start = addr;
> + vma->vm_end = addr + video->queue.buf_size;
> +#endif
> vma->vm_ops = &uvc_vm_ops;
> vma->vm_private_data = buffer;
> uvc_vm_open(vma);

Best regards,

Laurent Pinchart


\
 
 \ /
  Last update: 2008-11-09 22:25    [from the cache]
©2003-2011 Jasper Spaans