]> git.baikalelectronics.ru Git - kernel.git/commit
iio: buffer: align the size of scan bytes to size of the largest element
authorLars Möllendorf <lars.moellendorf@plating.de>
Fri, 13 Dec 2019 13:50:55 +0000 (14:50 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 13 Jan 2020 11:08:37 +0000 (12:08 +0100)
commit0f249edc8f6ec07a5cc8651ab1107a1cfa614097
tree66abdf8221bc13139e1ca7fb6e543e0d615f9dda
parent6f59d7603a33de69be9c65d0565d19080f83772b
iio: buffer: align the size of scan bytes to size of the largest element

Previous versions of `iio_compute_scan_bytes` only aligned each element
to its own length (i.e. its own natural alignment). Because multiple
consecutive sets of scan elements are buffered this does not work in
case the computed scan bytes do not align with the natural alignment of
the first scan element in the set.

This commit fixes this by aligning the scan bytes to the natural
alignment of the largest scan element in the set.

Fixes: 28b4fcb0227e ("staging:iio: make iio_sw_buffer_preenable much more general.")
Signed-off-by: Lars Möllendorf <lars.moellendorf@plating.de>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/iio/industrialio-buffer.c