Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

staging: comedi: Use offset_in_page macro

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>

authored by

Amitoj Kaur Chawla and committed by
Greg Kroah-Hartman
f47d8b11 2fcd74b7

+1 -1
+1 -1
drivers/staging/comedi/comedi_buf.c
··· 165 165 int comedi_buf_map_access(struct comedi_buf_map *bm, unsigned long offset, 166 166 void *buf, int len, int write) 167 167 { 168 - unsigned int pgoff = offset & ~PAGE_MASK; 168 + unsigned int pgoff = offset_in_page(offset); 169 169 unsigned long pg = offset >> PAGE_SHIFT; 170 170 int done = 0; 171 171