Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751245AbdGNVkt (ORCPT ); Fri, 14 Jul 2017 17:40:49 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:35246 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751012AbdGNVkp (ORCPT ); Fri, 14 Jul 2017 17:40:45 -0400 Date: Fri, 14 Jul 2017 14:40:41 -0700 From: Dmitry Torokhov To: Arnd Bergmann Cc: Linus Torvalds , Linux Kernel Mailing List , Michael Hennerich , Greg Kroah-Hartman , Tejun Heo , Guenter Roeck , IDE-ML , Linux Media Mailing List , Andrew Morton , DRI , "linux-input@vger.kernel.org" Subject: Re: [PATCH 08/14] Input: adxl34x - fix gcc-7 -Wint-in-bool-context warning Message-ID: <20170714214041.GA33582@dtor-ws> References: <20170714092540.1217397-1-arnd@arndb.de> <20170714092540.1217397-9-arnd@arndb.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1609 Lines: 47 On Fri, Jul 14, 2017 at 10:17:10PM +0200, Arnd Bergmann wrote: > On Fri, Jul 14, 2017 at 9:24 PM, Linus Torvalds > wrote: > > On Fri, Jul 14, 2017 at 2:25 AM, Arnd Bergmann 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