Skip to contentSkip to conversation

staging: rdma: hfi1: Use offset_in_page macro

PATCH New Amitoj Kaur Chawla 1 participant 1 message Feb 20, 2016 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: rdma: hfi1: 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>

---
 drivers/staging/rdma/hfi1/user_sdma.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/rdma/hfi1/user_sdma.c +2 -2
index 4f55950..feb2069 100644
@@ -925,8 +925,8 @@ static int user_sdma_send_pkts(struct user_sdma_request *req, unsigned maxpkts)
 			unsigned pageidx, len;
 
 			base = (unsigned long)iovec->iov.iov_base;
-			offset = ((base + iovec->offset + iov_offset) &
-				  ~PAGE_MASK);
+			offset = offset_in_page(base + iovec->offset +
+						iov_offset);
 			pageidx = (((iovec->offset + iov_offset +
 				     base) - (base & PAGE_MASK)) >> PAGE_SHIFT);
 			len = offset + req->info.fragsize > PAGE_SIZE ?
Signature · 1 line
1.9.1