Skip to contentSkip to conversation

staging: qlge/qlge_main: Use min_t instead of min

PATCH Superseded [email protected] 2 participants 3 messages Feb 4, 2021 – Feb 5, 2021

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: qlge/qlge_main: Use min_t instead of min

From: Amey Narkhede <[email protected]>

Use min_t instead of min function in qlge/qlge_main.c
Fixes following checkpatch.pl warning:
WARNING: min() should probably be min_t(int, MAX_CPUS, num_online_cpus())

---
 drivers/staging/qlge/qlge_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/qlge/qlge_main.c +1 -1
index 402edaeff..29606d1eb 100644
@@ -3938,7 +3938,7 @@ static int ql_configure_rings(struct ql_adapter *qdev)
 	int i;
 	struct rx_ring *rx_ring;
 	struct tx_ring *tx_ring;
-	int cpu_cnt = min(MAX_CPUS, (int)num_online_cpus());
+	int cpu_cnt = min_t(int, MAX_CPUS, (int)num_online_cpus());
 
 	/* In a perfect world we have one RSS ring for each CPU
 	 * and each has it's own vector.  To do that we ask for

--
2.30.0

#1 lore raw
Quoted 16 lines · On Fri, Feb 05, 2021 at 03:24:51AM +0530, [email protected] wrote:

From: Amey Narkhede <[email protected]>

Use min_t instead of min function in qlge/qlge_main.c
Fixes following checkpatch.pl warning:
WARNING: min() should probably be min_t(int, MAX_CPUS, num_online_cpus())

---
 drivers/staging/qlge/qlge_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/qlge/qlge_main.c +0 -0
index 402edaeff..29606d1eb 100644

drivers/staging/qlge/qlge_main.c static int ql_configure_rings(struct ql_adapter *qdev) · line 3941

Quoted 5 lines
drivers/staging/qlge/qlge_main.c +1 -1
@@ -3938,7 +3938,7 @@ static int ql_configure_rings(struct ql_adapter *qdev)
 	int i;
 	struct rx_ring *rx_ring;
 	struct tx_ring *tx_ring;
-	int cpu_cnt = min(MAX_CPUS, (int)num_online_cpus());
+	int cpu_cnt = min_t(int, MAX_CPUS, (int)num_online_cpus());

You should remove the cast on num_online_cpus() like checkpatch suggests. min_t adds the cast to int on both of the inputs for you.

Quoted 5 lines
drivers/staging/qlge/qlge_main.c +0 -1
 	/* In a perfect world we have one RSS ring for each CPU
 	 * and each has it's own vector.  To do that we ask for
--

2.30.0

Cheers,
Nathan

#2 lore raw
Quoted 12 lines · Nathan Chancellor
Quoted 11 lines · On Fri, Feb 05, 2021 at 03:24:51AM +0530, [email protected] wrote:

From: Amey Narkhede <[email protected]>

Use min_t instead of min function in qlge/qlge_main.c
Fixes following checkpatch.pl warning:
WARNING: min() should probably be min_t(int, MAX_CPUS, num_online_cpus())

---
 drivers/staging/qlge/qlge_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 14 lines

drivers/staging/qlge/qlge_main.c static int ql_configure_rings(struct ql_adapter *qdev) · line 3941

Quoted 10 lines
drivers/staging/qlge/qlge_main.c +1 -1
index 402edaeff..29606d1eb 100644
@@ -3938,7 +3938,7 @@ static int ql_configure_rings(struct ql_adapter *qdev)
 	int i;
 	struct rx_ring *rx_ring;
 	struct tx_ring *tx_ring;
-	int cpu_cnt = min(MAX_CPUS, (int)num_online_cpus());
+	int cpu_cnt = min_t(int, MAX_CPUS, (int)num_online_cpus());

You should remove the cast on num_online_cpus() like checkpatch suggests. min_t adds the cast to int on both of the inputs for you.

Thanks. Fixed in v2

Amey