staging: comedi: Use offset_in_page macro
authorAmitoj Kaur Chawla <amitoj1606@gmail.com>
Mon, 3 Jul 2017 23:13:34 +0000 (19:13 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 16 Jul 2017 06:41:01 +0000 (08:41 +0200)
Use offset_in_page macro instead of (var & ~PAGE_MASK)

The Coccinelle semantic patch used to make this change is as follows:
// <smpl>
@@
unsigned long p;
@@
- p & ~PAGE_MASK
+ offset_in_page(p)
// </smpl>

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/comedi_buf.c

index 8e9b30b..b455ff6 100644 (file)
@@ -165,7 +165,7 @@ int comedi_buf_map_put(struct comedi_buf_map *bm)
 int comedi_buf_map_access(struct comedi_buf_map *bm, unsigned long offset,
                          void *buf, int len, int write)
 {
-       unsigned int pgoff = offset & ~PAGE_MASK;
+       unsigned int pgoff = offset_in_page(offset);
        unsigned long pg = offset >> PAGE_SHIFT;
        int done = 0;