Skip to contentSkip to conversation

Input: adxl34x - fix gcc-7 -Wint-in-bool-context warning

PATCH Applied Arnd Bergmann 2 participants 2 messages Jul 17, 2017 – Sep 20, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Input: adxl34x - fix gcc-7 -Wint-in-bool-context warning

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

---
v2: use FIFO_BYPASS instead of 0

 drivers/input/misc/adxl34x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/misc/adxl34x.c +1 -1
index 2b2d02f408bb..a3e79bf5a04b 100644
@@ -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;
Signature · 1 line
2.9.0
maintainer Applied
#1 lore raw
Quoted 6 lines · Arnd Bergmann

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]

Quoted 7 lines

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

---
v2: use FIFO_BYPASS instead of 0

Applied, thank you.

Quoted 20 lines
 drivers/input/misc/adxl34x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/misc/adxl34x.c +1 -1
index 2b2d02f408bb..a3e79bf5a04b 100644
@@ -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;
Signature · 1 line
2.9.0
Signature · 1 line
Dmitry