arm64: dma-mapping: Cocci spatch "vma_pages"
authorThomas Meyer <thomas@m3y3r.de>
Wed, 20 Sep 2017 22:29:36 +0000 (00:29 +0200)
committerWill Deacon <will.deacon@arm.com>
Mon, 2 Oct 2017 09:13:05 +0000 (10:13 +0100)
Use vma_pages function on vma object instead of explicit computation.
Found by coccinelle spatch "api/vma_pages.cocci"

Reviewed-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
Signed-off-by: Will Deacon <will.deacon@arm.com>
arch/arm64/mm/dma-mapping.c

index 614af88..5f62090 100644 (file)
@@ -303,8 +303,7 @@ static int __swiotlb_mmap_pfn(struct vm_area_struct *vma,
                              unsigned long pfn, size_t size)
 {
        int ret = -ENXIO;
-       unsigned long nr_vma_pages = (vma->vm_end - vma->vm_start) >>
-                                       PAGE_SHIFT;
+       unsigned long nr_vma_pages = vma_pages(vma);
        unsigned long nr_pages = PAGE_ALIGN(size) >> PAGE_SHIFT;
        unsigned long off = vma->vm_pgoff;