summaryrefslogtreecommitdiff
path: root/drivers/infiniband/core/rw.c
diff options
context:
space:
mode:
authorMax Gurtovoy <maxg@mellanox.com>2020-04-13 16:39:05 +0300
committerJason Gunthorpe <jgg@mellanox.com>2020-04-15 17:34:49 +0300
commit95a776e8a6282ac19051655c55124e711318ae6e (patch)
tree415821f60a0fd5b0d80af6b95d82ab54d7349764 /drivers/infiniband/core/rw.c
parentdd302ee41e6ed204f8d9534d511edc72b5ce5e53 (diff)
downloadlinux-95a776e8a6282ac19051655c55124e711318ae6e.tar.xz
RDMA/rw: use DIV_ROUND_UP to calculate nr_ops
Don't open-code DIV_ROUND_UP() kernel macro. Link: https://lore.kernel.org/r/20200413133905.933343-1-leon@kernel.org Signed-off-by: Max Gurtovoy <maxg@mellanox.com> Signed-off-by: Leon Romanovsky <leonro@mellanox.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to 'drivers/infiniband/core/rw.c')
-rw-r--r--drivers/infiniband/core/rw.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/infiniband/core/rw.c b/drivers/infiniband/core/rw.c
index 557efbf29197..614cff89fc71 100644
--- a/drivers/infiniband/core/rw.c
+++ b/drivers/infiniband/core/rw.c
@@ -129,7 +129,7 @@ static int rdma_rw_init_mr_wrs(struct rdma_rw_ctx *ctx, struct ib_qp *qp,
qp->integrity_en);
int i, j, ret = 0, count = 0;
- ctx->nr_ops = (sg_cnt + pages_per_mr - 1) / pages_per_mr;
+ ctx->nr_ops = DIV_ROUND_UP(sg_cnt, pages_per_mr);
ctx->reg = kcalloc(ctx->nr_ops, sizeof(*ctx->reg), GFP_KERNEL);
if (!ctx->reg) {
ret = -ENOMEM;