]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
staging: rdma: hfi1: Replace ALIGN with PAGE_ALIGN
authorAmitoj Kaur Chawla <amitoj1606@gmail.com>
Fri, 4 Mar 2016 17:00:43 +0000 (22:30 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 12 Mar 2016 06:09:09 +0000 (22:09 -0800)
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: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rdma/hfi1/init.c
drivers/staging/rdma/hfi1/user_sdma.c

index 310710321790e8706d647c326cc34fcd9085b6c0..02df291eb172c23b44b9a44adc16421107326ff8 100644 (file)
@@ -735,8 +735,8 @@ int hfi1_init(struct hfi1_devdata *dd, int reinit)
                ret = lastfail;
 
        /* Allocate enough memory for user event notification. */
-       len = ALIGN(dd->chip_rcv_contexts * HFI1_MAX_SHARED_CTXTS *
-                   sizeof(*dd->events), PAGE_SIZE);
+       len = PAGE_ALIGN(dd->chip_rcv_contexts * HFI1_MAX_SHARED_CTXTS *
+                        sizeof(*dd->events));
        dd->events = vmalloc_user(len);
        if (!dd->events)
                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)
                 * rcvhdrqentsize is in DWs, so we have to convert to bytes
                 * (* sizeof(u32)).
                 */
-               amt = ALIGN(rcd->rcvhdrq_cnt * rcd->rcvhdrqentsize *
-                           sizeof(u32), PAGE_SIZE);
+               amt = PAGE_ALIGN(rcd->rcvhdrq_cnt * rcd->rcvhdrqentsize *
+                                sizeof(u32));
 
                gfp_flags = (rcd->ctxt >= dd->first_user_ctxt) ?
                        GFP_USER : GFP_KERNEL;
index d152126a15be34d0f31aacc11b3b701529959375..9d4f5d6aaf33ebf1c76544311f7d1095336d1dc0 100644 (file)
@@ -413,8 +413,7 @@ int hfi1_user_sdma_alloc_queues(struct hfi1_ctxtdata *uctxt, struct file *fp)
        if (!cq)
                goto cq_nomem;
 
-       memsize = ALIGN(sizeof(*cq->comps) * hfi1_sdma_comp_ring_size,
-                       PAGE_SIZE);
+       memsize = PAGE_ALIGN(sizeof(*cq->comps) * hfi1_sdma_comp_ring_size);
        cq->comps = vmalloc_user(memsize);
        if (!cq->comps)
                goto cq_comps_nomem;