Skip to content

Commit

Permalink
iio: adc: mxs-lradc: Fix buffer alignment in iio_push_to_buffers_with…
Browse files Browse the repository at this point in the history
…_timestamp()

[ Upstream commit 6a6be22 ]

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: 6dd112b ("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>
  • Loading branch information
jic23 authored and gregkh committed Jul 14, 2021
1 parent a5320c8 commit 435967d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/iio/adc/mxs-lradc-adc.c
Expand Up @@ -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;
Expand Down

0 comments on commit 435967d

Please sign in to comment.