* [PATCH rdma-next] RDMA/rw: use DIV_ROUND_UP to calculate nr_ops
@ 2020-04-13 13:39 Leon Romanovsky
2020-04-15 18:58 ` Jason Gunthorpe
0 siblings, 1 reply; 2+ messages in thread
From: Leon Romanovsky @ 2020-04-13 13:39 UTC (permalink / raw)
To: Doug Ledford, Jason Gunthorpe; +Cc: Max Gurtovoy, linux-rdma
From: Max Gurtovoy <maxg@mellanox.com>
Don't open-code DIV_ROUND_UP() kernel macro.
Signed-off-by: Max Gurtovoy <maxg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
drivers/infiniband/core/rw.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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;
--
2.25.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-04-15 19:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-13 13:39 [PATCH rdma-next] RDMA/rw: use DIV_ROUND_UP to calculate nr_ops Leon Romanovsky
2020-04-15 18:58 ` Jason Gunthorpe
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).