Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Input: adxl34x - do not treat FIFO_MODE() as boolean

FIFO_MODE() is a 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]

While utility of this warning is being disputed (Chief Penguin: "This
warning is clearly pure garbage.") FIFO_MODE() extracts range of values,
with 0 being FIFO_BYPASS, and not something that is logically boolean.

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>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

authored by

Arnd Bergmann and committed by
Dmitry Torokhov
1dbc080c 697c5d8a

+1 -1
+1 -1
drivers/input/misc/adxl34x.c
··· 796 796 797 797 if (pdata->watermark) { 798 798 ac->int_mask |= WATERMARK; 799 - if (!FIFO_MODE(pdata->fifo_mode)) 799 + if (FIFO_MODE(pdata->fifo_mode) == FIFO_BYPASS) 800 800 ac->pdata.fifo_mode |= FIFO_STREAM; 801 801 } else { 802 802 ac->int_mask |= DATA_READY;