提交 84449917 编写于 作者: A Amitoj Kaur Chawla 提交者: Greg Kroah-Hartman

staging: rdma: hfi1: Replace ALIGN with PAGE_ALIGN

mm.h contains a helper function PAGE_ALIGN which aligns the pointer
to the page boundary instead of using ALIGN(expression, PAGE_SIZE)

This change was made with the help of the following Coccinelle
semantic patch:
//<smpl>
@@
expression e;
symbol PAGE_SIZE;
@@
(
- ALIGN(e, PAGE_SIZE)
+ PAGE_ALIGN(e)
|
- IS_ALIGNED(e, PAGE_SIZE)
+ PAGE_ALIGNED(e)
)
//</smpl>
Signed-off-by: NAmitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 c754db40
...@@ -735,8 +735,8 @@ int hfi1_init(struct hfi1_devdata *dd, int reinit) ...@@ -735,8 +735,8 @@ int hfi1_init(struct hfi1_devdata *dd, int reinit)
ret = lastfail; ret = lastfail;
/* Allocate enough memory for user event notification. */ /* Allocate enough memory for user event notification. */
len = ALIGN(dd->chip_rcv_contexts * HFI1_MAX_SHARED_CTXTS * len = PAGE_ALIGN(dd->chip_rcv_contexts * HFI1_MAX_SHARED_CTXTS *
sizeof(*dd->events), PAGE_SIZE); sizeof(*dd->events));
dd->events = vmalloc_user(len); dd->events = vmalloc_user(len);
if (!dd->events) if (!dd->events)
dd_dev_err(dd, "Failed to allocate user events page\n"); dd_dev_err(dd, "Failed to allocate user events page\n");
...@@ -1505,8 +1505,8 @@ int hfi1_create_rcvhdrq(struct hfi1_devdata *dd, struct hfi1_ctxtdata *rcd) ...@@ -1505,8 +1505,8 @@ int hfi1_create_rcvhdrq(struct hfi1_devdata *dd, struct hfi1_ctxtdata *rcd)
* rcvhdrqentsize is in DWs, so we have to convert to bytes * rcvhdrqentsize is in DWs, so we have to convert to bytes
* (* sizeof(u32)). * (* sizeof(u32)).
*/ */
amt = ALIGN(rcd->rcvhdrq_cnt * rcd->rcvhdrqentsize * amt = PAGE_ALIGN(rcd->rcvhdrq_cnt * rcd->rcvhdrqentsize *
sizeof(u32), PAGE_SIZE); sizeof(u32));
gfp_flags = (rcd->ctxt >= dd->first_user_ctxt) ? gfp_flags = (rcd->ctxt >= dd->first_user_ctxt) ?
GFP_USER : GFP_KERNEL; GFP_USER : GFP_KERNEL;
......
...@@ -413,8 +413,7 @@ int hfi1_user_sdma_alloc_queues(struct hfi1_ctxtdata *uctxt, struct file *fp) ...@@ -413,8 +413,7 @@ int hfi1_user_sdma_alloc_queues(struct hfi1_ctxtdata *uctxt, struct file *fp)
if (!cq) if (!cq)
goto cq_nomem; goto cq_nomem;
memsize = ALIGN(sizeof(*cq->comps) * hfi1_sdma_comp_ring_size, memsize = PAGE_ALIGN(sizeof(*cq->comps) * hfi1_sdma_comp_ring_size);
PAGE_SIZE);
cq->comps = vmalloc_user(memsize); cq->comps = vmalloc_user(memsize);
if (!cq->comps) if (!cq->comps)
goto cq_comps_nomem; goto cq_comps_nomem;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册