diff options
| author | Antoniu Miclaus <antoniu.miclaus@analog.com> | 2026-02-27 14:43:05 +0200 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2026-04-11 14:29:47 +0200 |
| commit | 37891c52bcbf9a418052e1fda1c4039016f848ae (patch) | |
| tree | 840486dbf0a172bae20c263aa2f1036f7429d2ba | |
| parent | 86892dbc40687f6accc491116e287d1c85f0b2c4 (diff) | |
iio: accel: adxl380: fix FIFO watermark bit 8 always written as 0
commit bd66aa1c8b8cabf459064a46d3430a5ec5138418 upstream.
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| -rw-r--r-- | drivers/iio/accel/adxl380.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/iio/accel/adxl380.c b/drivers/iio/accel/adxl380.c index 9f6c0e02575a..f716bd2154bc 100644 --- a/drivers/iio/accel/adxl380.c +++ b/drivers/iio/accel/adxl380.c @@ -860,7 +860,7 @@ static int adxl380_set_fifo_samples(struct adxl380_state *st) ret = regmap_update_bits(st->regmap, ADXL380_FIFO_CONFIG_0_REG, ADXL380_FIFO_SAMPLES_8_MSK, FIELD_PREP(ADXL380_FIFO_SAMPLES_8_MSK, - (fifo_samples & BIT(8)))); + !!(fifo_samples & BIT(8)))); if (ret) return ret; |
