[PATCH] metag: Use vma_pages helper in dma_mmap

From: Vasyl Gomonovych
Date: Wed Nov 22 2017 - 18:10:03 EST


Use vma_pages function on vma object instead of explicit computation.
arch/metag/kernel/dma.c:345:19-25: WARNING: Consider using vma_pages helper on vma
Generated by: scripts/coccinelle/api/vma_pages.cocci

Signed-off-by: Vasyl Gomonovych <gomonovych@xxxxxxxxx>
---
arch/metag/kernel/dma.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/metag/kernel/dma.c b/arch/metag/kernel/dma.c
index f0ab3a498328..49a3b843ef9f 100644
--- a/arch/metag/kernel/dma.c
+++ b/arch/metag/kernel/dma.c
@@ -342,7 +342,7 @@ static int metag_dma_mmap(struct device *dev, struct vm_area_struct *vma,
else
vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);

- user_size = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT;
+ user_size = vma_pages(vma);

spin_lock_irqsave(&consistent_lock, flags);
c = metag_vm_region_find(&consistent_head, (unsigned long)cpu_addr);
--
1.9.1