Skip to content

Commit

Permalink
iio: health: max30100: 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 28, 2016
1 parent f707219 commit b74fcca
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/iio/health/max30100.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit b74fcca

Please sign in to comment.