iio: imu: adis16400: Fix buffer alignment requirements.
authorJonathan Cameron <Jonathan.Cameron@huawei.com>
Sun, 13 Jun 2021 15:10:39 +0000 (16:10 +0100)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Tue, 19 Oct 2021 07:29:22 +0000 (08:29 +0100)
commitd7a83bc38d8dd11b3df7e0db3739be6ced1667af
tree1d1470b38811c8c337e2afa17019f53db5bda674
parentb5ca2046c6d481128f1fc5202ffffea0bbf70a45
iio: imu: adis16400: Fix buffer alignment requirements.

iio_push_to_buffers_with_timestamp() requires that the buffer
is 8 byte alignment to ensure an inserted timestamp is naturally aligned.

This requirement was not met here when burst mode is in use beause
of a leading u16. Use the new iio_push_to_buffers_with_ts_unaligned()
function that has more relaxed requirements.

It is somewhat complex to access that actual data length, but a
safe bound can be found by using scan_bytes - sizeof(timestamp) so that
is used in this path.

More efficient approaches exist, but this ensure correctness at the
cost of using a bounce buffer.

Fixes: 5075e0720d93 ("iio: imu: adis: generalize burst mode support")
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20210613151039.569883-5-jic23@kernel.org
drivers/iio/imu/adis16400.c