Skip to content

Commit 655048a

Browse files
mranostayjic23
authored andcommitted
iio: light: apds9960: correct FIFO check condition
Correct issue that the last entry in FIFO was being read twice due to an incorrect decrement of entry count variable before condition check. Signed-off-by: Matt Ranostay <mranostay@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
1 parent 5c913eb commit 655048a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/iio/light/apds9960.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -769,14 +769,15 @@ static void apds9960_read_gesture_fifo(struct apds9960_data *data)
769769
mutex_lock(&data->lock);
770770
data->gesture_mode_running = 1;
771771

772-
while (cnt-- || (cnt = apds9660_fifo_is_empty(data) > 0)) {
772+
while (cnt || (cnt = apds9660_fifo_is_empty(data) > 0)) {
773773
ret = regmap_bulk_read(data->regmap, APDS9960_REG_GFIFO_BASE,
774774
&data->buffer, 4);
775775

776776
if (ret)
777777
goto err_read;
778778

779779
iio_push_to_buffers(data->indio_dev, data->buffer);
780+
cnt--;
780781
}
781782

782783
err_read:

0 commit comments

Comments
 (0)