Skip to content

Commit

Permalink
staging:iio:accel:sca3000 Fix clearing of flag + setting of size of s…
Browse files Browse the repository at this point in the history
…can.

Not clearing the stuff_to_read flag can lead to a false flag being set
on restarting the buffer if the data was not all read the previous time.

The size of the scan is needed to ensure the function
iio_buffer_read_first_n_outer actually tries to read the data.

This stuff has been broken for some time so not stable material.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
  • Loading branch information
Jonathan Cameron committed Oct 23, 2016
1 parent d1bf1a8 commit 271a25f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions drivers/staging/iio/accel/sca3000.c
Original file line number Diff line number Diff line change
Expand Up @@ -1491,6 +1491,19 @@ int __sca3000_hw_ring_state_set(struct iio_dev *indio_dev, bool state)
**/
static int sca3000_hw_ring_preenable(struct iio_dev *indio_dev)
{
/*
* Set stuff to read to indicate no data present.
* Need for cases where the interrupt had fired at the
* end of a cycle, but the data was never read.
*/
indio_dev->buffer->stufftoread = 0;
/*
* Needed to ensure the core will actually read data
* from the device rather than assuming no channels
* are enabled.
*/
indio_dev->buffer->bytes_per_datum = 6;

return __sca3000_hw_ring_state_set(indio_dev, 1);
}

Expand Down

0 comments on commit 271a25f

Please sign in to comment.