Re: [PATCH 1/1] staging: imgu: Use vmap() instead of __get_vm_area() and map_vm_area()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, Sakari

On 4/17/20 8:54 PM, Sakari Ailus wrote:
> Switch to vmap() instead of using both __get_vm_area() and map_vm_area().
> 
> While at it, also assign vm_struct.nr_pages field.
> 
> Reported-by: Christoph Hellwig <hch@xxxxxxxxxxxxx>
> Signed-off-by: Sakari Ailus <sakari.ailus@xxxxxxxxxxxxxxx>
> ---
> This is just compile tested but reasonably trivial.
> 
>  drivers/staging/media/ipu3/ipu3-dmamap.c | 11 ++---------
>  1 file changed, 2 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/staging/media/ipu3/ipu3-dmamap.c b/drivers/staging/media/ipu3/ipu3-dmamap.c
> index 7431322379f6..58e6683e5770 100644
> --- a/drivers/staging/media/ipu3/ipu3-dmamap.c
> +++ b/drivers/staging/media/ipu3/ipu3-dmamap.c
> @@ -123,16 +123,12 @@ void *imgu_dmamap_alloc(struct imgu_device *imgu, struct imgu_css_map *map,
>  		iovaddr += PAGE_SIZE;
>  	}
>  
> -	/* Now grab a virtual region */
> -	map->vma = __get_vm_area(size, VM_USERMAP, VMALLOC_START, VMALLOC_END);
> +	map->vma = vmap(pages, size / PAGE_SIZE, VM_USERMAP, PAGE_KERNEL);

vmap() returns the address of virtual area not the area itself, right?

>  	if (!map->vma)
>  		goto out_unmap;
>  
>  	map->vma->pages = pages;
> -	/* And map it in KVA */
> -	if (map_vm_area(map->vma, PAGE_KERNEL, pages))
> -		goto out_vunmap;
> -
> +	map->vma->nr_pages = size / PAGE_SIZE;
>  	map->size = size;
>  	map->daddr = iova_dma_addr(&imgu->iova_domain, iova);
>  	map->vaddr = map->vma->addr;
> @@ -142,9 +138,6 @@ void *imgu_dmamap_alloc(struct imgu_device *imgu, struct imgu_css_map *map,
>  
>  	return map->vma->addr;
>  
> -out_vunmap:
> -	vunmap(map->vma->addr);
> -
>  out_unmap:
>  	imgu_dmamap_free_buffer(pages, size);
>  	imgu_mmu_unmap(imgu->mmu, iova_dma_addr(&imgu->iova_domain, iova),
> 

-- 
Best regards,
Bingbu Cao



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux