Re: [PATCH] media: videobuf2-dma-sg: use v{un,}map instead of vm_{un,}map_ram

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

 



On 21/11/2022 00:44, Michael Grzeschik wrote:
> The comments before the vm_map_ram function state that it should be used
> for up to 256 KB only, and video buffers are definitely much larger. It
> recommends using vmap in that case.
> 
> Signed-off-by: Michael Grzeschik <m.grzeschik@xxxxxxxxxxxxxx>
> ---
>  drivers/media/common/videobuf2/videobuf2-dma-sg.c | 7 ++++---

drivers/media/common/videobuf2/videobuf2-vmalloc.c uses it as well,
probably also incorrectly. It makes sense to change that one as well.

Regards,

	Hans

>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/media/common/videobuf2/videobuf2-dma-sg.c b/drivers/media/common/videobuf2/videobuf2-dma-sg.c
> index dcb8de5ab3e84a..e86621fba350f3 100644
> --- a/drivers/media/common/videobuf2/videobuf2-dma-sg.c
> +++ b/drivers/media/common/videobuf2/videobuf2-dma-sg.c
> @@ -188,7 +188,7 @@ static void vb2_dma_sg_put(void *buf_priv)
>  		dma_unmap_sgtable(buf->dev, sgt, buf->dma_dir,
>  				  DMA_ATTR_SKIP_CPU_SYNC);
>  		if (buf->vaddr)
> -			vm_unmap_ram(buf->vaddr, buf->num_pages);
> +			vunmap(buf->vaddr);
>  		sg_free_table(buf->dma_sgt);
>  		while (--i >= 0)
>  			__free_page(buf->pages[i]);
> @@ -289,7 +289,7 @@ static void vb2_dma_sg_put_userptr(void *buf_priv)
>  	       __func__, buf->num_pages);
>  	dma_unmap_sgtable(buf->dev, sgt, buf->dma_dir, DMA_ATTR_SKIP_CPU_SYNC);
>  	if (buf->vaddr)
> -		vm_unmap_ram(buf->vaddr, buf->num_pages);
> +		vunmap(buf->vaddr);
>  	sg_free_table(buf->dma_sgt);
>  	if (buf->dma_dir == DMA_FROM_DEVICE ||
>  	    buf->dma_dir == DMA_BIDIRECTIONAL)
> @@ -312,7 +312,8 @@ static void *vb2_dma_sg_vaddr(struct vb2_buffer *vb, void *buf_priv)
>  			ret = dma_buf_vmap(buf->db_attach->dmabuf, &map);
>  			buf->vaddr = ret ? NULL : map.vaddr;
>  		} else {
> -			buf->vaddr = vm_map_ram(buf->pages, buf->num_pages, -1);
> +			buf->vaddr = vmap(buf->pages, buf->num_pages, VM_MAP,
> +					  PAGE_KERNEL);
>  		}
>  	}
>  




[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