From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Michael Hennerich <michael.hennerich@analog.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Tejun Heo <tj@kernel.org>, Guenter Roeck <linux@roeck-us.net>,
IDE-ML <linux-ide@vger.kernel.org>,
Linux Media Mailing List <linux-media@vger.kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
DRI <dri-devel@lists.freedesktop.org>,
"linux-input@vger.kernel.org" <linux-input@vger.kernel.org>
Subject: Re: [PATCH 08/14] Input: adxl34x - fix gcc-7 -Wint-in-bool-context warning
Date: Fri, 14 Jul 2017 14:40:41 -0700 [thread overview]
Message-ID: <20170714214041.GA33582@dtor-ws> (raw)
In-Reply-To: <CAK8P3a0nZsqWtFX84FTHmm=aVFevrU5ZATnaLVSA39PZeG=6UQ@mail.gmail.com>
On Fri, Jul 14, 2017 at 10:17:10PM +0200, Arnd Bergmann wrote:
> On Fri, Jul 14, 2017 at 9:24 PM, Linus Torvalds
> <torvalds@linux-foundation.org> wrote:
> > On Fri, Jul 14, 2017 at 2:25 AM, Arnd Bergmann <arnd@arndb.de> wrote:
> >> FIFO_MODE is an macro expression with a '<<' operator, which
> >> gcc points out could be misread as a '<':
> >
> > Yeah, no, NAK again.
> >
> > We don't make the code look worse just because gcc is being a f*cking
> > moron about things.
> >
> > This warning is clearly pure garbage.
> >
>
> I looked at this one again and found a better approach, matching the
> check that is done a few lines later. Unless you find something wrong
> with that one, I'd resubmit it with the fixup below.
>
> Arnd
>
> --- a/drivers/input/misc/adxl34x.c
> +++ b/drivers/input/misc/adxl34x.c
> @@ -789,21 +789,21 @@ struct adxl34x *adxl34x_probe(struct device *dev, int irq,
> __set_bit(pdata->ev_code_ff, input_dev->keybit);
> }
>
> if (pdata->ev_code_act_inactivity)
> __set_bit(pdata->ev_code_act_inactivity, input_dev->keybit);
>
> ac->int_mask |= ACTIVITY | INACTIVITY;
>
> if (pdata->watermark) {
> ac->int_mask |= WATERMARK;
> - if (FIFO_MODE(pdata->fifo_mode) == 0)
> + if (FIFO_MODE(pdata->fifo_mode) == FIFO_BYPASS)
This is better, not because of GCC, but it makes sense logically; 0 is
not a special value here.
Still, I am not sure that GCC is being that helpful here. Checking
result of shift for 0/non 0 with "!" is very common pattern.
Thanks.
--
Dmitry
prev parent reply other threads:[~2017-07-14 21:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20170714092540.1217397-1-arnd@arndb.de>
2017-07-14 9:25 ` [PATCH 08/14] Input: adxl34x - fix gcc-7 -Wint-in-bool-context warning Arnd Bergmann
2017-07-14 19:24 ` Linus Torvalds
2017-07-14 20:17 ` Arnd Bergmann
2017-07-14 21:40 ` Dmitry Torokhov [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170714214041.GA33582@dtor-ws \
--to=dmitry.torokhov@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=dri-devel@lists.freedesktop.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-ide@vger.kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=michael.hennerich@analog.com \
--cc=tj@kernel.org \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox