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

iio: adc: ad7766: Fix alignment for DMA safety

____cacheline_aligned is an insufficient guarantee for non-coherent DMA
on platforms with 128 byte cachelines above L1. Switch to the updated
IIO_DMA_MINALIGN definition.

Update the comment to reflect the fact DMA safety 'may' require
separate cachelines.

Fixes: aa16c6bd0e09 ("iio:adc: Add support for AD7766/AD7767")
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Nuno Sá <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20220508175712.647246-16-jic23@kernel.org

+2 -3
+2 -3
drivers/iio/adc/ad7766.c
··· 45 45 struct spi_message msg; 46 46 47 47 /* 48 - * DMA (thus cache coherency maintenance) requires the 48 + * DMA (thus cache coherency maintenance) may require the 49 49 * transfer buffers to live in their own cache lines. 50 50 * Make the buffer large enough for one 24 bit sample and one 64 bit 51 51 * aligned 64 bit timestamp. 52 52 */ 53 - unsigned char data[ALIGN(3, sizeof(s64)) + sizeof(s64)] 54 - ____cacheline_aligned; 53 + unsigned char data[ALIGN(3, sizeof(s64)) + sizeof(s64)] __aligned(IIO_DMA_MINALIGN); 55 54 }; 56 55 57 56 /*