Skip to content

Commit

Permalink
iio: accel: adxl372: Fix push to buffers lost samples
Browse files Browse the repository at this point in the history
One in two sample sets was lost by multiplying fifo_set_size with
sizeof(u16). Also, the double number of available samples were pushed to
the iio buffers.

Signed-off-by: Stefan Popa <stefan.popa@analog.com>
Fixes: f4f55ce ("iio:adxl372: Add FIFO and interrupts support")
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
  • Loading branch information
Stefan Popa authored and Jonathan Cameron committed Oct 9, 2019
1 parent d202ce4 commit 62df81b
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/iio/accel/adxl372.c
Original file line number Diff line number Diff line change
Expand Up @@ -553,8 +553,7 @@ static irqreturn_t adxl372_trigger_handler(int irq, void *p)
goto err;

/* Each sample is 2 bytes */
for (i = 0; i < fifo_entries * sizeof(u16);
i += st->fifo_set_size * sizeof(u16))
for (i = 0; i < fifo_entries; i += st->fifo_set_size)
iio_push_to_buffers(indio_dev, &st->fifo_buf[i]);
}
err:
Expand Down

0 comments on commit 62df81b

Please sign in to comment.