| From bd694fdd290779dca231f40f7bb951aa9ccedc47 Mon Sep 17 00:00:00 2001 |
| From: Sasha Levin <sashal@kernel.org> |
| Date: Sun, 13 Jun 2021 16:22:56 +0100 |
| Subject: iio: adc: mxs-lradc: Fix buffer alignment in |
| iio_push_to_buffers_with_timestamp() |
| MIME-Version: 1.0 |
| Content-Type: text/plain; charset=UTF-8 |
| Content-Transfer-Encoding: 8bit |
| |
| From: Jonathan Cameron <Jonathan.Cameron@huawei.com> |
| |
| [ Upstream commit 6a6be221b8bd561b053f0701ec752a5ed9007f69 ] |
| |
| To make code more readable, use a structure to express the channel |
| layout and ensure the timestamp is 8 byte aligned. |
| Add a comment on why the buffer is the size it is as not immediately |
| obvious. |
| |
| Found during an audit of all calls of this function. |
| |
| Fixes: 6dd112b9f85e ("iio: adc: mxs-lradc: Add support for ADC driver") |
| Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> |
| Cc: Andreas Klinger <ak@it-klinger.de> |
| Reviewed-by: Nuno Sรก <nuno.sa@analog.com> |
| Link: https://lore.kernel.org/r/20210613152301.571002-4-jic23@kernel.org |
| Signed-off-by: Sasha Levin <sashal@kernel.org> |
| --- |
| drivers/iio/adc/mxs-lradc-adc.c | 3 ++- |
| 1 file changed, 2 insertions(+), 1 deletion(-) |
| |
| diff --git a/drivers/iio/adc/mxs-lradc-adc.c b/drivers/iio/adc/mxs-lradc-adc.c |
| index 30e29f44ebd2..c480cb489c1a 100644 |
| --- a/drivers/iio/adc/mxs-lradc-adc.c |
| +++ b/drivers/iio/adc/mxs-lradc-adc.c |
| @@ -115,7 +115,8 @@ struct mxs_lradc_adc { |
| struct device *dev; |
| |
| void __iomem *base; |
| - u32 buffer[10]; |
| + /* Maximum of 8 channels + 8 byte ts */ |
| + u32 buffer[10] __aligned(8); |
| struct iio_trigger *trig; |
| struct completion completion; |
| spinlock_t lock; |
| -- |
| 2.30.2 |
| |