diff mbox series

[v1,2/3] iio: imu: st_lsm6dsx: Use aligned data type for timestamp

Message ID 20230815154027.12468-2-andriy.shevchenko@linux.intel.com (mailing list archive)
State Changes Requested
Headers show
Series [v1,1/3] types: Complement the aligned types with signed 64-bit one | expand

Commit Message

Andy Shevchenko Aug. 15, 2023, 3:40 p.m. UTC
Use __aligned_s64 for the timestamp field.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Jonathan Cameron Aug. 28, 2023, 4:03 p.m. UTC | #1
On Tue, 15 Aug 2023 18:40:26 +0300
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> Use __aligned_s64 for the timestamp field.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h
> index c19237717e81..d3d4b3281aa6 100644
> --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h
> +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h
> @@ -442,10 +442,9 @@ struct st_lsm6dsx_hw {
>  	const struct st_lsm6dsx_settings *settings;
>  
>  	struct iio_mount_matrix orientation;
> -	/* Ensure natural alignment of buffer elements */
>  	struct {
>  		__le16 channels[3];
> -		s64 ts __aligned(8);
> +		__aligned_s64 ts;

aligned_s64 as it's internal to the kernel?

>  	} scan[ST_LSM6DSX_ID_MAX];
>  };
>
Andy Shevchenko Aug. 29, 2023, 1:18 p.m. UTC | #2
On Mon, Aug 28, 2023 at 05:03:41PM +0100, Jonathan Cameron wrote:
> On Tue, 15 Aug 2023 18:40:26 +0300
> Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

...

> >  	struct {
> >  		__le16 channels[3];
> > -		s64 ts __aligned(8);
> > +		__aligned_s64 ts;
> 
> aligned_s64 as it's internal to the kernel?

Either works, but strictly speaking you are right, better no underscored
variant.

> >  	} scan[ST_LSM6DSX_ID_MAX];
diff mbox series

Patch

diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h
index c19237717e81..d3d4b3281aa6 100644
--- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h
+++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h
@@ -442,10 +442,9 @@  struct st_lsm6dsx_hw {
 	const struct st_lsm6dsx_settings *settings;
 
 	struct iio_mount_matrix orientation;
-	/* Ensure natural alignment of buffer elements */
 	struct {
 		__le16 channels[3];
-		s64 ts __aligned(8);
+		__aligned_s64 ts;
 	} scan[ST_LSM6DSX_ID_MAX];
 };