diff mbox series

iio: accel: replace s64 __aligned(8) with aligned_s64

Message ID 20241020180720.496327-1-jic23@kernel.org (mailing list archive)
State Accepted
Headers show
Series iio: accel: replace s64 __aligned(8) with aligned_s64 | expand

Commit Message

Jonathan Cameron Oct. 20, 2024, 6:07 p.m. UTC
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

e4ca0e59c394 ("types: Complement the aligned types with signed 64-bit one")
introduced aligned_s64. Use it for all IIO accelerometer drivers.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

---

I debated whether to split this up by driver by the time we've done all IIO
drivers that will be a very large number of trivial patches.

The changes are minor enough that they shouldn't present much of a
backporting challenge if needed for future fixes etc.

I'm find splitting them up if people prefer.
Next on my list is to look at adding runtime checks that the buffers
containing these timestamps are big enough but I want this out of the
way first.

Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/iio/accel/bma180.c          | 3 ++-
 drivers/iio/accel/bma220_spi.c      | 1 +
 drivers/iio/accel/bma400_core.c     | 2 +-
 drivers/iio/accel/bmc150-accel.h    | 3 ++-
 drivers/iio/accel/fxls8962af-core.c | 3 ++-
 drivers/iio/accel/kionix-kx022a.c   | 3 ++-
 drivers/iio/accel/kxcjk-1013.c      | 3 ++-
 drivers/iio/accel/kxsd9.c           | 3 ++-
 drivers/iio/accel/mma7455_core.c    | 3 ++-
 drivers/iio/accel/mma8452.c         | 3 ++-
 drivers/iio/accel/msa311.c          | 3 ++-
 drivers/iio/accel/mxc4005.c         | 3 ++-
 drivers/iio/accel/stk8312.c         | 3 ++-
 drivers/iio/accel/stk8ba50.c        | 3 ++-
 14 files changed, 26 insertions(+), 13 deletions(-)

Comments

Andy Shevchenko Oct. 21, 2024, 7:10 a.m. UTC | #1
On Sun, Oct 20, 2024 at 07:07:20PM +0100, Jonathan Cameron wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> e4ca0e59c394 ("types: Complement the aligned types with signed 64-bit one")
> introduced aligned_s64. Use it for all IIO accelerometer drivers.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> ---
> 
> I debated whether to split this up by driver by the time we've done all IIO
> drivers that will be a very large number of trivial patches.
> 
> The changes are minor enough that they shouldn't present much of a
> backporting challenge if needed for future fixes etc.
> 
> I'm find splitting them up if people prefer.
> Next on my list is to look at adding runtime checks that the buffers
> containing these timestamps are big enough but I want this out of the
> way first.

I agree on all your points.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Matti Vaittinen Oct. 21, 2024, 7:41 a.m. UTC | #2
On 20/10/2024 21:07, Jonathan Cameron wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> e4ca0e59c394 ("types: Complement the aligned types with signed 64-bit one")
> introduced aligned_s64. Use it for all IIO accelerometer drivers.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> ---
> 
> I debated whether to split this up by driver by the time we've done all IIO
> drivers that will be a very large number of trivial patches.
> 
> The changes are minor enough that they shouldn't present much of a
> backporting challenge if needed for future fixes etc.
> 
> I'm find splitting them up if people prefer.
> Next on my list is to look at adding runtime checks that the buffers
> containing these timestamps are big enough but I want this out of the
> way first.

Makes sense to me.

> Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>   drivers/iio/accel/kionix-kx022a.c   | 3 ++-
>   drivers/iio/accel/kxcjk-1013.c      | 3 ++-
>   drivers/iio/accel/kxsd9.c           | 3 ++-

For the Kionix/ROHM seensors,
Reviewed-by: Matti Vaittinen <mazziesaccount@gmail.com>


Yours,
	-- Matti
Nuno Sá Oct. 21, 2024, 8:15 a.m. UTC | #3
On Sun, 2024-10-20 at 19:07 +0100, Jonathan Cameron wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> e4ca0e59c394 ("types: Complement the aligned types with signed 64-bit one")
> introduced aligned_s64. Use it for all IIO accelerometer drivers.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> ---
> 
> I debated whether to split this up by driver by the time we've done all IIO
> drivers that will be a very large number of trivial patches.
> 
> The changes are minor enough that they shouldn't present much of a
> backporting challenge if needed for future fixes etc.
> 
> I'm find splitting them up if people prefer.
> Next on my list is to look at adding runtime checks that the buffers
> containing these timestamps are big enough but I want this out of the
> way first.
> 
> Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---

LGTM,

Reviewed-by; Nuno Sa <nuno.sa@analog.com>

