summaryrefslogtreecommitdiff
path: root/drivers/iio/adc/ti-ads124s08.c
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2020-04-21 03:31:22 +0300
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2020-05-03 11:47:18 +0300
commit3321f29e4fb4775e7d88187cb499767dd9fee158 (patch)
tree030c5dd5feaa03242fab7d0a259b83b31737255c /drivers/iio/adc/ti-ads124s08.c
parent1608327636cc33663f9f8e97eb9d944f7a96e044 (diff)
downloadlinux-3321f29e4fb4775e7d88187cb499767dd9fee158.tar.xz
iio: adc: ti-ads124s08: Use get_unaligned_be24()
This makes the driver code slightly easier to read. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio/adc/ti-ads124s08.c')
-rw-r--r--drivers/iio/adc/ti-ads124s08.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/iio/adc/ti-ads124s08.c b/drivers/iio/adc/ti-ads124s08.c
index 552c2be8d87a..f1ee3b1e2827 100644
--- a/drivers/iio/adc/ti-ads124s08.c
+++ b/drivers/iio/adc/ti-ads124s08.c
@@ -22,6 +22,8 @@
#include <linux/iio/triggered_buffer.h>
#include <linux/iio/sysfs.h>
+#include <asm/unaligned.h>
+
/* Commands */
#define ADS124S08_CMD_NOP 0x00
#define ADS124S08_CMD_WAKEUP 0x02
@@ -188,7 +190,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 +209,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,