summaryrefslogtreecommitdiff
path: root/drivers/iio
diff options
context:
space:
mode:
authorMatt Ranostay <mranostay@gmail.com>2016-03-26 06:42:58 +0300
committerJonathan Cameron <jic23@kernel.org>2016-03-28 12:09:58 +0300
commitb74fccad751d2664bda9dd3c90646bb61295e774 (patch)
tree9b5f4d47c387baef71e51fbb378ebefbd4b49f85 /drivers/iio
parentf7072198f2178b68eabf25b439f17cfd8e070e9f (diff)
downloadlinux-b74fccad751d2664bda9dd3c90646bb61295e774.tar.xz
iio: health: max30100: 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>
Diffstat (limited to 'drivers/iio')
-rw-r--r--drivers/iio/health/max30100.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/iio/health/max30100.c b/drivers/iio/health/max30100.c
index 09db89359544..90ab8a2d2846 100644
--- a/drivers/iio/health/max30100.c
+++ b/drivers/iio/health/max30100.c
@@ -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);