diff mbox series

[05/11] iio: chemical: atlas: Fix buffer alignment in iio_push_to_buffers_with_timestamp()

Message ID 20210501171352.512953-6-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>

Variable location for the timestamp, so just use __aligned(8)
to ensure it is always possible to naturally align it.

Found during an audit of all calls of uses of
iio_push_to_buffers_with_timestamp()

Fixes tag is not accurate, but it will need manual backporting beyond
that point if anyone cares.

Fixes: 0d15190f53b4 ("iio: chemical: atlas-ph-sensor: rename atlas-ph-sensor to atlas-sensor")
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Matt Ranostay <matt.ranostay@konsulko.com>
---
 drivers/iio/chemical/atlas-sensor.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>
>
> Variable location for the timestamp, so just use __aligned(8)
> to ensure it is always possible to naturally align it.
>
> Found during an audit of all calls of uses of
> iio_push_to_buffers_with_timestamp()
>
> Fixes tag is not accurate, but it will need manual backporting beyond
> that point if anyone cares.
>
> Fixes: 0d15190f53b4 ("iio: chemical: atlas-ph-sensor: rename atlas-ph-sensor to atlas-sensor")
> 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/chemical/atlas-sensor.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iio/chemical/atlas-sensor.c b/drivers/iio/chemical/atlas-sensor.c
> index 56ba6c82b501..6795722c68b2 100644
> --- a/drivers/iio/chemical/atlas-sensor.c
> +++ b/drivers/iio/chemical/atlas-sensor.c
> @@ -91,8 +91,8 @@ struct atlas_data {
>         struct regmap *regmap;
>         struct irq_work work;
>         unsigned int interrupt_enabled;
> -
> -       __be32 buffer[6]; /* 96-bit data + 32-bit pad + 64-bit timestamp */
> +       /* 96-bit data + 32-bit pad + 64-bit timestamp */
> +       __be32 buffer[6] __aligned(8);
>  };
>
>  static const struct regmap_config atlas_regmap_config = {
> --
> 2.31.1
>
Jonathan Cameron May 13, 2021, 5:59 p.m. UTC | #2
On Wed, 5 May 2021 23:44:54 -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>
> >
> > Variable location for the timestamp, so just use __aligned(8)
> > to ensure it is always possible to naturally align it.
> >
> > Found during an audit of all calls of uses of
> > iio_push_to_buffers_with_timestamp()
> >
> > Fixes tag is not accurate, but it will need manual backporting beyond
> > that point if anyone cares.
> >
> > Fixes: 0d15190f53b4 ("iio: chemical: atlas-ph-sensor: rename atlas-ph-sensor to atlas-sensor")
> > Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>  
> 
> Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>

Applied to the togreg branch of iio.git and pushed out as testing for the
autobuilders to have a go at breaking things.

Thanks,

Jonathan

> 
> > Cc: Matt Ranostay <matt.ranostay@konsulko.com>
> > ---
> >  drivers/iio/chemical/atlas-sensor.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/iio/chemical/atlas-sensor.c b/drivers/iio/chemical/atlas-sensor.c
> > index 56ba6c82b501..6795722c68b2 100644
> > --- a/drivers/iio/chemical/atlas-sensor.c
> > +++ b/drivers/iio/chemical/atlas-sensor.c
> > @@ -91,8 +91,8 @@ struct atlas_data {
> >         struct regmap *regmap;
> >         struct irq_work work;
> >         unsigned int interrupt_enabled;
> > -
> > -       __be32 buffer[6]; /* 96-bit data + 32-bit pad + 64-bit timestamp */
> > +       /* 96-bit data + 32-bit pad + 64-bit timestamp */
> > +       __be32 buffer[6] __aligned(8);
> >  };
> >
> >  static const struct regmap_config atlas_regmap_config = {
> > --
> > 2.31.1
> >
diff mbox series

Patch

diff --git a/drivers/iio/chemical/atlas-sensor.c b/drivers/iio/chemical/atlas-sensor.c
index 56ba6c82b501..6795722c68b2 100644
--- a/drivers/iio/chemical/atlas-sensor.c
+++ b/drivers/iio/chemical/atlas-sensor.c
@@ -91,8 +91,8 @@  struct atlas_data {
 	struct regmap *regmap;
 	struct irq_work work;
 	unsigned int interrupt_enabled;
-
-	__be32 buffer[6]; /* 96-bit data + 32-bit pad + 64-bit timestamp */
+	/* 96-bit data + 32-bit pad + 64-bit timestamp */
+	__be32 buffer[6] __aligned(8);
 };
 
 static const struct regmap_config atlas_regmap_config = {