The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] RDMA/mlx5: Use max() macro for bfreg calculation
@ 2026-05-05 10:05 Rohit Chavan
  2026-05-12 10:59 ` Leon Romanovsky
  0 siblings, 1 reply; 2+ messages in thread
From: Rohit Chavan @ 2026-05-05 10:05 UTC (permalink / raw)
  To: Leon Romanovsky, Jason Gunthorpe, linux-rdma, linux-kernel; +Cc: Rohit Chavan

Simplify the calculation of medium blue flame registers by using the
max() macro instead of open-coded ternary logic. This improves
readability and aligns with the subsystem's preference for using
standard kernel helpers.

Signed-off-by: Rohit Chavan <roheetchavan@gmail.com>
---
 drivers/infiniband/hw/mlx5/qp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c
index 8f50e7342a76..44d88dc3e741 100644
--- a/drivers/infiniband/hw/mlx5/qp.c
+++ b/drivers/infiniband/hw/mlx5/qp.c
@@ -708,7 +708,7 @@ static int num_med_bfreg(struct mlx5_ib_dev *dev,
 	n = max_bfregs(dev, bfregi) - bfregi->num_low_latency_bfregs -
 	    NUM_NON_BLUE_FLAME_BFREGS;
 
-	return n >= 0 ? n : 0;
+	return max(n, 0);
 }
 
 static int first_med_bfreg(struct mlx5_ib_dev *dev,
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] RDMA/mlx5: Use max() macro for bfreg calculation
  2026-05-05 10:05 [PATCH] RDMA/mlx5: Use max() macro for bfreg calculation Rohit Chavan
@ 2026-05-12 10:59 ` Leon Romanovsky
  0 siblings, 0 replies; 2+ messages in thread
From: Leon Romanovsky @ 2026-05-12 10:59 UTC (permalink / raw)
  To: Jason Gunthorpe, linux-rdma, linux-kernel, Rohit Chavan


On Tue, 05 May 2026 15:35:49 +0530, Rohit Chavan wrote:
> Simplify the calculation of medium blue flame registers by using the
> max() macro instead of open-coded ternary logic. This improves
> readability and aligns with the subsystem's preference for using
> standard kernel helpers.

Applied, thanks!

[1/1] RDMA/mlx5: Use max() macro for bfreg calculation
      https://git.kernel.org/rdma/rdma/c/4d957f6055768d

Best regards,
-- 
Leon Romanovsky <leon@kernel.org>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-05-12 10:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-05 10:05 [PATCH] RDMA/mlx5: Use max() macro for bfreg calculation Rohit Chavan
2026-05-12 10:59 ` Leon Romanovsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox