Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

nvme-fc: Utilise min3() to simplify queue count calculation

Refactor nvme_fc_create_io_queues() and nvme_fc_recreate_io_queues() to
use the min3() macro to find the minimum between 3 values instead of
multiple min()'s. This shortens the code and makes it easier to read.

Signed-off-by: Qasim Ijaz <qasdev00@gmail.com>
Reviewed-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Keith Busch <kbusch@kernel.org>

authored by

Qasim Ijaz and committed by
Keith Busch
97854005 7cbafa3f

+2 -2
+2 -2
drivers/nvme/host/fc.c
··· 2907 2907 unsigned int nr_io_queues; 2908 2908 int ret; 2909 2909 2910 - nr_io_queues = min(min(opts->nr_io_queues, num_online_cpus()), 2910 + nr_io_queues = min3(opts->nr_io_queues, num_online_cpus(), 2911 2911 ctrl->lport->ops->max_hw_queues); 2912 2912 ret = nvme_set_queue_count(&ctrl->ctrl, &nr_io_queues); 2913 2913 if (ret) { ··· 2961 2961 unsigned int nr_io_queues; 2962 2962 int ret; 2963 2963 2964 - nr_io_queues = min(min(opts->nr_io_queues, num_online_cpus()), 2964 + nr_io_queues = min3(opts->nr_io_queues, num_online_cpus(), 2965 2965 ctrl->lport->ops->max_hw_queues); 2966 2966 ret = nvme_set_queue_count(&ctrl->ctrl, &nr_io_queues); 2967 2967 if (ret) {