* [PATCH] IB/hfi1: use offset_in_page macro
@ 2015-10-03 2:34 Geliang Tang
0 siblings, 0 replies; only message in thread
From: Geliang Tang @ 2015-10-03 2:34 UTC (permalink / raw)
To: Mike Marciniszyn, Doug Ledford, Sean Hefty, Hal Rosenstock,
Greg Kroah-Hartman
Cc: Geliang Tang, linux-rdma, devel, linux-kernel
Use offset_in_page macro instead of (addr & ~PAGE_MASK).
Signed-off-by: Geliang Tang <geliangtang@163.com>
---
drivers/staging/rdma/hfi1/file_ops.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/rdma/hfi1/file_ops.c b/drivers/staging/rdma/hfi1/file_ops.c
index 9a77221..7d28680 100644
--- a/drivers/staging/rdma/hfi1/file_ops.c
+++ b/drivers/staging/rdma/hfi1/file_ops.c
@@ -168,7 +168,7 @@ enum mmap_types {
HFI1_MMAP_TOKEN_SET(TYPE, type) | \
HFI1_MMAP_TOKEN_SET(CTXT, ctxt) | \
HFI1_MMAP_TOKEN_SET(SUBCTXT, subctxt) | \
- HFI1_MMAP_TOKEN_SET(OFFSET, ((unsigned long)addr & ~PAGE_MASK)))
+ HFI1_MMAP_TOKEN_SET(OFFSET, (offset_in_page(addr))))
#define EXP_TID_SET(field, value) \
(((value) & EXP_TID_TID##field##_MASK) << \
@@ -1335,9 +1335,9 @@ static int get_base_info(struct file *fp, void __user *ubase, __u32 len)
*/
binfo.user_regbase = HFI1_MMAP_TOKEN(UREGS, uctxt->ctxt,
subctxt_fp(fp), 0);
- offset = ((((uctxt->ctxt - dd->first_user_ctxt) *
+ offset = offset_in_page((((uctxt->ctxt - dd->first_user_ctxt) *
HFI1_MAX_SHARED_CTXTS) + subctxt_fp(fp)) *
- sizeof(*dd->events)) & ~PAGE_MASK;
+ sizeof(*dd->events));
binfo.events_bufbase = HFI1_MMAP_TOKEN(EVENTS, uctxt->ctxt,
subctxt_fp(fp),
offset);
@@ -1573,7 +1573,7 @@ static int exp_tid_setup(struct file *fp, struct hfi1_tid_info *tinfo)
vaddr = tinfo->vaddr;
- if (vaddr & ~PAGE_MASK) {
+ if (offset_in_page(vaddr)) {
ret = -EINVAL;
goto bail;
}
--
2.5.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2015-10-03 2:36 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-03 2:34 [PATCH] IB/hfi1: use offset_in_page macro Geliang Tang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).