diff mbox series

[26/92] iio: adc: max1241: Fix alignment for DMA safety

Message ID 20220503085935.1533814-27-jic23@kernel.org (mailing list archive)
State Superseded
Headers show
Series IIO: Fix alignment of buffers for DMA | expand

Commit Message

Jonathan Cameron May 3, 2022, 8:58 a.m. UTC
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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

Fixes: 8a80a71d9020 ("iio: adc: Add MAX1241 driver")
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Alexandru Lazar <alazar@startmail.com>
---
 drivers/iio/adc/max1241.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Alexandru Lazar May 3, 2022, 2:23 p.m. UTC | #1
On 5/3/2022 11:58 AM, Jonathan Cameron wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> ____cacheline_aligned is an insufficient guarantee for non-coherent DMA
> on platforms with 128 byte cachelines above L1.  Switch to the updated
> IIO_ALIGN definition.
> 
> Fixes: 8a80a71d9020 ("iio: adc: Add MAX1241 driver")
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: Alexandru Lazar <alazar@startmail.com>
> ---
>   drivers/iio/adc/max1241.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/adc/max1241.c b/drivers/iio/adc/max1241.c
> index a5afd84af58b..e3dbcc2e4e77 100644
> --- a/drivers/iio/adc/max1241.c
> +++ b/drivers/iio/adc/max1241.c
> @@ -26,7 +26,7 @@ struct max1241 {
>   	struct regulator *vref;
>   	struct gpio_desc *shutdown;
>   
> -	__be16 data ____cacheline_aligned;
> +	__be16 data __aligned(IIO_ALIGN);
>   };
>   
>   static const struct iio_chan_spec max1241_channels[] = {

Looks good, I think we can call this

Acked-by: Alexandru Lazar <alazar@startmail.com>

Thanks!

In addition to that, I also think the changes in max1118 and max1027 are 
OK but I can't test either of them so take this with a grain of salt.

All the best,
Alex

(P.S. Fingers crossed that Thunderbird doesn't screw this up, I'm 
nowhere near my development machine for the next two weeks :-( . 
Apologies if it does!)
diff mbox series

Patch

diff --git a/drivers/iio/adc/max1241.c b/drivers/iio/adc/max1241.c
index a5afd84af58b..e3dbcc2e4e77 100644
--- a/drivers/iio/adc/max1241.c
+++ b/drivers/iio/adc/max1241.c
@@ -26,7 +26,7 @@  struct max1241 {
 	struct regulator *vref;
 	struct gpio_desc *shutdown;
 
-	__be16 data ____cacheline_aligned;
+	__be16 data __aligned(IIO_ALIGN);
 };
 
 static const struct iio_chan_spec max1241_channels[] = {