[<prev] [next>] [day] [month] [year] [list]
Message-ID: <6b6d7ad3-7d25-4cf2-ab96-ddeed341599a@web.de>
Date: Fri, 28 Feb 2025 13:45:21 +0100
From: Markus Elfring <Markus.Elfring@....de>
To: linux-nvme@...ts.infradead.org, Christoph Hellwig <hch@....de>,
James Smart <james.smart@...adcom.com>, Jens Axboe <axboe@...nel.dk>,
Keith Busch <kbusch@...nel.org>, Sagi Grimberg <sagi@...mberg.me>
Cc: LKML <linux-kernel@...r.kernel.org>, kernel-janitors@...r.kernel.org,
Qasim Ijaz <qasdev00@...il.com>
Subject: [PATCH] nvme-fc: Simplify minimum determination in two functions
From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Fri, 28 Feb 2025 13:38:38 +0100
Replace nested min() calls by single min3() call in two
function implementations.
This issue was transformed by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
drivers/nvme/host/fc.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c
index b9929a5a7f4e..6eed3ecdbaf6 100644
--- a/drivers/nvme/host/fc.c
+++ b/drivers/nvme/host/fc.c
@@ -2858,8 +2858,7 @@ nvme_fc_create_io_queues(struct nvme_fc_ctrl *ctrl)
unsigned int nr_io_queues;
int ret;
- nr_io_queues = min(min(opts->nr_io_queues, num_online_cpus()),
- ctrl->lport->ops->max_hw_queues);
+ nr_io_queues = min3(opts->nr_io_queues, num_online_cpus(), ctrl->lport->ops->max_hw_queues);
ret = nvme_set_queue_count(&ctrl->ctrl, &nr_io_queues);
if (ret) {
dev_info(ctrl->ctrl.device,
@@ -2912,8 +2911,7 @@ nvme_fc_recreate_io_queues(struct nvme_fc_ctrl *ctrl)
unsigned int nr_io_queues;
int ret;
- nr_io_queues = min(min(opts->nr_io_queues, num_online_cpus()),
- ctrl->lport->ops->max_hw_queues);
+ nr_io_queues = min3(opts->nr_io_queues, num_online_cpus(), ctrl->lport->ops->max_hw_queues);
ret = nvme_set_queue_count(&ctrl->ctrl, &nr_io_queues);
if (ret) {
dev_info(ctrl->ctrl.device,
--
2.48.1
Powered by blists - more mailing lists