From: Qasim Ijaz <qasdev00@gmail.com>
To: Markus Elfring <Markus.Elfring@web.de>
Cc: linux-nvme@lists.infradead.org, Christoph Hellwig <hch@lst.de>,
James Smart <james.smart@broadcom.com>,
Jens Axboe <axboe@kernel.dk>, Keith Busch <kbusch@kernel.org>,
Sagi Grimberg <sagi@grimberg.me>,
LKML <linux-kernel@vger.kernel.org>,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] nvme-fc: Simplify minimum determination in two functions
Date: Fri, 28 Feb 2025 15:40:05 +0000 [thread overview]
Message-ID: <Z8HY1RX5-SOjYOdx@qasdev.system> (raw)
On Fri, Feb 28, 2025 at 01:45:21PM +0100, Markus Elfring wrote:
> From: Markus Elfring <elfring@users.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@users.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
>
Hi Markus,
I have already submitted a patch for this twice in the past:
4th Feb: <https://lore.kernel.org/all/20250204201256.117194-1-qasdev00@gmail.com/>
13th Feb: <https://lore.kernel.org/all/20250213221622.81457-1-qasdev00@gmail.com/>
>
next reply other threads:[~2025-03-03 17:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-28 15:40 Qasim Ijaz [this message]
2025-02-28 16:00 ` nvme-fc: Simplify minimum determination in two functions Markus Elfring
-- strict thread matches above, loose matches on Subject: below --
2025-02-28 12:45 [PATCH] " Markus Elfring
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=Z8HY1RX5-SOjYOdx@qasdev.system \
--to=qasdev00@gmail.com \
--cc=6b6d7ad3-7d25-4cf2-ab96-ddeed341599a@web.de \
--cc=Markus.Elfring@web.de \
--cc=axboe@kernel.dk \
--cc=hch@lst.de \
--cc=james.smart@broadcom.com \
--cc=kbusch@kernel.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=sagi@grimberg.me \
/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