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

Configure Feed

Select the types of activity you want to include in your feed.

iio: accel: adxl380: fix FIFO watermark bit 8 always written as 0

FIELD_PREP(BIT(0), fifo_samples & BIT(8)) produces either 0 or 256,
and since FIELD_PREP masks to bit 0, 256 & 1 evaluates to 0. Use !!
to convert the result to a proper 0-or-1 value.

Fixes: df36de13677a ("iio: accel: add ADXL380 driver")
Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Antoniu Miclaus and committed by
Jonathan Cameron
bd66aa1c 0206dd36

+1 -1
+1 -1
drivers/iio/accel/adxl380.c
··· 877 877 ret = regmap_update_bits(st->regmap, ADXL380_FIFO_CONFIG_0_REG, 878 878 ADXL380_FIFO_SAMPLES_8_MSK, 879 879 FIELD_PREP(ADXL380_FIFO_SAMPLES_8_MSK, 880 - (fifo_samples & BIT(8)))); 880 + !!(fifo_samples & BIT(8)))); 881 881 if (ret) 882 882 return ret; 883 883