[PATCH 3/8] iio: addac: ad74413r: use aligned_s64 for timestamp

David Lechner posted 8 patches 9 months, 3 weeks ago
There is a newer version of this series
[PATCH 3/8] iio: addac: ad74413r: use aligned_s64 for timestamp
Posted by David Lechner 9 months, 3 weeks ago
Follow the pattern of other drivers and use aligned_s64 for the
timestamp. Technically there was no issue here since
AD74413R_FRAME_SIZE * AD74413R_CHANNEL_MAX == 16 and IIO_DMA_MINALIGN
is always a multiple of 8. But best to conform in case someone copies
this to new code and then tweaks something.

Also move the unaligned.h header while touching this since it was the
only one not in alphabetical order.

Signed-off-by: David Lechner <dlechner@baylibre.com>
---
 drivers/iio/addac/ad74413r.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/addac/ad74413r.c b/drivers/iio/addac/ad74413r.c
index f0929616ab899cb374f00869787321eed4ccde16..a0bb1dbcb7ad9d02337d0990e5a3f90be7eaa4ac 100644
--- a/drivers/iio/addac/ad74413r.c
+++ b/drivers/iio/addac/ad74413r.c
@@ -4,7 +4,6 @@
  * Author: Cosmin Tanislav <cosmin.tanislav@analog.com>
  */
 
-#include <linux/unaligned.h>
 #include <linux/bitfield.h>
 #include <linux/cleanup.h>
 #include <linux/crc8.h>
@@ -24,6 +23,8 @@
 #include <linux/regmap.h>
 #include <linux/regulator/consumer.h>
 #include <linux/spi/spi.h>
+#include <linux/types.h>
+#include <linux/unaligned.h>
 
 #include <dt-bindings/iio/addac/adi,ad74413r.h>
 
@@ -84,7 +85,7 @@ struct ad74413r_state {
 	 */
 	struct {
 		u8 rx_buf[AD74413R_FRAME_SIZE * AD74413R_CHANNEL_MAX];
-		s64 timestamp;
+		aligned_s64 timestamp;
 	} adc_samples_buf __aligned(IIO_DMA_MINALIGN);
 
 	u8	adc_samples_tx_buf[AD74413R_FRAME_SIZE * AD74413R_CHANNEL_MAX];

-- 
2.43.0
Re: [PATCH 3/8] iio: addac: ad74413r: use aligned_s64 for timestamp
Posted by Nuno Sá 9 months, 3 weeks ago
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. Technically there was no issue here since
> AD74413R_FRAME_SIZE * AD74413R_CHANNEL_MAX == 16 and IIO_DMA_MINALIGN
> is always a multiple of 8. But best to conform in case someone copies
> this to new code and then tweaks something.
> 
> Also move the unaligned.h header while touching this since it was the
> only one not in alphabetical order.
> 
> Signed-off-by: David Lechner <dlechner@baylibre.com>
> ---

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

>  drivers/iio/addac/ad74413r.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/addac/ad74413r.c b/drivers/iio/addac/ad74413r.c
> index
> f0929616ab899cb374f00869787321eed4ccde16..a0bb1dbcb7ad9d02337d0990e5a3f90be7eaa4ac
> 100644
> --- a/drivers/iio/addac/ad74413r.c
> +++ b/drivers/iio/addac/ad74413r.c
> @@ -4,7 +4,6 @@
>   * Author: Cosmin Tanislav <cosmin.tanislav@analog.com>
>   */
>  
> -#include <linux/unaligned.h>
>  #include <linux/bitfield.h>
>  #include <linux/cleanup.h>
>  #include <linux/crc8.h>
> @@ -24,6 +23,8 @@
>  #include <linux/regmap.h>
>  #include <linux/regulator/consumer.h>
>  #include <linux/spi/spi.h>
> +#include <linux/types.h>
> +#include <linux/unaligned.h>
>  
>  #include <dt-bindings/iio/addac/adi,ad74413r.h>
>  
> @@ -84,7 +85,7 @@ struct ad74413r_state {
>  	 */
>  	struct {
>  		u8 rx_buf[AD74413R_FRAME_SIZE * AD74413R_CHANNEL_MAX];
> -		s64 timestamp;
> +		aligned_s64 timestamp;
>  	} adc_samples_buf __aligned(IIO_DMA_MINALIGN);
>  
>  	u8	adc_samples_tx_buf[AD74413R_FRAME_SIZE * AD74413R_CHANNEL_MAX];
> 
Re: [PATCH 3/8] iio: addac: ad74413r: use aligned_s64 for timestamp
Posted by Jonathan Cameron 9 months, 3 weeks ago
On Fri, 18 Apr 2025 09:57:38 +0100
Nuno Sá <noname.nuno@gmail.com> wrote:

> 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. Technically there was no issue here since
> > AD74413R_FRAME_SIZE * AD74413R_CHANNEL_MAX == 16 and IIO_DMA_MINALIGN
> > is always a multiple of 8. But best to conform in case someone copies
> > this to new code and then tweaks something.
> > 
> > Also move the unaligned.h header while touching this since it was the
> > only one not in alphabetical order.
> > 
> > Signed-off-by: David Lechner <dlechner@baylibre.com>
> > ---  
> 
> Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Applied.
> 
> >  drivers/iio/addac/ad74413r.c | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/iio/addac/ad74413r.c b/drivers/iio/addac/ad74413r.c
> > index
> > f0929616ab899cb374f00869787321eed4ccde16..a0bb1dbcb7ad9d02337d0990e5a3f90be7eaa4ac
> > 100644
> > --- a/drivers/iio/addac/ad74413r.c
> > +++ b/drivers/iio/addac/ad74413r.c
> > @@ -4,7 +4,6 @@
> >   * Author: Cosmin Tanislav <cosmin.tanislav@analog.com>
> >   */
> >  
> > -#include <linux/unaligned.h>
> >  #include <linux/bitfield.h>
> >  #include <linux/cleanup.h>
> >  #include <linux/crc8.h>
> > @@ -24,6 +23,8 @@
> >  #include <linux/regmap.h>
> >  #include <linux/regulator/consumer.h>
> >  #include <linux/spi/spi.h>
> > +#include <linux/types.h>
> > +#include <linux/unaligned.h>
> >  
> >  #include <dt-bindings/iio/addac/adi,ad74413r.h>
> >  
> > @@ -84,7 +85,7 @@ struct ad74413r_state {
> >  	 */
> >  	struct {
> >  		u8 rx_buf[AD74413R_FRAME_SIZE * AD74413R_CHANNEL_MAX];
> > -		s64 timestamp;
> > +		aligned_s64 timestamp;
> >  	} adc_samples_buf __aligned(IIO_DMA_MINALIGN);
> >  
> >  	u8	adc_samples_tx_buf[AD74413R_FRAME_SIZE * AD74413R_CHANNEL_MAX];
> >   
>