Skip to contentSkip to conversation

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

PATCH Applied Rohit Chavan 2 participants 2 messages May 5 – May 12

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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

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.

---
 drivers/infiniband/hw/mlx5/qp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/mlx5/qp.c +1 -1
index 8f50e7342a76..44d88dc3e741 100644
@@ -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,
Signature · 1 line
2.34.1
#1 lore raw
Quoted 4 lines · 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.

Applied, thanks!

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

      https://git.kernel.org/rdma/rdma/c/4d957f6055768d

Best regards,

Signature · 1 line
Leon Romanovsky <[email protected]>