From: Deepak R Varma <drv@mailo.com>
To: Nilesh Javali <njavali@marvell.com>,
GR-QLogic-Storage-Upstream@marvell.com,
"James E.J. Bottomley" <jejb@linux.ibm.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Saurabh Singh Sengar <ssengar@microsoft.com>,
Praveen Kumar <kumarpraveen@linux.microsoft.com>,
Deepak R Varma <drv@mailo.com>
Subject: [PATCH] scsi: qla2xxx: Use min/max helpers for comparison and assignment
Date: Sat, 28 Jan 2023 14:36:52 +0530 [thread overview]
Message-ID: <Y9TlrA2k85LecxaO@ubun2204.myguest.virtualbox.org> (raw)
Simplify code by using min and max helper macro for logical evaluation
and value assignment.
Proposed change is identified using minmax.cocci semantic patch script.
Signed-off-by: Deepak R Varma <drv@mailo.com>
---
drivers/scsi/qla2xxx/qla_dbg.c | 4 ++--
drivers/scsi/qla2xxx/qla_init.c | 8 ++------
drivers/scsi/qla2xxx/qla_sup.c | 2 +-
3 files changed, 5 insertions(+), 9 deletions(-)
diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
index d7e8454304ce..02440c595753 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.c
+++ b/drivers/scsi/qla2xxx/qla_dbg.c
@@ -686,9 +686,9 @@ qla25xx_copy_mq(struct qla_hw_data *ha, void *ptr, __be32 **last_chain)
mq->type = htonl(DUMP_CHAIN_MQ);
mq->chain_size = htonl(sizeof(struct qla2xxx_mq_chain));
- que_cnt = ha->max_req_queues > ha->max_rsp_queues ?
- ha->max_req_queues : ha->max_rsp_queues;
+ que_cnt = max(ha->max_req_queues, ha->max_rsp_queues);
mq->count = htonl(que_cnt);
+
for (cnt = 0; cnt < que_cnt; cnt++) {
reg = ISP_QUE_REG(ha, cnt);
que_idx = cnt * 4;
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 8d9ecabb1aac..1250f575fb1e 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -3734,12 +3734,8 @@ 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 *),
diff --git a/drivers/scsi/qla2xxx/qla_sup.c b/drivers/scsi/qla2xxx/qla_sup.c
index c092a6b1ced4..e26f9835c124 100644
--- a/drivers/scsi/qla2xxx/qla_sup.c
+++ b/drivers/scsi/qla2xxx/qla_sup.c
@@ -3625,7 +3625,7 @@ qla24xx_read_fcp_prio_cfg(scsi_qla_host_t *vha)
max_len = FCP_PRIO_CFG_SIZE - FCP_PRIO_CFG_HDR_SIZE;
ha->isp_ops->read_optrom(vha, &ha->fcp_prio_cfg->entry[0],
- fcp_prio_addr << 2, (len < max_len ? len : max_len));
+ fcp_prio_addr << 2, min(len, max_len));
/* revalidate the entire FCP priority config data, including entries */
if (!qla24xx_fcp_prio_cfg_valid(vha, ha->fcp_prio_cfg, 1))
--
2.34.1
reply other threads:[~2023-01-28 9: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=Y9TlrA2k85LecxaO@ubun2204.myguest.virtualbox.org \
--to=drv@mailo.com \
--cc=GR-QLogic-Storage-Upstream@marvell.com \
--cc=jejb@linux.ibm.com \
--cc=kumarpraveen@linux.microsoft.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=njavali@marvell.com \
--cc=ssengar@microsoft.com \
/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
all inboxes | Powered by JetHome®