linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: qlge/qlge_main: Use min_t instead of min
@ 2021-02-04 21:54 ameynarkhede02
  2021-02-04 22:58 ` Nathan Chancellor
  0 siblings, 1 reply; 3+ messages in thread
From: ameynarkhede02 @ 2021-02-04 21:54 UTC (permalink / raw)
  To: manishc, GR-Linux-NIC-Dev, gregkh
  Cc: netdev, devel, linux-kernel, Amey Narkhede

From: Amey Narkhede <ameynarkhede02@gmail.com>

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())

Signed-off-by: Amey Narkhede <ameynarkhede02@gmail.com>
---
 drivers/staging/qlge/qlge_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/qlge/qlge_main.c b/drivers/staging/qlge/qlge_main.c
index 402edaeff..29606d1eb 100644
--- a/drivers/staging/qlge/qlge_main.c
+++ b/drivers/staging/qlge/qlge_main.c
@@ -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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] staging: qlge/qlge_main: Use min_t instead of min
  2021-02-04 21:54 [PATCH] staging: qlge/qlge_main: Use min_t instead of min ameynarkhede02
@ 2021-02-04 22:58 ` Nathan Chancellor
  2021-02-05  9:20   ` Amey Narkhede
  0 siblings, 1 reply; 3+ messages in thread
From: Nathan Chancellor @ 2021-02-04 22:58 UTC (permalink / raw)
  To: ameynarkhede02
  Cc: manishc, GR-Linux-NIC-Dev, gregkh, netdev, devel, linux-kernel

On Fri, Feb 05, 2021 at 03:24:51AM +0530, ameynarkhede02@gmail.com wrote:
> From: Amey Narkhede <ameynarkhede02@gmail.com>
> 
> 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())
> 
> Signed-off-by: Amey Narkhede <ameynarkhede02@gmail.com>
> ---
>  drivers/staging/qlge/qlge_main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/qlge/qlge_main.c b/drivers/staging/qlge/qlge_main.c
> index 402edaeff..29606d1eb 100644
> --- a/drivers/staging/qlge/qlge_main.c
> +++ b/drivers/staging/qlge/qlge_main.c
> @@ -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.

> 
>  	/* 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] staging: qlge/qlge_main: Use min_t instead of min
  2021-02-04 22:58 ` Nathan Chancellor
@ 2021-02-05  9:20   ` Amey Narkhede
  0 siblings, 0 replies; 3+ messages in thread
From: Amey Narkhede @ 2021-02-05  9:20 UTC (permalink / raw)
  To: Nathan Chancellor; +Cc: netdev, devel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1184 bytes --]

On 21/02/04 03:58PM, Nathan Chancellor wrote:
> On Fri, Feb 05, 2021 at 03:24:51AM +0530, ameynarkhede02@gmail.com wrote:
> > From: Amey Narkhede <ameynarkhede02@gmail.com>
> >
> > 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())
> >
> > Signed-off-by: Amey Narkhede <ameynarkhede02@gmail.com>
> > ---
> >  drivers/staging/qlge/qlge_main.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/staging/qlge/qlge_main.c b/drivers/staging/qlge/qlge_main.c
> > index 402edaeff..29606d1eb 100644
> > --- a/drivers/staging/qlge/qlge_main.c
> > +++ b/drivers/staging/qlge/qlge_main.c
> > @@ -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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-02-05  9:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-04 21:54 [PATCH] staging: qlge/qlge_main: Use min_t instead of min ameynarkhede02
2021-02-04 22:58 ` Nathan Chancellor
2021-02-05  9:20   ` Amey Narkhede

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).