lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240827082254.72321-1-shenlichuan@vivo.com>
Date: Tue, 27 Aug 2024 16:22:54 +0800
From: Shen Lichuan <shenlichuan@...o.com>
To: dennis.dalessandro@...nelisnetworks.com,
	jgg@...pe.ca,
	leon@...nel.org
Cc: linux-rdma@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	opensource.kernel@...o.com,
	Shen Lichuan <shenlichuan@...o.com>
Subject: [PATCH v1] IB/qib: Use max() macro

Use the max() macro to simplify the function and improve
its readability.

Signed-off-by: Shen Lichuan <shenlichuan@...o.com>
---
 drivers/infiniband/hw/qib/qib_iba7220.c | 2 +-
 drivers/infiniband/hw/qib/qib_iba7322.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/hw/qib/qib_iba7220.c b/drivers/infiniband/hw/qib/qib_iba7220.c
index 78dfe98ebcf7..4c96b66a93b5 100644
--- a/drivers/infiniband/hw/qib/qib_iba7220.c
+++ b/drivers/infiniband/hw/qib/qib_iba7220.c
@@ -4094,7 +4094,7 @@ static int qib_init_7220_variables(struct qib_devdata *dd)
 	updthresh = 8U; /* update threshold */
 	if (dd->flags & QIB_HAS_SEND_DMA) {
 		dd->cspec->sdmabufcnt =  dd->piobcnt4k;
-		sbufs = updthresh > 3 ? updthresh : 3;
+		sbufs = max(updthresh, 3);
 	} else {
 		dd->cspec->sdmabufcnt = 0;
 		sbufs = dd->piobcnt4k;
diff --git a/drivers/infiniband/hw/qib/qib_iba7322.c b/drivers/infiniband/hw/qib/qib_iba7322.c
index 9db29916e35a..5a059ec08780 100644
--- a/drivers/infiniband/hw/qib/qib_iba7322.c
+++ b/drivers/infiniband/hw/qib/qib_iba7322.c
@@ -6633,7 +6633,7 @@ static int qib_init_7322_variables(struct qib_devdata *dd)
 	 */
 	if (dd->flags & QIB_HAS_SEND_DMA) {
 		dd->cspec->sdmabufcnt = dd->piobcnt4k;
-		sbufs = updthresh > 3 ? updthresh : 3;
+		sbufs = max(updthresh, 3);
 	} else {
 		dd->cspec->sdmabufcnt = 0;
 		sbufs = dd->piobcnt4k;
-- 
2.17.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