diff mbox series

[v2,04/20] iio: accel: adxl355: Make timestamp 64 bit aligned using aligned_s64

Message ID 20250406172001.2167607-5-jic23@kernel.org (mailing list archive)
State New
Headers show
Series IIO: Introduce iio_push_to_buffers_with_ts() taking an input buffer length argument. | expand

Commit Message

Jonathan Cameron April 6, 2025, 5:19 p.m. UTC
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

The IIO ABI requires 64 bit aligned timestamps. I this case insufficient
padding would have been added on architectures where an s64 is only
32 bit aligned.  Use aligned_s64 to enforce the correct alignment.

Fixes: 327a0eaf19d5 ("iio: accel: adxl355: Add triggered buffer support")
Reported-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/accel/adxl355_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Andy Shevchenko April 7, 2025, 9:15 a.m. UTC | #1
On Sun, Apr 06, 2025 at 06:19:45PM +0100, Jonathan Cameron wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> The IIO ABI requires 64 bit aligned timestamps. I this case insufficient

64-bit

In

> padding would have been added on architectures where an s64 is only
> 32 bit aligned.  Use aligned_s64 to enforce the correct alignment.

32-bit
Nuno Sá April 7, 2025, 4:24 p.m. UTC | #2
On Sun, 2025-04-06 at 18:19 +0100, Jonathan Cameron wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> The IIO ABI requires 64 bit aligned timestamps. I this case insufficient
> padding would have been added on architectures where an s64 is only
> 32 bit aligned.  Use aligned_s64 to enforce the correct alignment.
> 
> Fixes: 327a0eaf19d5 ("iio: accel: adxl355: Add triggered buffer support")
> Reported-by: David Lechner <dlechner@baylibre.com>
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> ---

Reviewed-by: Nuno Sá <nuno.sa@analog.com>

>  drivers/iio/accel/adxl355_core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/accel/adxl355_core.c
> b/drivers/iio/accel/adxl355_core.c
> index e8cd21fa77a6..cbac622ef821 100644
> --- a/drivers/iio/accel/adxl355_core.c
> +++ b/drivers/iio/accel/adxl355_core.c
> @@ -231,7 +231,7 @@ struct adxl355_data {
>  		u8 transf_buf[3];
>  		struct {
>  			u8 buf[14];
> -			s64 ts;
> +			aligned_s64 ts;
>  		} buffer;
>  	} __aligned(IIO_DMA_MINALIGN);
>  };
diff mbox series

Patch

diff --git a/drivers/iio/accel/adxl355_core.c b/drivers/iio/accel/adxl355_core.c
index e8cd21fa77a6..cbac622ef821 100644
--- a/drivers/iio/accel/adxl355_core.c
+++ b/drivers/iio/accel/adxl355_core.c
@@ -231,7 +231,7 @@  struct adxl355_data {
 		u8 transf_buf[3];
 		struct {
 			u8 buf[14];
-			s64 ts;
+			aligned_s64 ts;
 		} buffer;
 	} __aligned(IIO_DMA_MINALIGN);
 };