[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250815121609.384914-7-rongqianfeng@vivo.com>
Date: Fri, 15 Aug 2025 20:16:08 +0800
From: Qianfeng Rong <rongqianfeng@...o.com>
To: Nilesh Javali <njavali@...vell.com>,
GR-QLogic-Storage-Upstream@...vell.com (maintainer:QLOGIC QLA2XXX FC-SCSI DRIVER),
"James E.J. Bottomley" <James.Bottomley@...senPartnership.com>,
"Martin K. Petersen" <martin.petersen@...cle.com>,
linux-scsi@...r.kernel.org (open list:QLOGIC QLA2XXX FC-SCSI DRIVER),
linux-kernel@...r.kernel.org (open list)
Cc: Qianfeng Rong <rongqianfeng@...o.com>
Subject: [PATCH 6/6] scsi: qla2xxx: use min() to improve code
Use min_t() to reduce the code in qla2x00_alloc_outstanding_cmds() and
improve its readability.
Signed-off-by: Qianfeng Rong <rongqianfeng@...o.com>
---
drivers/scsi/qla2xxx/qla_init.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index be211ff22acb..52fc5b8932e3 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -4020,12 +4020,9 @@ qla2x00_alloc_outstanding_cmds(struct qla_hw_data *ha, struct req_que *req)
if (!IS_FWI2_CAPABLE(ha))
req->num_outstanding_cmds = DEFAULT_OUTSTANDING_COMMANDS;
- else {
- if (ha->cur_fw_xcb_count <= ha->cur_fw_iocb_count)
- req->num_outstanding_cmds = ha->cur_fw_xcb_count;
- else
- req->num_outstanding_cmds = ha->cur_fw_iocb_count;
- }
+ else
+ req->num_outstanding_cmds = min(ha->cur_fw_xcb_count,
+ ha->cur_fw_iocb_count);
req->outstanding_cmds = kcalloc(req->num_outstanding_cmds,
sizeof(srb_t *),
--
2.34.1
Powered by blists - more mailing lists