diff options
author | Matt Ranostay <mranostay@gmail.com> | 2016-03-17 23:48:07 -0400 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2016-03-20 06:33:33 -0400 |
commit | 655048a0b98bc6288ce87cb95a18bf4cada6c1a9 (patch) | |
tree | 6e9f3565de467144a6ebd56548521ef31251a50d | |
parent | 5c913eb92eb1143806dd295cd2f29e48c00c93fd (diff) |
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>
-rw-r--r-- | drivers/iio/light/apds9960.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/iio/light/apds9960.c b/drivers/iio/light/apds9960.c index f6a07dc32ae4..a6af56ad10e1 100644 --- a/drivers/iio/light/apds9960.c +++ b/drivers/iio/light/apds9960.c | |||
@@ -769,7 +769,7 @@ static void apds9960_read_gesture_fifo(struct apds9960_data *data) | |||
769 | mutex_lock(&data->lock); | 769 | mutex_lock(&data->lock); |
770 | data->gesture_mode_running = 1; | 770 | data->gesture_mode_running = 1; |
771 | 771 | ||
772 | while (cnt-- || (cnt = apds9660_fifo_is_empty(data) > 0)) { | 772 | while (cnt || (cnt = apds9660_fifo_is_empty(data) > 0)) { |
773 | ret = regmap_bulk_read(data->regmap, APDS9960_REG_GFIFO_BASE, | 773 | ret = regmap_bulk_read(data->regmap, APDS9960_REG_GFIFO_BASE, |
774 | &data->buffer, 4); | 774 | &data->buffer, 4); |
775 | 775 | ||
@@ -777,6 +777,7 @@ static void apds9960_read_gesture_fifo(struct apds9960_data *data) | |||
777 | goto err_read; | 777 | goto err_read; |
778 | 778 | ||
779 | iio_push_to_buffers(data->indio_dev, data->buffer); | 779 | iio_push_to_buffers(data->indio_dev, data->buffer); |
780 | cnt--; | ||
780 | } | 781 | } |
781 | 782 | ||
782 | err_read: | 783 | err_read: |