xen: use vma_pages().
authorMuhammad Falak R Wani <falakreyaz@gmail.com>
Tue, 24 May 2016 00:04:32 +0000 (05:34 +0530)
committerDavid Vrabel <david.vrabel@citrix.com>
Wed, 6 Jul 2016 09:34:47 +0000 (10:34 +0100)
Replace explicit computation of vma page count by a call to
vma_pages().

Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
drivers/xen/gntalloc.c
drivers/xen/gntdev.c
drivers/xen/privcmd.c

index 4547a91bca67a1005c95c478aef929d121655d00..7a47c4c9fb1bbe1278844096fce7ca4afb3ff472 100644 (file)
@@ -504,7 +504,7 @@ static int gntalloc_mmap(struct file *filp, struct vm_area_struct *vma)
        struct gntalloc_file_private_data *priv = filp->private_data;
        struct gntalloc_vma_private_data *vm_priv;
        struct gntalloc_gref *gref;
-       int count = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT;
+       int count = vma_pages(vma);
        int rv, i;
 
        if (!(vma->vm_flags & VM_SHARED)) {
index 67939578cd6d0744bfc800e92bfc8f642b2cc7f5..bb952121ea944b507044508fde7b32f7ec20638d 100644 (file)
@@ -982,7 +982,7 @@ static int gntdev_mmap(struct file *flip, struct vm_area_struct *vma)
 {
        struct gntdev_priv *priv = flip->private_data;
        int index = vma->vm_pgoff;
-       int count = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT;
+       int count = vma_pages(vma);
        struct grant_map *map;
        int i, err = -EINVAL;
 
index df2e6f78331857d6f88c49189379f8537880b650..702040fe2001963a663ee42fdc56ed40278e67db 100644 (file)
@@ -582,7 +582,7 @@ static long privcmd_ioctl(struct file *file,
 static void privcmd_close(struct vm_area_struct *vma)
 {
        struct page **pages = vma->vm_private_data;
-       int numpgs = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT;
+       int numpgs = vma_pages(vma);
        int numgfns = (vma->vm_end - vma->vm_start) >> XEN_PAGE_SHIFT;
        int rc;