Skip to contentSkip to conversation

RDMA/rw: use DIV_ROUND_UP to calculate nr_ops

PATCH Applied Leon Romanovsky 2 participants 2 messages Apr 13, 2020 – Apr 15, 2020 InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 RDMA/rw: use DIV_ROUND_UP to calculate nr_ops

From: Max Gurtovoy <[email protected]>

Don't open-code DIV_ROUND_UP() kernel macro.

---
 drivers/infiniband/core/rw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/core/rw.c +1 -1
index 557efbf29197..614cff89fc71 100644
@@ -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;
Signature · 1 line
2.25.2