iio: health: max30100: correct FIFO check condition
authorMatt Ranostay <mranostay@gmail.com>
Sat, 26 Mar 2016 03:42:58 +0000 (20:42 -0700)
committerJonathan Cameron <jic23@kernel.org>
Mon, 28 Mar 2016 09:09:58 +0000 (10:09 +0100)
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>
drivers/iio/health/max30100.c

index 09db89359544840b5f9ba7b98a8b81a046388459..90ab8a2d2846f8a8591ee6b1615dce2c984020ef 100644 (file)
@@ -238,12 +238,13 @@ static irqreturn_t max30100_interrupt_handler(int irq, void *private)
 
        mutex_lock(&data->lock);
 
-       while (cnt-- || (cnt = max30100_fifo_count(data) > 0)) {
+       while (cnt || (cnt = max30100_fifo_count(data) > 0)) {
                ret = max30100_read_measurement(data);
                if (ret)
                        break;
 
                iio_push_to_buffers(data->indio_dev, data->buffer);
+               cnt--;
        }
 
        mutex_unlock(&data->lock);