Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

iio: adc: ad7606: explicit timestamp alignment

Use struct with aligned_s64 timestamp to make timestamp alignment
explicit. Technically, what we have works because for all known
architectures, IIO_DMA_MINALIGN is a multiple of __alignof__(s64).
But this way, we don't have to make people read the comments to know
why there are extra elements in each buffer.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://patch.msgid.link/20250428-iio-adc-ad7606-fix-buffer-alignment-v1-1-88dfc57e5df0@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

David Lechner and committed by
Jonathan Cameron
413e1d6a 64794edd

+8 -5
+8 -5
drivers/iio/adc/ad7606.h
··· 155 155 /* 156 156 * DMA (thus cache coherency maintenance) may require the 157 157 * transfer buffers to live in their own cache lines. 158 - * 16 * 16-bit samples + 64-bit timestamp - for AD7616 159 - * 8 * 32-bit samples + 64-bit timestamp - for AD7616C-18 (and similar) 158 + * 16 * 16-bit samples for AD7616 159 + * 8 * 32-bit samples for AD7616C-18 (and similar) 160 160 */ 161 - union { 162 - u16 buf16[20]; 163 - u32 buf32[10]; 161 + struct { 162 + union { 163 + u16 buf16[16]; 164 + u32 buf32[8]; 165 + }; 166 + aligned_s64 timestamp; 164 167 } data __aligned(IIO_DMA_MINALIGN); 165 168 __be16 d16[2]; 166 169 };