media: videobuf-dma-contig: use dma_mmap_coherent
authorChristoph Hellwig <hch@lst.de>
Wed, 18 Dec 2019 10:39:07 +0000 (11:39 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 31 Dec 2022 12:32:13 +0000 (13:32 +0100)
commit7d4af96be5359d78a4a6dca0baad896d04ebcf69
treef890d89dae479583c094e241995affcb50274bb5
parentd72bff7e6cc324b31b62826d5fe279c0390e2335
media: videobuf-dma-contig: use dma_mmap_coherent

[ Upstream commit b3dc3f8e49577840dc8ac8a365c5b3da4edb10b8 ]

dma_alloc_coherent does not return a physical address, but a DMA address,
which might be remapped or have an offset.  Passing the DMA address to
vm_iomap_memory is thus broken.

Use the proper dma_mmap_coherent helper instead, and stop passing
__GFP_COMP to dma_alloc_coherent, as the memory management inside the
DMA allocator is hidden from the callers and does not require it.

With this the gfp_t argument to __videobuf_dc_alloc can be removed and
hard coded to GFP_KERNEL.

Fixes: a8f3c203e19b ("[media] videobuf-dma-contig: add cache support")
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/media/v4l2-core/videobuf-dma-contig.c