Skip to content

Commit

Permalink
iio: magn: rm3100: Fix alignment of buffer in iio_push_to_buffers_wit…
Browse files Browse the repository at this point in the history
…h_timestamp()

[ Upstream commit b8f939f ]

Add __aligned(8) to ensure the buffer passed to
iio_push_to_buffers_with_timestamp() is suitable for the naturally
aligned timestamp that will be inserted.

Here an explicit structure is not used, because this buffer is used in
a non-trivial way for data repacking.

Fixes: 121354b ("iio: magnetometer: Add driver support for PNI RM3100")
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Song Qiang <songqiang1304521@gmail.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20210613152301.571002-6-jic23@kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
jic23 authored and gregkh committed Jul 14, 2021
1 parent a65024f commit 33f6bc4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/iio/magnetometer/rm3100-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ struct rm3100_data {
bool use_interrupt;
int conversion_time;
int scale;
u8 buffer[RM3100_SCAN_BYTES];
/* Ensure naturally aligned timestamp */
u8 buffer[RM3100_SCAN_BYTES] __aligned(8);
struct iio_trigger *drdy_trig;

/*
Expand Down

0 comments on commit 33f6bc4

Please sign in to comment.