Skip to content

Commit aaf6f2f

Browse files
rmurphy-armwildea01
authored andcommitted
arm64: consolidate __swiotlb_mmap
Since commit 9d3bfbb ("arm64: Combine coherent and non-coherent swiotlb dma_ops"), __dma_common_mmap is no longer shared between two callers, so roll it into the remaining one. Signed-off-by: Robin Murphy <[email protected]> Signed-off-by: Will Deacon <[email protected]>
1 parent d3127af commit aaf6f2f

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

arch/arm64/mm/dma-mapping.c

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -303,9 +303,10 @@ static void __swiotlb_sync_sg_for_device(struct device *dev,
303303
sg->length, dir);
304304
}
305305

306-
/* vma->vm_page_prot must be set appropriately before calling this function */
307-
static int __dma_common_mmap(struct device *dev, struct vm_area_struct *vma,
308-
void *cpu_addr, dma_addr_t dma_addr, size_t size)
306+
static int __swiotlb_mmap(struct device *dev,
307+
struct vm_area_struct *vma,
308+
void *cpu_addr, dma_addr_t dma_addr, size_t size,
309+
struct dma_attrs *attrs)
309310
{
310311
int ret = -ENXIO;
311312
unsigned long nr_vma_pages = (vma->vm_end - vma->vm_start) >>
@@ -314,6 +315,9 @@ static int __dma_common_mmap(struct device *dev, struct vm_area_struct *vma,
314315
unsigned long pfn = dma_to_phys(dev, dma_addr) >> PAGE_SHIFT;
315316
unsigned long off = vma->vm_pgoff;
316317

318+
vma->vm_page_prot = __get_dma_pgprot(attrs, vma->vm_page_prot,
319+
is_device_dma_coherent(dev));
320+
317321
if (dma_mmap_from_coherent(dev, vma, cpu_addr, size, &ret))
318322
return ret;
319323

@@ -327,16 +331,6 @@ static int __dma_common_mmap(struct device *dev, struct vm_area_struct *vma,
327331
return ret;
328332
}
329333

330-
static int __swiotlb_mmap(struct device *dev,
331-
struct vm_area_struct *vma,
332-
void *cpu_addr, dma_addr_t dma_addr, size_t size,
333-
struct dma_attrs *attrs)
334-
{
335-
vma->vm_page_prot = __get_dma_pgprot(attrs, vma->vm_page_prot,
336-
is_device_dma_coherent(dev));
337-
return __dma_common_mmap(dev, vma, cpu_addr, dma_addr, size);
338-
}
339-
340334
static struct dma_map_ops swiotlb_dma_ops = {
341335
.alloc = __dma_alloc,
342336
.free = __dma_free,

0 commit comments

Comments
 (0)