Message ID | 20210516172520.1398835-2-jic23@kernel.org (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Series | iio: adc: Maxim and TI ADC driver cleanups | expand |
On Sun, 16 May 2021 at 20:26, Jonathan Cameron <jic23@kernel.org> wrote: > > From: Jonathan Cameron <Jonathan.Cameron@huawei.com> > > The function is more explicit in showing the intent + quicker on some > platforms. Reviewed-by: Alexandru Ardelean <aardelean@deviqon.com> > > Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> > Cc: Jacopo Mondi <jacopo@jmondi.org> > --- > drivers/iio/adc/max11100.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/iio/adc/max11100.c b/drivers/iio/adc/max11100.c > index 6cf21758ca66..69d607fa17aa 100644 > --- a/drivers/iio/adc/max11100.c > +++ b/drivers/iio/adc/max11100.c > @@ -12,6 +12,7 @@ > #include <linux/module.h> > #include <linux/regulator/consumer.h> > #include <linux/spi/spi.h> > +#include <asm/unaligned.h> > > #include <linux/iio/iio.h> > #include <linux/iio/driver.h> > @@ -63,7 +64,7 @@ static int max11100_read_single(struct iio_dev *indio_dev, int *val) > return -EINVAL; > } > > - *val = (state->buffer[1] << 8) | state->buffer[2]; > + *val = get_unaligned_be16(&state->buffer[1]); > > return 0; > } > -- > 2.31.1 >
diff --git a/drivers/iio/adc/max11100.c b/drivers/iio/adc/max11100.c index 6cf21758ca66..69d607fa17aa 100644 --- a/drivers/iio/adc/max11100.c +++ b/drivers/iio/adc/max11100.c @@ -12,6 +12,7 @@ #include <linux/module.h> #include <linux/regulator/consumer.h> #include <linux/spi/spi.h> +#include <asm/unaligned.h> #include <linux/iio/iio.h> #include <linux/iio/driver.h> @@ -63,7 +64,7 @@ static int max11100_read_single(struct iio_dev *indio_dev, int *val) return -EINVAL; } - *val = (state->buffer[1] << 8) | state->buffer[2]; + *val = get_unaligned_be16(&state->buffer[1]); return 0; }