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>
Link: https://patch.msgid.link/20260505100550.1810139-1-roheetchavan@gmail.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
static int num_med_bfreg(struct mlx5_ib_dev *dev,
struct mlx5_bfreg_info *bfregi)
{
- int n;
-
- n = max_bfregs(dev, bfregi) - bfregi->num_low_latency_bfregs -
- NUM_NON_BLUE_FLAME_BFREGS;
-
- return n >= 0 ? n : 0;
+ return max(0, max_bfregs(dev, bfregi) - bfregi->num_low_latency_bfregs -
+ NUM_NON_BLUE_FLAME_BFREGS);
}
static int first_med_bfreg(struct mlx5_ib_dev *dev,