staging: comedi: Use vma_pages function on vma object instead of explicit computation
authorsayli karnik <karniksayli1995@gmail.com>
Mon, 19 Sep 2016 21:51:38 +0000 (03:21 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 20 Sep 2016 12:01:21 +0000 (14:01 +0200)
This patch uses vma_pages function on vma object instead of explicit
computation.

Signed-off-by: sayli karnik <karniksayli1995@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/comedi_fops.c

index bf922eafe07c9f55e9027b09146e8c5abfbb1ae0..64b3966c5f1f0d4db3e8359e78b914e02a62a3ce 100644 (file)
@@ -2233,7 +2233,7 @@ static int comedi_mmap(struct file *file, struct vm_area_struct *vma)
                goto done;
        }
 
-       n_pages = size >> PAGE_SHIFT;
+       n_pages = vma_pages(vma);
 
        /* get reference to current buf map (if any) */
        bm = comedi_buf_map_from_subdev_get(s);