Hello~ 
There are a lot of code changes compared with version5 patch.
Some minor comments below.

Marek Szyprowski Wrote :
> Sent: Monday, December 06, 2010 7:53 PM
> To: linux-media@vger.kernel.org
> Cc: m.szyprow...@samsung.com; pa...@osciak.com; kyungmin.p...@samsung.com;
> andrze...@samsung.com
> Subject: [PATCH 2/8] v4l: videobuf2: add generic memory handling routines
> 
> From: Pawel Osciak <p.osc...@samsung.com>
> 
> Add generic memory handling routines for userspace pointer handling,
> contiguous memory verification and mapping.

<snip>

> +
> +#include <linux/slab.h>

Same include file is existed.

> +#include <linux/module.h>
> +#include <linux/dma-mapping.h>
> +#include <linux/vmalloc.h>
> +#include <linux/cma.h>
> +#include <linux/mm.h>
> +#include <linux/sched.h>
> +#include <linux/file.h>
> +#include <linux/slab.h>
> +
> +#include <media/videobuf2-core.h>

The " media/videobuf2-memops.h" file already include "videobuf2-core.h"
Why don't you remove it?

> +#include <media/videobuf2-memops.h>
> +
> +/**
> + * vb2_get_vma() - acquire and lock the memory area
> + * @vaddr:   virtual userspace address to the given area
outdated comment

> + *
> + * This function attempts to acquire an area mapped in the userspace for
> + * the duration of a hardware operation.
> + *
> + * Returns a virtual memory region associated with the given vaddr on
> success
> + * or NULL.
> + */
> +struct vm_area_struct *vb2_get_vma(struct vm_area_struct *vma)
> +{
> +     struct vm_area_struct *vma_copy;
> +
> +     vma_copy = kmalloc(sizeof(*vma_copy), GFP_KERNEL);
> +     if (vma_copy == NULL)
> +             return NULL;
> +
> +     if (vma->vm_ops && vma->vm_ops->open)
> +             vma->vm_ops->open(vma);
> +
> +     if (vma->vm_file)
> +             get_file(vma->vm_file);
> +
> +     memcpy(vma_copy, vma, sizeof(*vma));
> +
> +     vma_copy->vm_mm = NULL;
> +     vma_copy->vm_next = NULL;
> +     vma_copy->vm_prev = NULL;
> +
> +     return vma_copy;
> +}
> +
> +/**
> + * vb2_put_userptr() - release a userspace memory area
outdated comment

> + * @vma:     virtual memory region associated with the area to be
> released
> + *
> + * This function releases the previously acquired memory area after a
> hardware
> + * operation.
> + */
> +void vb2_put_vma(struct vm_area_struct *vma)
> +{
> +     if (!vma)
> +             return;
> +
> +     if (vma->vm_file)
> +             fput(vma->vm_file);
> +
> +     if (vma->vm_ops && vma->vm_ops->close)
> +             vma->vm_ops->close(vma);
> +
> +     kfree(vma);
> +}
> +
> +/**
> + * vb2_contig_verify_userptr() - verify contiguity of a userspace-mapped
> memory
outdated comment

> + * @vma:     virtual memory region which maps the physical memory
> + *           to be verified
outdated comment

> + * @vaddr:   starting virtual address of the area to be verified
> + * @size:    size of the area to be verified
> + * @paddr:   will return physical address for the given vaddr
outdated comment

> + *
> + * This function will go through memory area of size size mapped at vaddr
> and
> + * verify that the underlying physical pages are contiguous.
> + *
> + * Returns 0 on success and a physical address to the memory pointed
> + * to by vaddr in paddr.
> + */
> +int vb2_get_contig_userptr(unsigned long vaddr, unsigned long size,
> +                        struct vm_area_struct **res_vma, dma_addr_t *res_pa)
> +{

You mentioned that dma-sg and iommu allocators will definitely call 
get_user_pages().
There are dms-sg allocator in v6 patch. How to apply it?


--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to