linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2] staging: wilc1000: drop explicit conversion to bool
@ 2019-04-06  8:40 Nicholas Mc Guire
  2019-04-06  9:11 ` Julian Calaby
  0 siblings, 1 reply; 3+ messages in thread
From: Nicholas Mc Guire @ 2019-04-06  8:40 UTC (permalink / raw)
  To: Adham Abozaeid
  Cc: Ajay Singh, Greg Kroah-Hartman, linux-wireless, devel,
	linux-kernel, Nicholas Mc Guire

As the expression evaluates to a boolean anyway (relational and logical
operators) conversion with the ternary operator is not needed here as
coccinelle notes (boolconv.cocci)

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
---

V2: sent out the wrong version - the commit message was longer than 75
    chars - only change here is the commit message wrapping.

scripts/coccinelle/misc/boolconv.cocci warned about:
drivers/staging/wilc1000/wilc_wlan.c:14:48-53: WARNING: conversion to bool not needed here

Patch was compile tested with: x86_64_defconfig + Staging=y,
WILC1000_SDIO=m, WILC1000_SPI=m, WILC1000=m
(checkpatch, sparse and cocci clean otherwise)

Patch is against 5.1-rc3 (localversion-next is -next-20190403)

 drivers/staging/wilc1000/wilc_wlan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
index c238969..6c9fd3a 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -11,7 +11,7 @@
 
 static inline bool is_wilc1000(u32 id)
 {
-	return ((id & 0xfffff000) == 0x100000 ? true : false);
+	return ((id & 0xfffff000) == 0x100000);
 }
 
 static inline void acquire_bus(struct wilc *wilc, enum bus_acquire acquire)
-- 
2.1.4


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

* Re: [PATCH V2] staging: wilc1000: drop explicit conversion to bool
  2019-04-06  8:40 [PATCH V2] staging: wilc1000: drop explicit conversion to bool Nicholas Mc Guire
@ 2019-04-06  9:11 ` Julian Calaby
  2019-04-06  9:35   ` Nicholas Mc Guire
  0 siblings, 1 reply; 3+ messages in thread
From: Julian Calaby @ 2019-04-06  9:11 UTC (permalink / raw)
  To: Nicholas Mc Guire
  Cc: Adham Abozaeid, Ajay Singh, Greg Kroah-Hartman, linux-wireless,
	devel, linux-kernel

Hi Nicholas,

On Sat, Apr 6, 2019 at 7:48 PM Nicholas Mc Guire <hofrat@osadl.org> wrote:
>
> As the expression evaluates to a boolean anyway (relational and logical
> operators) conversion with the ternary operator is not needed here as
> coccinelle notes (boolconv.cocci)
>
> Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
> ---
>
> V2: sent out the wrong version - the commit message was longer than 75
>     chars - only change here is the commit message wrapping.
>
> scripts/coccinelle/misc/boolconv.cocci warned about:
> drivers/staging/wilc1000/wilc_wlan.c:14:48-53: WARNING: conversion to bool not needed here
>
> Patch was compile tested with: x86_64_defconfig + Staging=y,
> WILC1000_SDIO=m, WILC1000_SPI=m, WILC1000=m
> (checkpatch, sparse and cocci clean otherwise)
>
> Patch is against 5.1-rc3 (localversion-next is -next-20190403)
>
>  drivers/staging/wilc1000/wilc_wlan.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
> index c238969..6c9fd3a 100644
> --- a/drivers/staging/wilc1000/wilc_wlan.c
> +++ b/drivers/staging/wilc1000/wilc_wlan.c
> @@ -11,7 +11,7 @@
>
>  static inline bool is_wilc1000(u32 id)
>  {
> -       return ((id & 0xfffff000) == 0x100000 ? true : false);
> +       return ((id & 0xfffff000) == 0x100000);

Whilst you're here, you might as well remove the superfluous parentheses.

Other than that,

Reviewed-by: Julian Calaby <julian.calaby@gmail.com>

Thanks,

-- 
Julian Calaby

Email: julian.calaby@gmail.com
Profile: http://www.google.com/profiles/julian.calaby/

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

* Re: [PATCH V2] staging: wilc1000: drop explicit conversion to bool
  2019-04-06  9:11 ` Julian Calaby
@ 2019-04-06  9:35   ` Nicholas Mc Guire
  0 siblings, 0 replies; 3+ messages in thread
From: Nicholas Mc Guire @ 2019-04-06  9:35 UTC (permalink / raw)
  To: Julian Calaby
  Cc: Nicholas Mc Guire, Adham Abozaeid, Ajay Singh,
	Greg Kroah-Hartman, linux-wireless, devel, linux-kernel

On Sat, Apr 06, 2019 at 08:11:55PM +1100, Julian Calaby wrote:
> Hi Nicholas,
> 
> On Sat, Apr 6, 2019 at 7:48 PM Nicholas Mc Guire <hofrat@osadl.org> wrote:
> >
> > As the expression evaluates to a boolean anyway (relational and logical
> > operators) conversion with the ternary operator is not needed here as
> > coccinelle notes (boolconv.cocci)
> >
> > Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
> > ---
> >
> > V2: sent out the wrong version - the commit message was longer than 75
> >     chars - only change here is the commit message wrapping.
> >
> > scripts/coccinelle/misc/boolconv.cocci warned about:
> > drivers/staging/wilc1000/wilc_wlan.c:14:48-53: WARNING: conversion to bool not needed here
> >
> > Patch was compile tested with: x86_64_defconfig + Staging=y,
> > WILC1000_SDIO=m, WILC1000_SPI=m, WILC1000=m
> > (checkpatch, sparse and cocci clean otherwise)
> >
> > Patch is against 5.1-rc3 (localversion-next is -next-20190403)
> >
> >  drivers/staging/wilc1000/wilc_wlan.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c
> > index c238969..6c9fd3a 100644
> > --- a/drivers/staging/wilc1000/wilc_wlan.c
> > +++ b/drivers/staging/wilc1000/wilc_wlan.c
> > @@ -11,7 +11,7 @@
> >
> >  static inline bool is_wilc1000(u32 id)
> >  {
> > -       return ((id & 0xfffff000) == 0x100000 ? true : false);
> > +       return ((id & 0xfffff000) == 0x100000);
> 
> Whilst you're here, you might as well remove the superfluous parentheses.
>

fine - there are a few other places though that this would need to be cleaned
up to be consistent e.g. entries = ((reg >> 3) & 0x3f); wilc_wlan.c
 
> Other than that,
> 
> Reviewed-by: Julian Calaby <julian.calaby@gmail.com>
> 

will resend with outer () dropped and Reviewed-by: added

thx!
hofrat

> Thanks,
> 
> -- 
> Julian Calaby
> 
> Email: julian.calaby@gmail.com
> Profile: http://www.google.com/profiles/julian.calaby/

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

end of thread, other threads:[~2019-04-06  9:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-06  8:40 [PATCH V2] staging: wilc1000: drop explicit conversion to bool Nicholas Mc Guire
2019-04-06  9:11 ` Julian Calaby
2019-04-06  9:35   ` Nicholas Mc Guire

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