提交 aaf6f2f0 编写于 作者: R Robin Murphy 提交者: Will Deacon

arm64: consolidate __swiotlb_mmap

Since commit 9d3bfbb4 ("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: NRobin Murphy <robin.murphy@arm.com>
Signed-off-by: NWill Deacon <will.deacon@arm.com>
上级 d3127afa
...@@ -303,9 +303,10 @@ static void __swiotlb_sync_sg_for_device(struct device *dev, ...@@ -303,9 +303,10 @@ static void __swiotlb_sync_sg_for_device(struct device *dev,
sg->length, dir); sg->length, dir);
} }
/* vma->vm_page_prot must be set appropriately before calling this function */ static int __swiotlb_mmap(struct device *dev,
static int __dma_common_mmap(struct device *dev, struct vm_area_struct *vma, struct vm_area_struct *vma,
void *cpu_addr, dma_addr_t dma_addr, size_t size) void *cpu_addr, dma_addr_t dma_addr, size_t size,
struct dma_attrs *attrs)
{ {
int ret = -ENXIO; int ret = -ENXIO;
unsigned long nr_vma_pages = (vma->vm_end - vma->vm_start) >> 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, ...@@ -314,6 +315,9 @@ static int __dma_common_mmap(struct device *dev, struct vm_area_struct *vma,
unsigned long pfn = dma_to_phys(dev, dma_addr) >> PAGE_SHIFT; unsigned long pfn = dma_to_phys(dev, dma_addr) >> PAGE_SHIFT;
unsigned long off = vma->vm_pgoff; unsigned long off = vma->vm_pgoff;
vma->vm_page_prot = __get_dma_pgprot(attrs, vma->vm_page_prot,
is_device_dma_coherent(dev));
if (dma_mmap_from_coherent(dev, vma, cpu_addr, size, &ret)) if (dma_mmap_from_coherent(dev, vma, cpu_addr, size, &ret))
return ret; return ret;
...@@ -327,16 +331,6 @@ static int __dma_common_mmap(struct device *dev, struct vm_area_struct *vma, ...@@ -327,16 +331,6 @@ static int __dma_common_mmap(struct device *dev, struct vm_area_struct *vma,
return ret; return ret;
} }
static int __swiotlb_mmap(struct device *dev,
struct vm_area_struct *vma,
void *cpu_addr, dma_addr_t dma_addr, size_t size,
struct dma_attrs *attrs)
{
vma->vm_page_prot = __get_dma_pgprot(attrs, vma->vm_page_prot,
is_device_dma_coherent(dev));
return __dma_common_mmap(dev, vma, cpu_addr, dma_addr, size);
}
static struct dma_map_ops swiotlb_dma_ops = { static struct dma_map_ops swiotlb_dma_ops = {
.alloc = __dma_alloc, .alloc = __dma_alloc,
.free = __dma_free, .free = __dma_free,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册