Skip to content

Commit

Permalink
iio: light: apds9960: correct FIFO check condition
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Matt Ranostay authored and Jonathan Cameron committed Mar 20, 2016
1 parent 5c913eb commit 655048a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/iio/light/apds9960.c
Original file line number Diff line number Diff line change
Expand Up @@ -769,14 +769,15 @@ static void apds9960_read_gesture_fifo(struct apds9960_data *data)
mutex_lock(&data->lock);
data->gesture_mode_running = 1;

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

if (ret)
goto err_read;

iio_push_to_buffers(data->indio_dev, data->buffer);
cnt--;
}

err_read:
Expand Down

0 comments on commit 655048a

Please sign in to comment.