[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAHp75VcCDnVjBv_8aFt3y4=6XzX45KWRhc=LZjDPw0LbtMsR7w@mail.gmail.com>
Date: Mon, 6 Aug 2018 22:06:44 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Joe Perches <joe@...ches.com>
Cc: David Laight <David.Laight@...lab.com>,
"Gustavo A. R. Silva" <gustavo@...eddedor.com>,
"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, Aug 6, 2018 at 7:42 PM, Joe Perches <joe@...ches.com> wrote:
> On Mon, 2018-08-06 at 16:41 +0000, David Laight wrote:
>> From: Andy Shevchenko
>> > Sent: 05 August 2018 11:26
>> > > 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.
True, I use that pattern, but in most cases the return value is int
and this is just to guarantee the 0,1 possible range.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists