[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fa7980ee38e6cbb31883e1b942fa1e1d6f0e72b0.camel@perches.com>
Date: Mon, 06 Aug 2018 09:42:56 -0700
From: Joe Perches <joe@...ches.com>
To: David Laight <David.Laight@...LAB.COM>,
'Andy Shevchenko' <andy.shevchenko@...il.com>,
"Gustavo A. R. Silva" <gustavo@...eddedor.com>
Cc: "Lee, Chun-Yi" <jlee@...e.com>, Darren Hart <dvhart@...radead.org>,
Andy Shevchenko <andy@...radead.org>,
Platform Driver <platform-driver-x86@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] platform/x86: acer-wmi: use true and false for boolean
values
On Mon, 2018-08-06 at 16:41 +0000, David Laight wrote:
> From: Andy Shevchenko
> > Sent: 05 August 2018 11:26
> >
> > On Sun, Aug 5, 2018 at 3:18 AM, Gustavo A. R. Silva
> > <gustavo@...eddedor.com> wrote:
> > > Return statements in functions returning bool should use true or false
> > > instead of an integer value.
> > >
> > > This code was detected with the help of Coccinelle.
> > > static bool has_cap(u32 cap)
> > > {
> > > if ((interface->capability & cap) != 0)
> > > - return 1;
> > > + return true;
> > >
> > > - return 0;
> > > + return false;
> > > }
> >
> > this entire function can be oneliner:
> >
> > return !!(...);
>
> Why the !! ?? Just:
> return (interface->capability & cap) != 0;
Because the return is bool you don't need the !! either.
The compiler does that.
Powered by blists - more mailing lists