Re: [PATCH v1 13/16] iio: pressure: ms5611: Use get_unaligned_be24()

Jonathan Cameron
2020-04-25T16:48:48Z

On Tue, 21 Apr 2020 10:36:45 +0200
Tomasz Duszynski <tduszyns@gmail.com> wrote:

> On Tue, Apr 21, 2020 at 03:31:32AM +0300, Andy Shevchenko wrote:
> > This makes the driver code slightly easier to read.
> >
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > ---
> > drivers/iio/pressure/ms5611_i2c.c | 2 +-
> > drivers/iio/pressure/ms5611_spi.c | 2 +-
> > 2 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/iio/pressure/ms5611_i2c.c b/drivers/iio/pressure/ms5611_i2c.c
> > index 8089c59adce5..ced83162ae94 100644
> > --- a/drivers/iio/pressure/ms5611_i2c.c
> > +++ b/drivers/iio/pressure/ms5611_i2c.c
> > @@ -50,7 +50,7 @@ static int ms5611_i2c_read_adc(struct ms5611_state *st, s32 *val)
> > if (ret < 0)
> > return ret;
> >
> > - *val = (buf[0] << 16) | (buf[1] << 8) | buf[2];
> > + *val = get_unaligned_be24(&buf[0]);
> >
> > return 0;
> > }
> > diff --git a/drivers/iio/pressure/ms5611_spi.c b/drivers/iio/pressure/ms5611_spi.c
> > index b463eaa799ab..517295616869 100644
> > --- a/drivers/iio/pressure/ms5611_spi.c
> > +++ b/drivers/iio/pressure/ms5611_spi.c
> > @@ -45,7 +45,7 @@ static int ms5611_spi_read_adc(struct device *dev, s32 *val)
> > if (ret < 0)
> > return ret;
> >
> > - *val = (buf[0] << 16) | (buf[1] << 8) | buf[2];
> > + *val = get_unaligned_be24(&buf[0]);
> >
> > return 0;
> > }
>
> Looks good.
> Acked-by: Tomasz Duszynski <tduszyns@gmail.com>
Added missing asm/unaligned.h includes and applied.

Thanks,

Jonathan

>
> > --
> > 2.26.1
> >