diff mbox series

[07/11] iio: potentiostat: lmp91000: Fix alignment of buffer in iio_push_to_buffers_with_timestamp()

Message ID 20210501171352.512953-8-jic23@kernel.org (mailing list archive)
State New, archived
Headers show
Series IIO: Alignment fixes part 3 - __aligned(8) used to ensure alignment | expand

Commit Message

Jonathan Cameron May 1, 2021, 5:13 p.m. UTC
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Add __aligned(8) to ensure the buffer passed to
iio_push_to_buffers_with_timestamp() is suitable for the naturally
aligned timestamp that will be inserted.

Here structure is not used, because this buffer is also used
elsewhere in the driver.

Fixes: 67e17300dc1d ("iio: potentiostat: add LMP91000 support")
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Matt Ranostay <matt.ranostay@konsulko.com>
---
 drivers/iio/potentiostat/lmp91000.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Matt Ranostay May 6, 2021, 6:44 a.m. UTC | #1
On Sat, May 1, 2021 at 10:15 AM Jonathan Cameron <jic23@kernel.org> wrote:
>
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
>
> Add __aligned(8) to ensure the buffer passed to
> iio_push_to_buffers_with_timestamp() is suitable for the naturally
> aligned timestamp that will be inserted.
>
> Here structure is not used, because this buffer is also used
> elsewhere in the driver.
>
> Fixes: 67e17300dc1d ("iio: potentiostat: add LMP91000 support")
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>

> Cc: Matt Ranostay <matt.ranostay@konsulko.com>
> ---
>  drivers/iio/potentiostat/lmp91000.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iio/potentiostat/lmp91000.c b/drivers/iio/potentiostat/lmp91000.c
> index 8a9c576616ee..ff39ba975da7 100644
> --- a/drivers/iio/potentiostat/lmp91000.c
> +++ b/drivers/iio/potentiostat/lmp91000.c
> @@ -71,8 +71,8 @@ struct lmp91000_data {
>
>         struct completion completion;
>         u8 chan_select;
> -
> -       u32 buffer[4]; /* 64-bit data + 64-bit timestamp */
> +       /* 64-bit data + 64-bit naturally aligned timestamp */
> +       u32 buffer[4] __aligned(8);
>  };
>
>  static const struct iio_chan_spec lmp91000_channels[] = {
> --
> 2.31.1
>
Jonathan Cameron May 13, 2021, 6:04 p.m. UTC | #2
On Wed, 5 May 2021 23:44:23 -0700
Matt Ranostay <matt.ranostay@konsulko.com> wrote:

> On Sat, May 1, 2021 at 10:15 AM Jonathan Cameron <jic23@kernel.org> wrote:
> >
> > From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> >
> > Add __aligned(8) to ensure the buffer passed to
> > iio_push_to_buffers_with_timestamp() is suitable for the naturally
> > aligned timestamp that will be inserted.
> >
> > Here structure is not used, because this buffer is also used
> > elsewhere in the driver.
> >
> > Fixes: 67e17300dc1d ("iio: potentiostat: add LMP91000 support")
> > Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>  
> 
> Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>

Thanks Matt.

Applied to the togreg branch of iio.git and pushed out as testing for the
autobuilders to see if they can break it.

Jonathan
> 
> > Cc: Matt Ranostay <matt.ranostay@konsulko.com>
> > ---
> >  drivers/iio/potentiostat/lmp91000.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/iio/potentiostat/lmp91000.c b/drivers/iio/potentiostat/lmp91000.c
> > index 8a9c576616ee..ff39ba975da7 100644
> > --- a/drivers/iio/potentiostat/lmp91000.c
> > +++ b/drivers/iio/potentiostat/lmp91000.c
> > @@ -71,8 +71,8 @@ struct lmp91000_data {
> >
> >         struct completion completion;
> >         u8 chan_select;
> > -
> > -       u32 buffer[4]; /* 64-bit data + 64-bit timestamp */
> > +       /* 64-bit data + 64-bit naturally aligned timestamp */
> > +       u32 buffer[4] __aligned(8);
> >  };
> >
> >  static const struct iio_chan_spec lmp91000_channels[] = {
> > --
> > 2.31.1
> >
diff mbox series

Patch

diff --git a/drivers/iio/potentiostat/lmp91000.c b/drivers/iio/potentiostat/lmp91000.c
index 8a9c576616ee..ff39ba975da7 100644
--- a/drivers/iio/potentiostat/lmp91000.c
+++ b/drivers/iio/potentiostat/lmp91000.c
@@ -71,8 +71,8 @@  struct lmp91000_data {
 
 	struct completion completion;
 	u8 chan_select;
-
-	u32 buffer[4]; /* 64-bit data + 64-bit timestamp */
+	/* 64-bit data + 64-bit naturally aligned timestamp */
+	u32 buffer[4] __aligned(8);
 };
 
 static const struct iio_chan_spec lmp91000_channels[] = {