Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: Rohit Chavan <roheetchavan@gmail.com>
To: Leon Romanovsky <leon@kernel.org>, Jason Gunthorpe <jgg@ziepe.ca>,
	linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Rohit Chavan <roheetchavan@gmail.com>
Subject: [PATCH] RDMA/mlx5: Use max() macro for bfreg calculation
Date: Tue,  5 May 2026 15:35:49 +0530	[thread overview]
Message-ID: <20260505100550.1810139-1-roheetchavan@gmail.com> (raw)

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


                 reply	other threads:[~2026-05-05 10:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260505100550.1810139-1-roheetchavan@gmail.com \
    --to=roheetchavan@gmail.com \
    --cc=jgg@ziepe.ca \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox