diff mbox series

[5/8] iio: chemical: sps30: use aligned_s64 for timestamp

Message ID 20250417-iio-more-timestamp-alignment-v1-5-eafac1e22318@baylibre.com (mailing list archive)
State New
Headers show
Series iio: more timestamp alignment | expand

Commit Message

David Lechner April 17, 2025, 4:52 p.m. UTC
Follow the pattern of other drivers and use aligned_s64 for the
timestamp. This will ensure that the timestamp is correctly aligned on
all architectures.

Signed-off-by: David Lechner <dlechner@baylibre.com>
---
 drivers/iio/chemical/sps30.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jonathan Cameron April 17, 2025, 5:36 p.m. UTC | #1
On Thu, 17 Apr 2025 11:52:37 -0500
David Lechner <dlechner@baylibre.com> wrote:

> Follow the pattern of other drivers and use aligned_s64 for the
> timestamp. This will ensure that the timestamp is correctly aligned on
> all architectures.
> 
> Signed-off-by: David Lechner <dlechner@baylibre.com>
> ---
>  drivers/iio/chemical/sps30.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/chemical/sps30.c b/drivers/iio/chemical/sps30.c
> index 6f4f2ba2c09d5e691df13bc11ca9e3a910d98dc8..a7888146188d09ddbf376b398ee24dab7f0e2611 100644
> --- a/drivers/iio/chemical/sps30.c
> +++ b/drivers/iio/chemical/sps30.c
> @@ -108,7 +108,7 @@ static irqreturn_t sps30_trigger_handler(int irq, void *p)
>  	int ret;
>  	struct {
>  		s32 data[4]; /* PM1, PM2P5, PM4, PM10 */
> -		s64 ts;
> +		aligned_s64 ts;
Definitely a bug as we have no idea what is next on the stack
so fixes tag needed.

>  	} scan;
>  
>  	mutex_lock(&state->lock);
>
Nuno Sá April 18, 2025, 8:58 a.m. UTC | #2
On Thu, 2025-04-17 at 11:52 -0500, David Lechner wrote:
> Follow the pattern of other drivers and use aligned_s64 for the
> timestamp. This will ensure that the timestamp is correctly aligned on
> all architectures.
> 
> Signed-off-by: David Lechner <dlechner@baylibre.com>
> ---

ditto

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

>  drivers/iio/chemical/sps30.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/chemical/sps30.c b/drivers/iio/chemical/sps30.c
> index
> 6f4f2ba2c09d5e691df13bc11ca9e3a910d98dc8..a7888146188d09ddbf376b398ee24dab7f0e2611
> 100644
> --- a/drivers/iio/chemical/sps30.c
> +++ b/drivers/iio/chemical/sps30.c
> @@ -108,7 +108,7 @@ static irqreturn_t sps30_trigger_handler(int irq, void *p)
>  	int ret;
>  	struct {
>  		s32 data[4]; /* PM1, PM2P5, PM4, PM10 */
> -		s64 ts;
> +		aligned_s64 ts;
>  	} scan;
>  
>  	mutex_lock(&state->lock);
>
Jonathan Cameron April 18, 2025, 2:53 p.m. UTC | #3
On Thu, 17 Apr 2025 18:36:21 +0100
Jonathan Cameron <Jonathan.Cameron@huawei.com> wrote:

> On Thu, 17 Apr 2025 11:52:37 -0500
> David Lechner <dlechner@baylibre.com> wrote:
> 
> > Follow the pattern of other drivers and use aligned_s64 for the
> > timestamp. This will ensure that the timestamp is correctly aligned on
> > all architectures.
> > 
> > Signed-off-by: David Lechner <dlechner@baylibre.com>
> > ---
> >  drivers/iio/chemical/sps30.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/iio/chemical/sps30.c b/drivers/iio/chemical/sps30.c
> > index 6f4f2ba2c09d5e691df13bc11ca9e3a910d98dc8..a7888146188d09ddbf376b398ee24dab7f0e2611 100644
> > --- a/drivers/iio/chemical/sps30.c
> > +++ b/drivers/iio/chemical/sps30.c
> > @@ -108,7 +108,7 @@ static irqreturn_t sps30_trigger_handler(int irq, void *p)
> >  	int ret;
> >  	struct {
> >  		s32 data[4]; /* PM1, PM2P5, PM4, PM10 */
> > -		s64 ts;
> > +		aligned_s64 ts;  
> Definitely a bug as we have no idea what is next on the stack
> so fixes tag needed.
Applied with:
Fixes: a5bf6fdd19c3 ("iio:chemical:sps30: Fix timestamp alignment")


> 
> >  	} scan;
> >  
> >  	mutex_lock(&state->lock);
> >   
>
diff mbox series

Patch

diff --git a/drivers/iio/chemical/sps30.c b/drivers/iio/chemical/sps30.c
index 6f4f2ba2c09d5e691df13bc11ca9e3a910d98dc8..a7888146188d09ddbf376b398ee24dab7f0e2611 100644
--- a/drivers/iio/chemical/sps30.c
+++ b/drivers/iio/chemical/sps30.c
@@ -108,7 +108,7 @@  static irqreturn_t sps30_trigger_handler(int irq, void *p)
 	int ret;
 	struct {
 		s32 data[4]; /* PM1, PM2P5, PM4, PM10 */
-		s64 ts;
+		aligned_s64 ts;
 	} scan;
 
 	mutex_lock(&state->lock);