Re: [PATCH] drm/rockchip: dma-mapping: Use vma_pages helper

From: Sandy Huang
Date: Sun Nov 26 2017 - 21:20:36 EST


Thanks, this update has merged to drm-misc-next months ago:

https://patchwork.freedesktop.org/patch/178255/


å 2017/11/22 23:24, Vasyl Gomonovych åé:
Use vma_pages function on vma object instead of explicit computation.
./drivers/gpu/drm/rockchip/rockchip_drm_gem.c:223:34-40: WARNING: Consider using vma_pages helper on vma
Generated by: scripts/coccinelle/api/vma_pages.cocci

Signed-off-by: Vasyl Gomonovych <gomonovych@xxxxxxxxx>
---
 drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c
index 1869c8bb76c8..1d9655576b6e 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c
@@ -220,7 +220,7 @@ static int rockchip_drm_gem_object_mmap_iommu(struct drm_gem_object *obj,
 {
 Â Âstruct rockchip_gem_object *rk_obj = to_rockchip_obj(obj);
 Â Âunsigned int i, count = obj->size >> PAGE_SHIFT;
-ÂÂ Âunsigned long user_count = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT;
+ÂÂ Âunsigned long user_count = vma_pages(vma);
 Â Âunsigned long uaddr = vma->vm_start;
 Â Âunsigned long offset = vma->vm_pgoff;
 Â Âunsigned long end = user_count + offset;