linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] Input: adxl34x - fix gcc-7 -Wint-in-bool-context warning
@ 2017-07-17 11:43 Arnd Bergmann
  2017-09-20 19:13 ` Dmitry Torokhov
  0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2017-07-17 11:43 UTC (permalink / raw)
  To: Michael Hennerich, Dmitry Torokhov
  Cc: Arnd Bergmann, linux-input, linux-kernel

FIFO_MODE is an macro expression with a '<<' operator, which
gcc points out could be misread as a '<':

drivers/input/misc/adxl34x.c: In function 'adxl34x_probe':
drivers/input/misc/adxl34x.c:799:36: error: '<<' in boolean context, did you mean '<' ? [-Werror=int-in-bool-context]

This converts the test to an explicit comparison with FIFO_BYPASS,
making it clearer to gcc and the reader what is intended.

Fixes: e27c729219ad ("Input: add driver for ADXL345/346 Digital Accelerometers")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
v2: use FIFO_BYPASS instead of 0

 drivers/input/misc/adxl34x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/misc/adxl34x.c b/drivers/input/misc/adxl34x.c
index 2b2d02f408bb..a3e79bf5a04b 100644
--- a/drivers/input/misc/adxl34x.c
+++ b/drivers/input/misc/adxl34x.c
@@ -796,7 +796,7 @@ struct adxl34x *adxl34x_probe(struct device *dev, int irq,
 
 	if (pdata->watermark) {
 		ac->int_mask |= WATERMARK;
-		if (!FIFO_MODE(pdata->fifo_mode))
+		if (FIFO_MODE(pdata->fifo_mode) == FIFO_BYPASS)
 			ac->pdata.fifo_mode |= FIFO_STREAM;
 	} else {
 		ac->int_mask |= DATA_READY;
-- 
2.9.0


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

* Re: [PATCH v2] Input: adxl34x - fix gcc-7 -Wint-in-bool-context warning
  2017-07-17 11:43 [PATCH v2] Input: adxl34x - fix gcc-7 -Wint-in-bool-context warning Arnd Bergmann
@ 2017-09-20 19:13 ` Dmitry Torokhov
  0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Torokhov @ 2017-09-20 19:13 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: Michael Hennerich, linux-input, linux-kernel

On Mon, Jul 17, 2017 at 01:43:51PM +0200, Arnd Bergmann wrote:
> FIFO_MODE is an macro expression with a '<<' operator, which
> gcc points out could be misread as a '<':
> 
> drivers/input/misc/adxl34x.c: In function 'adxl34x_probe':
> drivers/input/misc/adxl34x.c:799:36: error: '<<' in boolean context, did you mean '<' ? [-Werror=int-in-bool-context]
> 
> This converts the test to an explicit comparison with FIFO_BYPASS,
> making it clearer to gcc and the reader what is intended.
> 
> Fixes: e27c729219ad ("Input: add driver for ADXL345/346 Digital Accelerometers")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> v2: use FIFO_BYPASS instead of 0

Applied, thank you.

> 
>  drivers/input/misc/adxl34x.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/input/misc/adxl34x.c b/drivers/input/misc/adxl34x.c
> index 2b2d02f408bb..a3e79bf5a04b 100644
> --- a/drivers/input/misc/adxl34x.c
> +++ b/drivers/input/misc/adxl34x.c
> @@ -796,7 +796,7 @@ struct adxl34x *adxl34x_probe(struct device *dev, int irq,
>  
>  	if (pdata->watermark) {
>  		ac->int_mask |= WATERMARK;
> -		if (!FIFO_MODE(pdata->fifo_mode))
> +		if (FIFO_MODE(pdata->fifo_mode) == FIFO_BYPASS)
>  			ac->pdata.fifo_mode |= FIFO_STREAM;
>  	} else {
>  		ac->int_mask |= DATA_READY;
> -- 
> 2.9.0
> 

-- 
Dmitry

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

end of thread, other threads:[~2017-09-20 19:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-17 11:43 [PATCH v2] Input: adxl34x - fix gcc-7 -Wint-in-bool-context warning Arnd Bergmann
2017-09-20 19:13 ` Dmitry Torokhov

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