diff mbox series

staging: qlge/qlge_main: Use min_t instead of min

Message ID 20210204215451.69928-1-ameynarkhede02@gmail.com (mailing list archive)
State Superseded
Headers show
Series staging: qlge/qlge_main: Use min_t instead of min | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Amey Narkhede Feb. 4, 2021, 9:54 p.m. UTC
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(-)

--
2.30.0

Comments

Nathan Chancellor Feb. 4, 2021, 10:58 p.m. UTC | #1
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
Amey Narkhede Feb. 5, 2021, 9:20 a.m. UTC | #2
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
diff mbox series

Patch

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