>  drivers/iio/accel/bma180.c          | 3 ++-
>  drivers/iio/accel/bma220_spi.c      | 1 +
>  drivers/iio/accel/bma400_core.c     | 2 +-
>  drivers/iio/accel/bmc150-accel.h    | 3 ++-
>  drivers/iio/accel/fxls8962af-core.c | 3 ++-
>  drivers/iio/accel/kionix-kx022a.c   | 3 ++-
>  drivers/iio/accel/kxcjk-1013.c      | 3 ++-
>  drivers/iio/accel/kxsd9.c           | 3 ++-
>  drivers/iio/accel/mma7455_core.c    | 3 ++-
>  drivers/iio/accel/mma8452.c         | 3 ++-
>  drivers/iio/accel/msa311.c          | 3 ++-
>  drivers/iio/accel/mxc4005.c         | 3 ++-
>  drivers/iio/accel/stk8312.c         | 3 ++-
>  drivers/iio/accel/stk8ba50.c        | 3 ++-
>  14 files changed, 26 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/iio/accel/bma180.c b/drivers/iio/accel/bma180.c
> index 1fe20eb78a0b..41a517e1630f 100644
> --- a/drivers/iio/accel/bma180.c
> +++ b/drivers/iio/accel/bma180.c
> @@ -21,6 +21,7 @@
>  #include <linux/regulator/consumer.h>
>  #include <linux/slab.h>
>  #include <linux/string.h>
> +#include <linux/types.h>
>  #include <linux/iio/iio.h>
>  #include <linux/iio/sysfs.h>
>  #include <linux/iio/buffer.h>
> @@ -144,7 +145,7 @@ struct bma180_data {
>  	/* Ensure timestamp is naturally aligned */
>  	struct {
>  		s16 chan[4];
> -		s64 timestamp __aligned(8);
> +		aligned_s64 timestamp;
>  	} scan;
>  };
>  
> diff --git a/drivers/iio/accel/bma220_spi.c b/drivers/iio/accel/bma220_spi.c
> index d33218e40c79..2d27a592a61e 100644
> --- a/drivers/iio/accel/bma220_spi.c
> +++ b/drivers/iio/accel/bma220_spi.c
> @@ -9,6 +9,7 @@
>  #include <linux/kernel.h>
>  #include <linux/mod_devicetable.h>
>  #include <linux/module.h>
> +#include <linux/types.h>
>  #include <linux/spi/spi.h>
>  
>  #include <linux/iio/buffer.h>
> diff --git a/drivers/iio/accel/bma400_core.c b/drivers/iio/accel/bma400_core.c
> index d96840d135c6..eb32c963dfc8 100644
> --- a/drivers/iio/accel/bma400_core.c
> +++ b/drivers/iio/accel/bma400_core.c
> @@ -115,7 +115,7 @@ struct bma400_data {
>  	struct {
>  		__le16 buff[3];
>  		u8 temperature;
> -		s64 ts __aligned(8);
> +		aligned_s64 ts;
>  	} buffer __aligned(IIO_DMA_MINALIGN);
>  	__le16 status;
>  	__be16 duration;
> diff --git a/drivers/iio/accel/bmc150-accel.h b/drivers/iio/accel/bmc150-
> accel.h
> index 7775c5edaeef..7a7baf52e595 100644
> --- a/drivers/iio/accel/bmc150-accel.h
> +++ b/drivers/iio/accel/bmc150-accel.h
> @@ -6,6 +6,7 @@
>  #include <linux/iio/iio.h>
>  #include <linux/mutex.h>
>  #include <linux/regulator/consumer.h>
> +#include <linux/types.h>
>  #include <linux/workqueue.h>
>  
>  struct regmap;
> @@ -69,7 +70,7 @@ struct bmc150_accel_data {
>  	 */
>  	struct {
>  		__le16 channels[3];
> -		s64 ts __aligned(8);
> +		aligned_s64 ts;
>  	} scan;
>  	u8 bw_bits;
>  	u32 slope_dur;
> diff --git a/drivers/iio/accel/fxls8962af-core.c
> b/drivers/iio/accel/fxls8962af-core.c
> index 37f33c29fb4b..ab427f3461db 100644
> --- a/drivers/iio/accel/fxls8962af-core.c
> +++ b/drivers/iio/accel/fxls8962af-core.c
> @@ -22,6 +22,7 @@
>  #include <linux/property.h>
>  #include <linux/regulator/consumer.h>
>  #include <linux/regmap.h>
> +#include <linux/types.h>
>  
>  #include <linux/iio/buffer.h>
>  #include <linux/iio/events.h>
> @@ -163,7 +164,7 @@ struct fxls8962af_data {
>  	const struct fxls8962af_chip_info *chip_info;
>  	struct {
>  		__le16 channels[3];
> -		s64 ts __aligned(8);
> +		aligned_s64 ts;
>  	} scan;
>  	int64_t timestamp, old_timestamp;	/* Only used in hw fifo mode.
> */
>  	struct iio_mount_matrix orientation;
> diff --git a/drivers/iio/accel/kionix-kx022a.c b/drivers/iio/accel/kionix-
> kx022a.c
> index 53d59a04ae15..32387819995d 100644
> --- a/drivers/iio/accel/kionix-kx022a.c
> +++ b/drivers/iio/accel/kionix-kx022a.c
> @@ -16,6 +16,7 @@
>  #include <linux/regulator/consumer.h>
>  #include <linux/slab.h>
>  #include <linux/string_choices.h>
> +#include <linux/types.h>
>  #include <linux/units.h>
>  
>  #include <linux/iio/iio.h>
> @@ -292,7 +293,7 @@ struct kx022a_data {
>  	__le16 buffer[8] __aligned(IIO_DMA_MINALIGN);
>  	struct {
>  		__le16 channels[3];
> -		s64 ts __aligned(8);
> +		aligned_s64 ts;
>  	} scan;
>  };
>  
> diff --git a/drivers/iio/accel/kxcjk-1013.c b/drivers/iio/accel/kxcjk-1013.c
> index b76df8816323..bbf65fc97b08 100644
> --- a/drivers/iio/accel/kxcjk-1013.c
> +++ b/drivers/iio/accel/kxcjk-1013.c
> @@ -11,6 +11,7 @@
>  #include <linux/bitops.h>
>  #include <linux/slab.h>
>  #include <linux/string.h>
> +#include <linux/types.h>
>  #include <linux/acpi.h>
>  #include <linux/pm.h>
>  #include <linux/pm_runtime.h>
> @@ -250,7 +251,7 @@ struct kxcjk1013_data {
>  	/* Ensure timestamp naturally aligned */
>  	struct {
>  		s16 chans[AXIS_MAX];
> -		s64 timestamp __aligned(8);
> +		aligned_s64 timestamp;
>  	} scan;
>  	u8 odr_bits;
>  	u8 range;
> diff --git a/drivers/iio/accel/kxsd9.c b/drivers/iio/accel/kxsd9.c
> index 70dfd6e354db..6d2b0a22e550 100644
> --- a/drivers/iio/accel/kxsd9.c
> +++ b/drivers/iio/accel/kxsd9.c
> @@ -15,6 +15,7 @@
>  #include <linux/kernel.h>
>  #include <linux/sysfs.h>
>  #include <linux/slab.h>
> +#include <linux/types.h>
>  #include <linux/module.h>
>  #include <linux/regmap.h>
>  #include <linux/bitops.h>
> @@ -215,7 +216,7 @@ static irqreturn_t kxsd9_trigger_handler(int irq, void *p)
>  	 */
>  	struct {
>  		__be16 chan[4];
> -		s64 ts __aligned(8);
> +		aligned_s64 ts;
>  	} hw_values;
>  	int ret;
>  
> diff --git a/drivers/iio/accel/mma7455_core.c
> b/drivers/iio/accel/mma7455_core.c
> index a34195b3215d..50f7ac1845c6 100644
> --- a/drivers/iio/accel/mma7455_core.c
> +++ b/drivers/iio/accel/mma7455_core.c
> @@ -19,6 +19,7 @@
>  #include <linux/iio/triggered_buffer.h>
>  #include <linux/module.h>
>  #include <linux/regmap.h>
> +#include <linux/types.h>
>  
>  #include "mma7455.h"
>  
> @@ -58,7 +59,7 @@ struct mma7455_data {
>  	 */
>  	struct {
>  		__le16 channels[3];
> -		s64 ts __aligned(8);
> +		aligned_s64 ts;
>  	} scan;
>  };
>  
> diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c
> index 62e6369e2269..de4525b30edc 100644
> --- a/drivers/iio/accel/mma8452.c
> +++ b/drivers/iio/accel/mma8452.c
> @@ -32,6 +32,7 @@
>  #include <linux/delay.h>
>  #include <linux/pm_runtime.h>
>  #include <linux/regulator/consumer.h>
> +#include <linux/types.h>
>  
>  #define MMA8452_STATUS				0x00
>  #define  MMA8452_STATUS_DRDY			(BIT(2) | BIT(1) | BIT(0))
> @@ -115,7 +116,7 @@ struct mma8452_data {
>  	/* Ensure correct alignment of time stamp when present */
>  	struct {
>  		__be16 channels[3];
> -		s64 ts __aligned(8);
> +		aligned_s64 ts;
>  	} buffer;
>  };
>  
> diff --git a/drivers/iio/accel/msa311.c b/drivers/iio/accel/msa311.c
> index 57025354c7cd..e7fb860f3233 100644
> --- a/drivers/iio/accel/msa311.c
> +++ b/drivers/iio/accel/msa311.c
> @@ -34,6 +34,7 @@
>  #include <linux/pm_runtime.h>
>  #include <linux/regmap.h>
>  #include <linux/string_choices.h>
> +#include <linux/types.h>
>  #include <linux/units.h>
>  
>  #include <linux/iio/buffer.h>
> @@ -893,7 +894,7 @@ static irqreturn_t msa311_buffer_thread(int irq, void *p)
>  	__le16 axis;
>  	struct {
>  		__le16 channels[MSA311_SI_Z + 1];
> -		s64 ts __aligned(8);
> +		aligned_s64 ts;
>  	} buf;
>  
>  	memset(&buf, 0, sizeof(buf));
> diff --git a/drivers/iio/accel/mxc4005.c b/drivers/iio/accel/mxc4005.c
> index fc54a2a4693c..cb5c4e354fc0 100644
> --- a/drivers/iio/accel/mxc4005.c
> +++ b/drivers/iio/accel/mxc4005.c
> @@ -11,6 +11,7 @@
>  #include <linux/iio/iio.h>
>  #include <linux/mod_devicetable.h>
>  #include <linux/regmap.h>
> +#include <linux/types.h>
>  #include <linux/iio/sysfs.h>
>  #include <linux/iio/trigger.h>
>  #include <linux/iio/buffer.h>
> @@ -69,7 +70,7 @@ struct mxc4005_data {
>  	/* Ensure timestamp is naturally aligned */
>  	struct {
>  		__be16 chans[3];
> -		s64 timestamp __aligned(8);
> +		aligned_s64 timestamp;
>  	} scan;
>  	bool trigger_enabled;
>  	unsigned int control;
> diff --git a/drivers/iio/accel/stk8312.c b/drivers/iio/accel/stk8312.c
> index abead190254b..471c154c3631 100644
> --- a/drivers/iio/accel/stk8312.c
> +++ b/drivers/iio/accel/stk8312.c
> @@ -12,6 +12,7 @@
>  #include <linux/kernel.h>
>  #include <linux/module.h>
>  #include <linux/delay.h>
> +#include <linux/types.h>
>  #include <linux/iio/buffer.h>
>  #include <linux/iio/iio.h>
>  #include <linux/iio/sysfs.h>
> @@ -105,7 +106,7 @@ struct stk8312_data {
>  	/* Ensure timestamp is naturally aligned */
>  	struct {
>  		s8 chans[3];
> -		s64 timestamp __aligned(8);
> +		aligned_s64 timestamp;
>  	} scan;
>  };
>  
> diff --git a/drivers/iio/accel/stk8ba50.c b/drivers/iio/accel/stk8ba50.c
> index a32a77324e92..cab592a68622 100644
> --- a/drivers/iio/accel/stk8ba50.c
> +++ b/drivers/iio/accel/stk8ba50.c
> @@ -12,6 +12,7 @@
>  #include <linux/kernel.h>
>  #include <linux/module.h>
>  #include <linux/mod_devicetable.h>
> +#include <linux/types.h>
>  #include <linux/iio/buffer.h>
>  #include <linux/iio/iio.h>
>  #include <linux/iio/sysfs.h>
> @@ -94,7 +95,7 @@ struct stk8ba50_data {
>  	/* Ensure timestamp is naturally aligned */
>  	struct {
>  		s16 chans[3];
> -		s64 timetamp __aligned(8);
> +		aligned_s64 timetamp;
>  	} scan;
>  };
>
Nuno Sá Oct. 21, 2024, 8:18 a.m. UTC | #4
On Sun, 2024-10-20 at 19:07 +0100, Jonathan Cameron wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> e4ca0e59c394 ("types: Complement the aligned types with signed 64-bit one")
> introduced aligned_s64. Use it for all IIO accelerometer drivers.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> ---
> 

Giving a proper tag this time :)

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

> I debated whether to split this up by driver by the time we've done all IIO
> drivers that will be a very large number of trivial patches.
> 
> The changes are minor enough that they shouldn't present much of a
> backporting challenge if needed for future fixes etc.
> 
> I'm find splitting them up if people prefer.
> Next on my list is to look at adding runtime checks that the buffers
> containing these timestamps are big enough but I want this out of the
> way first.
> 
> Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/iio/accel/bma180.c          | 3 ++-
>  drivers/iio/accel/bma220_spi.c      | 1 +
>  drivers/iio/accel/bma400_core.c     | 2 +-
>  drivers/iio/accel/bmc150-accel.h    | 3 ++-
>  drivers/iio/accel/fxls8962af-core.c | 3 ++-
>  drivers/iio/accel/kionix-kx022a.c   | 3 ++-
>  drivers/iio/accel/kxcjk-1013.c      | 3 ++-
>  drivers/iio/accel/kxsd9.c           | 3 ++-
>  drivers/iio/accel/mma7455_core.c    | 3 ++-
>  drivers/iio/accel/mma8452.c         | 3 ++-
>  drivers/iio/accel/msa311.c          | 3 ++-
>  drivers/iio/accel/mxc4005.c         | 3 ++-
>  drivers/iio/accel/stk8312.c         | 3 ++-
>  drivers/iio/accel/stk8ba50.c        | 3 ++-
>  14 files changed, 26 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/iio/accel/bma180.c b/drivers/iio/accel/bma180.c
> index 1fe20eb78a0b..41a517e1630f 100644
> --- a/drivers/iio/accel/bma180.c
> +++ b/drivers/iio/accel/bma180.c
> @@ -21,6 +21,7 @@
>  #include <linux/regulator/consumer.h>
>  #include <linux/slab.h>
>  #include <linux/string.h>
> +#include <linux/types.h>
>  #include <linux/iio/iio.h>
>  #include <linux/iio/sysfs.h>
>  #include <linux/iio/buffer.h>
> @@ -144,7 +145,7 @@ struct bma180_data {
>  	/* Ensure timestamp is naturally aligned */
>  	struct {
>  		s16 chan[4];
> -		s64 timestamp __aligned(8);
> +		aligned_s64 timestamp;
>  	} scan;
>  };
>  
> diff --git a/drivers/iio/accel/bma220_spi.c b/drivers/iio/accel/bma220_spi.c
> index d33218e40c79..2d27a592a61e 100644
> --- a/drivers/iio/accel/bma220_spi.c
> +++ b/drivers/iio/accel/bma220_spi.c
> @@ -9,6 +9,7 @@
>  #include <linux/kernel.h>
>  #include <linux/mod_devicetable.h>
>  #include <linux/module.h>
> +#include <linux/types.h>
>  #include <linux/spi/spi.h>
>  
>  #include <linux/iio/buffer.h>
> diff --git a/drivers/iio/accel/bma400_core.c b/drivers/iio/accel/bma400_core.c
> index d96840d135c6..eb32c963dfc8 100644
> --- a/drivers/iio/accel/bma400_core.c
> +++ b/drivers/iio/accel/bma400_core.c
> @@ -115,7 +115,7 @@ struct bma400_data {
>  	struct {
>  		__le16 buff[3];
>  		u8 temperature;
> -		s64 ts __aligned(8);
> +		aligned_s64 ts;
>  	} buffer __aligned(IIO_DMA_MINALIGN);
>  	__le16 status;
>  	__be16 duration;
> diff --git a/drivers/iio/accel/bmc150-accel.h b/drivers/iio/accel/bmc150-
> accel.h
> index 7775c5edaeef..7a7baf52e595 100644
> --- a/drivers/iio/accel/bmc150-accel.h
> +++ b/drivers/iio/accel/bmc150-accel.h
> @@ -6,6 +6,7 @@
>  #include <linux/iio/iio.h>
>  #include <linux/mutex.h>
>  #include <linux/regulator/consumer.h>
> +#include <linux/types.h>
>  #include <linux/workqueue.h>
>  
>  struct regmap;
> @@ -69,7 +70,7 @@ struct bmc150_accel_data {
>  	 */
>  	struct {
>  		__le16 channels[3];
> -		s64 ts __aligned(8);
> +		aligned_s64 ts;
>  	} scan;
>  	u8 bw_bits;
>  	u32 slope_dur;
> diff --git a/drivers/iio/accel/fxls8962af-core.c
> b/drivers/iio/accel/fxls8962af-core.c
> index 37f33c29fb4b..ab427f3461db 100644
> --- a/drivers/iio/accel/fxls8962af-core.c
> +++ b/drivers/iio/accel/fxls8962af-core.c
> @@ -22,6 +22,7 @@
>  #include <linux/property.h>
>  #include <linux/regulator/consumer.h>
>  #include <linux/regmap.h>
> +#include <linux/types.h>
>  
>  #include <linux/iio/buffer.h>
>  #include <linux/iio/events.h>
> @@ -163,7 +164,7 @@ struct fxls8962af_data {
>  	const struct fxls8962af_chip_info *chip_info;
>  	struct {
>  		__le16 channels[3];
> -		s64 ts __aligned(8);
> +		aligned_s64 ts;
>  	} scan;
>  	int64_t timestamp, old_timestamp;	/* Only used in hw fifo mode.
> */
>  	struct iio_mount_matrix orientation;
> diff --git a/drivers/iio/accel/kionix-kx022a.c b/drivers/iio/accel/kionix-
> kx022a.c
> index 53d59a04ae15..32387819995d 100644
> --- a/drivers/iio/accel/kionix-kx022a.c
> +++ b/drivers/iio/accel/kionix-kx022a.c
> @@ -16,6 +16,7 @@
>  #include <linux/regulator/consumer.h>
>  #include <linux/slab.h>
>  #include <linux/string_choices.h>
> +#include <linux/types.h>
>  #include <linux/units.h>
>  
>  #include <linux/iio/iio.h>
> @@ -292,7 +293,7 @@ struct kx022a_data {
>  	__le16 buffer[8] __aligned(IIO_DMA_MINALIGN);
>  	struct {
>  		__le16 channels[3];
> -		s64 ts __aligned(8);
> +		aligned_s64 ts;
>  	} scan;
>  };
>  
> diff --git a/drivers/iio/accel/kxcjk-1013.c b/drivers/iio/accel/kxcjk-1013.c
> index b76df8816323..bbf65fc97b08 100644
> --- a/drivers/iio/accel/kxcjk-1013.c
> +++ b/drivers/iio/accel/kxcjk-1013.c
> @@ -11,6 +11,7 @@
>  #include <linux/bitops.h>
>  #include <linux/slab.h>
>  #include <linux/string.h>
> +#include <linux/types.h>
>  #include <linux/acpi.h>
>  #include <linux/pm.h>
>  #include <linux/pm_runtime.h>
> @@ -250,7 +251,7 @@ struct kxcjk1013_data {
>  	/* Ensure timestamp naturally aligned */
>  	struct {
>  		s16 chans[AXIS_MAX];
> -		s64 timestamp __aligned(8);
> +		aligned_s64 timestamp;
>  	} scan;
>  	u8 odr_bits;
>  	u8 range;
> diff --git a/drivers/iio/accel/kxsd9.c b/drivers/iio/accel/kxsd9.c
> index 70dfd6e354db..6d2b0a22e550 100644
> --- a/drivers/iio/accel/kxsd9.c
> +++ b/drivers/iio/accel/kxsd9.c
> @@ -15,6 +15,7 @@
>  #include <linux/kernel.h>
>  #include <linux/sysfs.h>
>  #include <linux/slab.h>
> +#include <linux/types.h>
>  #include <linux/module.h>
>  #include <linux/regmap.h>
>  #include <linux/bitops.h>
> @@ -215,7 +216,7 @@ static irqreturn_t kxsd9_trigger_handler(int irq, void *p)
>  	 */
>  	struct {
>  		__be16 chan[4];
> -		s64 ts __aligned(8);
> +		aligned_s64 ts;
>  	} hw_values;
>  	int ret;
>  
> diff --git a/drivers/iio/accel/mma7455_core.c
> b/drivers/iio/accel/mma7455_core.c
> index a34195b3215d..50f7ac1845c6 100644
> --- a/drivers/iio/accel/mma7455_core.c
> +++ b/drivers/iio/accel/mma7455_core.c
> @@ -19,6 +19,7 @@
>  #include <linux/iio/triggered_buffer.h>
>  #include <linux/module.h>
>  #include <linux/regmap.h>
> +#include <linux/types.h>
>  
>  #include "mma7455.h"
>  
> @@ -58,7 +59,7 @@ struct mma7455_data {
>  	 */
>  	struct {
>  		__le16 channels[3];
> -		s64 ts __aligned(8);
> +		aligned_s64 ts;
>  	} scan;
>  };
>  
> diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c
> index 62e6369e2269..de4525b30edc 100644
> --- a/drivers/iio/accel/mma8452.c
> +++ b/drivers/iio/accel/mma8452.c
> @@ -32,6 +32,7 @@
>  #include <linux/delay.h>
>  #include <linux/pm_runtime.h>
>  #include <linux/regulator/consumer.h>
> +#include <linux/types.h>
>  
>  #define MMA8452_STATUS				0x00
>  #define  MMA8452_STATUS_DRDY			(BIT(2) | BIT(1) | BIT(0))
> @@ -115,7 +116,7 @@ struct mma8452_data {
>  	/* Ensure correct alignment of time stamp when present */
>  	struct {
>  		__be16 channels[3];
> -		s64 ts __aligned(8);
> +		aligned_s64 ts;
>  	} buffer;
>  };
>  
> diff --git a/drivers/iio/accel/msa311.c b/drivers/iio/accel/msa311.c
> index 57025354c7cd..e7fb860f3233 100644
> --- a/drivers/iio/accel/msa311.c
> +++ b/drivers/iio/accel/msa311.c
> @@ -34,6 +34,7 @@
>  #include <linux/pm_runtime.h>
>  #include <linux/regmap.h>
>  #include <linux/string_choices.h>
> +#include <linux/types.h>
>  #include <linux/units.h>
>  
>  #include <linux/iio/buffer.h>
> @@ -893,7 +894,7 @@ static irqreturn_t msa311_buffer_thread(int irq, void *p)
>  	__le16 axis;
>  	struct {
>  		__le16 channels[MSA311_SI_Z + 1];
> -		s64 ts __aligned(8);
> +		aligned_s64 ts;
>  	} buf;
>  
>  	memset(&buf, 0, sizeof(buf));
> diff --git a/drivers/iio/accel/mxc4005.c b/drivers/iio/accel/mxc4005.c
> index fc54a2a4693c..cb5c4e354fc0 100644
> --- a/drivers/iio/accel/mxc4005.c
> +++ b/drivers/iio/accel/mxc4005.c
> @@ -11,6 +11,7 @@
>  #include <linux/iio/iio.h>
>  #include <linux/mod_devicetable.h>
>  #include <linux/regmap.h>
> +#include <linux/types.h>
>  #include <linux/iio/sysfs.h>
>  #include <linux/iio/trigger.h>
>  #include <linux/iio/buffer.h>
> @@ -69,7 +70,7 @@ struct mxc4005_data {
>  	/* Ensure timestamp is naturally aligned */
>  	struct {
>  		__be16 chans[3];
> -		s64 timestamp __aligned(8);
> +		aligned_s64 timestamp;
>  	} scan;
>  	bool trigger_enabled;
>  	unsigned int control;
> diff --git a/drivers/iio/accel/stk8312.c b/drivers/iio/accel/stk8312.c
> index abead190254b..471c154c3631 100644
> --- a/drivers/iio/accel/stk8312.c
> +++ b/drivers/iio/accel/stk8312.c
> @@ -12,6 +12,7 @@
>  #include <linux/kernel.h>
>  #include <linux/module.h>
>  #include <linux/delay.h>
> +#include <linux/types.h>
>  #include <linux/iio/buffer.h>
>  #include <linux/iio/iio.h>
>  #include <linux/iio/sysfs.h>
> @@ -105,7 +106,7 @@ struct stk8312_data {
>  	/* Ensure timestamp is naturally aligned */
>  	struct {
>  		s8 chans[3];
> -		s64 timestamp __aligned(8);
> +		aligned_s64 timestamp;
>  	} scan;
>  };
>  
> diff --git a/drivers/iio/accel/stk8ba50.c b/drivers/iio/accel/stk8ba50.c
> index a32a77324e92..cab592a68622 100644
> --- a/drivers/iio/accel/stk8ba50.c
> +++ b/drivers/iio/accel/stk8ba50.c
> @@ -12,6 +12,7 @@
>  #include <linux/kernel.h>
>  #include <linux/module.h>
>  #include <linux/mod_devicetable.h>
> +#include <linux/types.h>
>  #include <linux/iio/buffer.h>
>  #include <linux/iio/iio.h>
>  #include <linux/iio/sysfs.h>
> @@ -94,7 +95,7 @@ struct stk8ba50_data {
>  	/* Ensure timestamp is naturally aligned */
>  	struct {
>  		s16 chans[3];
> -		s64 timetamp __aligned(8);
> +		aligned_s64 timetamp;
>  	} scan;
>  };
>
Jonathan Cameron Oct. 21, 2024, 6:32 p.m. UTC | #5
On Mon, 21 Oct 2024 10:10:25 +0300
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> On Sun, Oct 20, 2024 at 07:07:20PM +0100, Jonathan Cameron wrote:
> > From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > 
> > e4ca0e59c394 ("types: Complement the aligned types with signed 64-bit one")
> > introduced aligned_s64. Use it for all IIO accelerometer drivers.
> > 
> > Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > 
> > ---
> > 
> > I debated whether to split this up by driver by the time we've done all IIO
> > drivers that will be a very large number of trivial patches.
> > 
> > The changes are minor enough that they shouldn't present much of a
> > backporting challenge if needed for future fixes etc.
> > 
> > I'm find splitting them up if people prefer.
> > Next on my list is to look at adding runtime checks that the buffers
> > containing these timestamps are big enough but I want this out of the
> > way first.  
> 
> I agree on all your points.
> 
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> 

Applied given it's so trivial and 3 people already reviewed!

Thanks,

Jonathan
Dmitry Rokosov Oct. 23, 2024, 12:44 p.m. UTC | #6
On Sun, Oct 20, 2024 at 07:07:20PM +0100, Jonathan Cameron wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> e4ca0e59c394 ("types: Complement the aligned types with signed 64-bit one")
> introduced aligned_s64. Use it for all IIO accelerometer drivers.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Reviewed-by: Dmitry Rokosov <ddrokosov@salutedevices.com>

> 
> ---
> 
> I debated whether to split this up by driver by the time we've done all IIO
> drivers that will be a very large number of trivial patches.
> 
> The changes are minor enough that they shouldn't present much of a
> backporting challenge if needed for future fixes etc.
> 
> I'm find splitting them up if people prefer.
> Next on my list is to look at adding runtime checks that the buffers
> containing these timestamps are big enough but I want this out of the
> way first.
> 
> Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/iio/accel/bma180.c          | 3 ++-
>  drivers/iio/accel/bma220_spi.c      | 1 +
>  drivers/iio/accel/bma400_core.c     | 2 +-
>  drivers/iio/accel/bmc150-accel.h    | 3 ++-
>  drivers/iio/accel/fxls8962af-core.c | 3 ++-
>  drivers/iio/accel/kionix-kx022a.c   | 3 ++-
>  drivers/iio/accel/kxcjk-1013.c      | 3 ++-
>  drivers/iio/accel/kxsd9.c           | 3 ++-
>  drivers/iio/accel/mma7455_core.c    | 3 ++-
>  drivers/iio/accel/mma8452.c         | 3 ++-
>  drivers/iio/accel/msa311.c          | 3 ++-
>  drivers/iio/accel/mxc4005.c         | 3 ++-
>  drivers/iio/accel/stk8312.c         | 3 ++-
>  drivers/iio/accel/stk8ba50.c        | 3 ++-
>  14 files changed, 26 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/iio/accel/bma180.c b/drivers/iio/accel/bma180.c
> index 1fe20eb78a0b..41a517e1630f 100644
> --- a/drivers/iio/accel/bma180.c
> +++ b/drivers/iio/accel/bma180.c
> @@ -21,6 +21,7 @@
>  #include <linux/regulator/consumer.h>
>  #include <linux/slab.h>
>  #include <linux/string.h>
> +#include <linux/types.h>
>  #include <linux/iio/iio.h>
>  #include <linux/iio/sysfs.h>
>  #include <linux/iio/buffer.h>
> @@ -144,7 +145,7 @@ struct bma180_data {
>  	/* Ensure timestamp is naturally aligned */
>  	struct {
>  		s16 chan[4];
> -		s64 timestamp __aligned(8);
> +		aligned_s64 timestamp;
>  	} scan;
>  };
>  
> diff --git a/drivers/iio/accel/bma220_spi.c b/drivers/iio/accel/bma220_spi.c
> index d33218e40c79..2d27a592a61e 100644
> --- a/drivers/iio/accel/bma220_spi.c
> +++ b/drivers/iio/accel/bma220_spi.c
> @@ -9,6 +9,7 @@
>  #include <linux/kernel.h>
>  #include <linux/mod_devicetable.h>
>  #include <linux/module.h>
> +#include <linux/types.h>
>  #include <linux/spi/spi.h>
>  
>  #include <linux/iio/buffer.h>
> diff --git a/drivers/iio/accel/bma400_core.c b/drivers/iio/accel/bma400_core.c
> index d96840d135c6..eb32c963dfc8 100644
> --- a/drivers/iio/accel/bma400_core.c
> +++ b/drivers/iio/accel/bma400_core.c
> @@ -115,7 +115,7 @@ struct bma400_data {
>  	struct {
>  		__le16 buff[3];
>  		u8 temperature;
> -		s64 ts __aligned(8);
> +		aligned_s64 ts;
>  	} buffer __aligned(IIO_DMA_MINALIGN);
>  	__le16 status;
>  	__be16 duration;
> diff --git a/drivers/iio/accel/bmc150-accel.h b/drivers/iio/accel/bmc150-accel.h
> index 7775c5edaeef..7a7baf52e595 100644
> --- a/drivers/iio/accel/bmc150-accel.h
> +++ b/drivers/iio/accel/bmc150-accel.h
> @@ -6,6 +6,7 @@
>  #include <linux/iio/iio.h>
>  #include <linux/mutex.h>
>  #include <linux/regulator/consumer.h>
> +#include <linux/types.h>
>  #include <linux/workqueue.h>
>  
>  struct regmap;
> @@ -69,7 +70,7 @@ struct bmc150_accel_data {
>  	 */
>  	struct {
>  		__le16 channels[3];
> -		s64 ts __aligned(8);
> +		aligned_s64 ts;
>  	} scan;
>  	u8 bw_bits;
>  	u32 slope_dur;
> diff --git a/drivers/iio/accel/fxls8962af-core.c b/drivers/iio/accel/fxls8962af-core.c
> index 37f33c29fb4b..ab427f3461db 100644
> --- a/drivers/iio/accel/fxls8962af-core.c
> +++ b/drivers/iio/accel/fxls8962af-core.c
> @@ -22,6 +22,7 @@
>  #include <linux/property.h>
>  #include <linux/regulator/consumer.h>
>  #include <linux/regmap.h>
> +#include <linux/types.h>
>  
>  #include <linux/iio/buffer.h>
>  #include <linux/iio/events.h>
> @@ -163,7 +164,7 @@ struct fxls8962af_data {
>  	const struct fxls8962af_chip_info *chip_info;
>  	struct {
>  		__le16 channels[3];
> -		s64 ts __aligned(8);
> +		aligned_s64 ts;
>  	} scan;
>  	int64_t timestamp, old_timestamp;	/* Only used in hw fifo mode. */
>  	struct iio_mount_matrix orientation;
> diff --git a/drivers/iio/accel/kionix-kx022a.c b/drivers/iio/accel/kionix-kx022a.c
> index 53d59a04ae15..32387819995d 100644
> --- a/drivers/iio/accel/kionix-kx022a.c
> +++ b/drivers/iio/accel/kionix-kx022a.c
> @@ -16,6 +16,7 @@
>  #include <linux/regulator/consumer.h>
>  #include <linux/slab.h>
>  #include <linux/string_choices.h>
> +#include <linux/types.h>
>  #include <linux/units.h>
>  
>  #include <linux/iio/iio.h>
> @@ -292,7 +293,7 @@ struct kx022a_data {
>  	__le16 buffer[8] __aligned(IIO_DMA_MINALIGN);
>  	struct {
>  		__le16 channels[3];
> -		s64 ts __aligned(8);
> +		aligned_s64 ts;
>  	} scan;
>  };
>  
> diff --git a/drivers/iio/accel/kxcjk-1013.c b/drivers/iio/accel/kxcjk-1013.c
> index b76df8816323..bbf65fc97b08 100644
> --- a/drivers/iio/accel/kxcjk-1013.c
> +++ b/drivers/iio/accel/kxcjk-1013.c
> @@ -11,6 +11,7 @@
>  #include <linux/bitops.h>
>  #include <linux/slab.h>
>  #include <linux/string.h>
> +#include <linux/types.h>
>  #include <linux/acpi.h>
>  #include <linux/pm.h>
>  #include <linux/pm_runtime.h>
> @@ -250,7 +251,7 @@ struct kxcjk1013_data {
>  	/* Ensure timestamp naturally aligned */
>  	struct {
>  		s16 chans[AXIS_MAX];
> -		s64 timestamp __aligned(8);
> +		aligned_s64 timestamp;
>  	} scan;
>  	u8 odr_bits;
>  	u8 range;
> diff --git a/drivers/iio/accel/kxsd9.c b/drivers/iio/accel/kxsd9.c
> index 70dfd6e354db..6d2b0a22e550 100644
> --- a/drivers/iio/accel/kxsd9.c
> +++ b/drivers/iio/accel/kxsd9.c
> @@ -15,6 +15,7 @@
>  #include <linux/kernel.h>
>  #include <linux/sysfs.h>
>  #include <linux/slab.h>
> +#include <linux/types.h>
>  #include <linux/module.h>
>  #include <linux/regmap.h>
>  #include <linux/bitops.h>
> @@ -215,7 +216,7 @@ static irqreturn_t kxsd9_trigger_handler(int irq, void *p)
>  	 */
>  	struct {
>  		__be16 chan[4];
> -		s64 ts __aligned(8);
> +		aligned_s64 ts;
>  	} hw_values;
>  	int ret;
>  
> diff --git a/drivers/iio/accel/mma7455_core.c b/drivers/iio/accel/mma7455_core.c
> index a34195b3215d..50f7ac1845c6 100644
> --- a/drivers/iio/accel/mma7455_core.c
> +++ b/drivers/iio/accel/mma7455_core.c
> @@ -19,6 +19,7 @@
>  #include <linux/iio/triggered_buffer.h>
>  #include <linux/module.h>
>  #include <linux/regmap.h>
> +#include <linux/types.h>
>  
>  #include "mma7455.h"
>  
> @@ -58,7 +59,7 @@ struct mma7455_data {
>  	 */
>  	struct {
>  		__le16 channels[3];
> -		s64 ts __aligned(8);
> +		aligned_s64 ts;
>  	} scan;
>  };
>  
> diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c
> index 62e6369e2269..de4525b30edc 100644
> --- a/drivers/iio/accel/mma8452.c
> +++ b/drivers/iio/accel/mma8452.c
> @@ -32,6 +32,7 @@
>  #include <linux/delay.h>
>  #include <linux/pm_runtime.h>
>  #include <linux/regulator/consumer.h>
> +#include <linux/types.h>
>  
>  #define MMA8452_STATUS				0x00
>  #define  MMA8452_STATUS_DRDY			(BIT(2) | BIT(1) | BIT(0))
> @@ -115,7 +116,7 @@ struct mma8452_data {
>  	/* Ensure correct alignment of time stamp when present */
>  	struct {
>  		__be16 channels[3];
> -		s64 ts __aligned(8);
> +		aligned_s64 ts;
>  	} buffer;
>  };
>  
> diff --git a/drivers/iio/accel/msa311.c b/drivers/iio/accel/msa311.c
> index 57025354c7cd..e7fb860f3233 100644
> --- a/drivers/iio/accel/msa311.c
> +++ b/drivers/iio/accel/msa311.c
> @@ -34,6 +34,7 @@
>  #include <linux/pm_runtime.h>
>  #include <linux/regmap.h>
>  #include <linux/string_choices.h>
> +#include <linux/types.h>
>  #include <linux/units.h>
>  
>  #include <linux/iio/buffer.h>
> @@ -893,7 +894,7 @@ static irqreturn_t msa311_buffer_thread(int irq, void *p)
>  	__le16 axis;
>  	struct {
>  		__le16 channels[MSA311_SI_Z + 1];
> -		s64 ts __aligned(8);
> +		aligned_s64 ts;
>  	} buf;
>  
>  	memset(&buf, 0, sizeof(buf));
> diff --git a/drivers/iio/accel/mxc4005.c b/drivers/iio/accel/mxc4005.c
> index fc54a2a4693c..cb5c4e354fc0 100644
> --- a/drivers/iio/accel/mxc4005.c
> +++ b/drivers/iio/accel/mxc4005.c
> @@ -11,6 +11,7 @@
>  #include <linux/iio/iio.h>
>  #include <linux/mod_devicetable.h>
>  #include <linux/regmap.h>
> +#include <linux/types.h>
>  #include <linux/iio/sysfs.h>
>  #include <linux/iio/trigger.h>
>  #include <linux/iio/buffer.h>
> @@ -69,7 +70,7 @@ struct mxc4005_data {
>  	/* Ensure timestamp is naturally aligned */
>  	struct {
>  		__be16 chans[3];
> -		s64 timestamp __aligned(8);
> +		aligned_s64 timestamp;
>  	} scan;
>  	bool trigger_enabled;
>  	unsigned int control;
> diff --git a/drivers/iio/accel/stk8312.c b/drivers/iio/accel/stk8312.c
> index abead190254b..471c154c3631 100644
> --- a/drivers/iio/accel/stk8312.c
> +++ b/drivers/iio/accel/stk8312.c
> @@ -12,6 +12,7 @@
>  #include <linux/kernel.h>
>  #include <linux/module.h>
>  #include <linux/delay.h>
> +#include <linux/types.h>
>  #include <linux/iio/buffer.h>
>  #include <linux/iio/iio.h>
>  #include <linux/iio/sysfs.h>
> @@ -105,7 +106,7 @@ struct stk8312_data {
>  	/* Ensure timestamp is naturally aligned */
>  	struct {
>  		s8 chans[3];
> -		s64 timestamp __aligned(8);
> +		aligned_s64 timestamp;
>  	} scan;
>  };
>  
> diff --git a/drivers/iio/accel/stk8ba50.c b/drivers/iio/accel/stk8ba50.c
> index a32a77324e92..cab592a68622 100644
> --- a/drivers/iio/accel/stk8ba50.c
> +++ b/drivers/iio/accel/stk8ba50.c
> @@ -12,6 +12,7 @@
>  #include <linux/kernel.h>
>  #include <linux/module.h>
>  #include <linux/mod_devicetable.h>
> +#include <linux/types.h>
>  #include <linux/iio/buffer.h>
>  #include <linux/iio/iio.h>
>  #include <linux/iio/sysfs.h>
> @@ -94,7 +95,7 @@ struct stk8ba50_data {
>  	/* Ensure timestamp is naturally aligned */
>  	struct {
>  		s16 chans[3];
> -		s64 timetamp __aligned(8);
> +		aligned_s64 timetamp;
>  	} scan;
>  };
>  
> -- 
> 2.46.2
> 
>
diff mbox series

Patch

diff --git a/drivers/iio/accel/bma180.c b/drivers/iio/accel/bma180.c
index 1fe20eb78a0b..41a517e1630f 100644
--- a/drivers/iio/accel/bma180.c
+++ b/drivers/iio/accel/bma180.c
@@ -21,6 +21,7 @@ 
 #include <linux/regulator/consumer.h>
 #include <linux/slab.h>
 #include <linux/string.h>
+#include <linux/types.h>
 #include <linux/iio/iio.h>
 #include <linux/iio/sysfs.h>
 #include <linux/iio/buffer.h>
@@ -144,7 +145,7 @@  struct bma180_data {
 	/* Ensure timestamp is naturally aligned */
 	struct {
 		s16 chan[4];
-		s64 timestamp __aligned(8);
+		aligned_s64 timestamp;
 	} scan;
 };
 
diff --git a/drivers/iio/accel/bma220_spi.c b/drivers/iio/accel/bma220_spi.c
index d33218e40c79..2d27a592a61e 100644
--- a/drivers/iio/accel/bma220_spi.c
+++ b/drivers/iio/accel/bma220_spi.c
@@ -9,6 +9,7 @@ 
 #include <linux/kernel.h>
 #include <linux/mod_devicetable.h>
 #include <linux/module.h>
+#include <linux/types.h>
 #include <linux/spi/spi.h>
 
 #include <linux/iio/buffer.h>
diff --git a/drivers/iio/accel/bma400_core.c b/drivers/iio/accel/bma400_core.c
index d96840d135c6..eb32c963dfc8 100644
--- a/drivers/iio/accel/bma400_core.c
+++ b/drivers/iio/accel/bma400_core.c
@@ -115,7 +115,7 @@  struct bma400_data {
 	struct {
 		__le16 buff[3];
 		u8 temperature;
-		s64 ts __aligned(8);
+		aligned_s64 ts;
 	} buffer __aligned(IIO_DMA_MINALIGN);
 	__le16 status;
 	__be16 duration;
diff --git a/drivers/iio/accel/bmc150-accel.h b/drivers/iio/accel/bmc150-accel.h
index 7775c5edaeef..7a7baf52e595 100644
--- a/drivers/iio/accel/bmc150-accel.h
+++ b/drivers/iio/accel/bmc150-accel.h
@@ -6,6 +6,7 @@ 
 #include <linux/iio/iio.h>
 #include <linux/mutex.h>
 #include <linux/regulator/consumer.h>
+#include <linux/types.h>
 #include <linux/workqueue.h>
 
 struct regmap;
@@ -69,7 +70,7 @@  struct bmc150_accel_data {
 	 */
 	struct {
 		__le16 channels[3];
-		s64 ts __aligned(8);
+		aligned_s64 ts;
 	} scan;
 	u8 bw_bits;
 	u32 slope_dur;
diff --git a/drivers/iio/accel/fxls8962af-core.c b/drivers/iio/accel/fxls8962af-core.c
index 37f33c29fb4b..ab427f3461db 100644
--- a/drivers/iio/accel/fxls8962af-core.c
+++ b/drivers/iio/accel/fxls8962af-core.c
@@ -22,6 +22,7 @@ 
 #include <linux/property.h>
 #include <linux/regulator/consumer.h>
 #include <linux/regmap.h>
+#include <linux/types.h>
 
 #include <linux/iio/buffer.h>
 #include <linux/iio/events.h>
@@ -163,7 +164,7 @@  struct fxls8962af_data {
 	const struct fxls8962af_chip_info *chip_info;
 	struct {
 		__le16 channels[3];
-		s64 ts __aligned(8);
+		aligned_s64 ts;
 	} scan;
 	int64_t timestamp, old_timestamp;	/* Only used in hw fifo mode. */
 	struct iio_mount_matrix orientation;
diff --git a/drivers/iio/accel/kionix-kx022a.c b/drivers/iio/accel/kionix-kx022a.c
index 53d59a04ae15..32387819995d 100644
--- a/drivers/iio/accel/kionix-kx022a.c
+++ b/drivers/iio/accel/kionix-kx022a.c
@@ -16,6 +16,7 @@ 
 #include <linux/regulator/consumer.h>
 #include <linux/slab.h>
 #include <linux/string_choices.h>
+#include <linux/types.h>
 #include <linux/units.h>
 
 #include <linux/iio/iio.h>
@@ -292,7 +293,7 @@  struct kx022a_data {
 	__le16 buffer[8] __aligned(IIO_DMA_MINALIGN);
 	struct {
 		__le16 channels[3];
-		s64 ts __aligned(8);
+		aligned_s64 ts;
 	} scan;
 };
 
diff --git a/drivers/iio/accel/kxcjk-1013.c b/drivers/iio/accel/kxcjk-1013.c
index b76df8816323..bbf65fc97b08 100644
--- a/drivers/iio/accel/kxcjk-1013.c
+++ b/drivers/iio/accel/kxcjk-1013.c
@@ -11,6 +11,7 @@ 
 #include <linux/bitops.h>
 #include <linux/slab.h>
 #include <linux/string.h>
+#include <linux/types.h>
 #include <linux/acpi.h>
 #include <linux/pm.h>
 #include <linux/pm_runtime.h>
@@ -250,7 +251,7 @@  struct kxcjk1013_data {
 	/* Ensure timestamp naturally aligned */
 	struct {
 		s16 chans[AXIS_MAX];
-		s64 timestamp __aligned(8);
+		aligned_s64 timestamp;
 	} scan;
 	u8 odr_bits;
 	u8 range;
diff --git a/drivers/iio/accel/kxsd9.c b/drivers/iio/accel/kxsd9.c
index 70dfd6e354db..6d2b0a22e550 100644
--- a/drivers/iio/accel/kxsd9.c
+++ b/drivers/iio/accel/kxsd9.c
@@ -15,6 +15,7 @@ 
 #include <linux/kernel.h>
 #include <linux/sysfs.h>
 #include <linux/slab.h>
+#include <linux/types.h>
 #include <linux/module.h>
 #include <linux/regmap.h>
 #include <linux/bitops.h>
@@ -215,7 +216,7 @@  static irqreturn_t kxsd9_trigger_handler(int irq, void *p)
 	 */
 	struct {
 		__be16 chan[4];
-		s64 ts __aligned(8);
+		aligned_s64 ts;
 	} hw_values;
 	int ret;
 
diff --git a/drivers/iio/accel/mma7455_core.c b/drivers/iio/accel/mma7455_core.c
index a34195b3215d..50f7ac1845c6 100644
--- a/drivers/iio/accel/mma7455_core.c
+++ b/drivers/iio/accel/mma7455_core.c
@@ -19,6 +19,7 @@ 
 #include <linux/iio/triggered_buffer.h>
 #include <linux/module.h>
 #include <linux/regmap.h>
+#include <linux/types.h>
 
 #include "mma7455.h"
 
@@ -58,7 +59,7 @@  struct mma7455_data {
 	 */
 	struct {
 		__le16 channels[3];
-		s64 ts __aligned(8);
+		aligned_s64 ts;
 	} scan;
 };
 
diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c
index 62e6369e2269..de4525b30edc 100644
--- a/drivers/iio/accel/mma8452.c
+++ b/drivers/iio/accel/mma8452.c
@@ -32,6 +32,7 @@ 
 #include <linux/delay.h>
 #include <linux/pm_runtime.h>
 #include <linux/regulator/consumer.h>
+#include <linux/types.h>
 
 #define MMA8452_STATUS				0x00
 #define  MMA8452_STATUS_DRDY			(BIT(2) | BIT(1) | BIT(0))
@@ -115,7 +116,7 @@  struct mma8452_data {
 	/* Ensure correct alignment of time stamp when present */
 	struct {
 		__be16 channels[3];
-		s64 ts __aligned(8);
+		aligned_s64 ts;
 	} buffer;
 };
 
diff --git a/drivers/iio/accel/msa311.c b/drivers/iio/accel/msa311.c
index 57025354c7cd..e7fb860f3233 100644
--- a/drivers/iio/accel/msa311.c
+++ b/drivers/iio/accel/msa311.c
@@ -34,6 +34,7 @@ 
 #include <linux/pm_runtime.h>
 #include <linux/regmap.h>
 #include <linux/string_choices.h>
+#include <linux/types.h>
 #include <linux/units.h>
 
 #include <linux/iio/buffer.h>
@@ -893,7 +894,7 @@  static irqreturn_t msa311_buffer_thread(int irq, void *p)
 	__le16 axis;
 	struct {
 		__le16 channels[MSA311_SI_Z + 1];
-		s64 ts __aligned(8);
+		aligned_s64 ts;
 	} buf;
 
 	memset(&buf, 0, sizeof(buf));
diff --git a/drivers/iio/accel/mxc4005.c b/drivers/iio/accel/mxc4005.c
index fc54a2a4693c..cb5c4e354fc0 100644
--- a/drivers/iio/accel/mxc4005.c
+++ b/drivers/iio/accel/mxc4005.c
@@ -11,6 +11,7 @@ 
 #include <linux/iio/iio.h>
 #include <linux/mod_devicetable.h>
 #include <linux/regmap.h>
+#include <linux/types.h>
 #include <linux/iio/sysfs.h>
 #include <linux/iio/trigger.h>
 #include <linux/iio/buffer.h>
@@ -69,7 +70,7 @@  struct mxc4005_data {
 	/* Ensure timestamp is naturally aligned */
 	struct {
 		__be16 chans[3];
-		s64 timestamp __aligned(8);
+		aligned_s64 timestamp;
 	} scan;
 	bool trigger_enabled;
 	unsigned int control;
diff --git a/drivers/iio/accel/stk8312.c b/drivers/iio/accel/stk8312.c
index abead190254b..471c154c3631 100644
--- a/drivers/iio/accel/stk8312.c
+++ b/drivers/iio/accel/stk8312.c
@@ -12,6 +12,7 @@ 
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/delay.h>
+#include <linux/types.h>
 #include <linux/iio/buffer.h>
 #include <linux/iio/iio.h>
 #include <linux/iio/sysfs.h>
@@ -105,7 +106,7 @@  struct stk8312_data {
 	/* Ensure timestamp is naturally aligned */
 	struct {
 		s8 chans[3];
-		s64 timestamp __aligned(8);
+		aligned_s64 timestamp;
 	} scan;
 };
 
diff --git a/drivers/iio/accel/stk8ba50.c b/drivers/iio/accel/stk8ba50.c
index a32a77324e92..cab592a68622 100644
--- a/drivers/iio/accel/stk8ba50.c
+++ b/drivers/iio/accel/stk8ba50.c
@@ -12,6 +12,7 @@ 
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/mod_devicetable.h>
+#include <linux/types.h>
 #include <linux/iio/buffer.h>
 #include <linux/iio/iio.h>
 #include <linux/iio/sysfs.h>
@@ -94,7 +95,7 @@  struct stk8ba50_data {
 	/* Ensure timestamp is naturally aligned */
 	struct {
 		s16 chans[3];
-		s64 timetamp __aligned(8);
+		aligned_s64 timetamp;
 	} scan;
 };