Message ID | 20200421003135.23060-3-andriy.shevchenko@linux.intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [v1,01/16] iio: adc: ad_sigma_delta: Use {get,put}_unaligned_be24() | expand |
On Tue, 21 Apr 2020 03:31:22 +0300 Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote: > This makes the driver code slightly easier to read. > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Added #include <asm/unaligned.h> and applied. Thanks, Jonathan > --- > drivers/iio/adc/ti-ads124s08.c | 5 +---- > 1 file changed, 1 insertion(+), 4 deletions(-) > > diff --git a/drivers/iio/adc/ti-ads124s08.c b/drivers/iio/adc/ti-ads124s08.c > index 552c2be8d87a..2516e42ad00d 100644 > --- a/drivers/iio/adc/ti-ads124s08.c > +++ b/drivers/iio/adc/ti-ads124s08.c > @@ -188,7 +188,6 @@ static int ads124s_read(struct iio_dev *indio_dev, unsigned int chan) > { > struct ads124s_private *priv = iio_priv(indio_dev); > int ret; > - u32 tmp; > struct spi_transfer t[] = { > { > .tx_buf = &priv->data[0], > @@ -208,9 +207,7 @@ static int ads124s_read(struct iio_dev *indio_dev, unsigned int chan) > if (ret < 0) > return ret; > > - tmp = priv->data[2] << 16 | priv->data[3] << 8 | priv->data[4]; > - > - return tmp; > + return get_unaligned_be24(&priv->data[2]); > } > > static int ads124s_read_raw(struct iio_dev *indio_dev,
On Sat, Apr 25, 2020 at 7:25 PM Jonathan Cameron <jic23@kernel.org> wrote: > > On Tue, 21 Apr 2020 03:31:22 +0300 > Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote: > > > This makes the driver code slightly easier to read. > > > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > Added > #include <asm/unaligned.h> > and applied. Thanks!
diff --git a/drivers/iio/adc/ti-ads124s08.c b/drivers/iio/adc/ti-ads124s08.c index 552c2be8d87a..2516e42ad00d 100644 --- a/drivers/iio/adc/ti-ads124s08.c +++ b/drivers/iio/adc/ti-ads124s08.c @@ -188,7 +188,6 @@ static int ads124s_read(struct iio_dev *indio_dev, unsigned int chan) { struct ads124s_private *priv = iio_priv(indio_dev); int ret; - u32 tmp; struct spi_transfer t[] = { { .tx_buf = &priv->data[0], @@ -208,9 +207,7 @@ static int ads124s_read(struct iio_dev *indio_dev, unsigned int chan) if (ret < 0) return ret; - tmp = priv->data[2] << 16 | priv->data[3] << 8 | priv->data[4]; - - return tmp; + return get_unaligned_be24(&priv->data[2]); } static int ads124s_read_raw(struct iio_dev *indio_dev,
This makes the driver code slightly easier to read. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> --- drivers/iio/adc/ti-ads124s08.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)