[PATCH] RDMA/mlx5: Use max() macro for bfreg calculation

Rohit Chavan posted 1 patch 1 month, 1 week ago
drivers/infiniband/hw/mlx5/qp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] RDMA/mlx5: Use max() macro for bfreg calculation
Posted by Rohit Chavan 1 month, 1 week ago
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
Re: [PATCH] RDMA/mlx5: Use max() macro for bfreg calculation
Posted by Leon Romanovsky 1 month ago
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>