Commit 3321f29e authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Jonathan Cameron

iio: adc: ti-ads124s08: Use get_unaligned_be24()

This makes the driver code slightly easier to read.
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent 16083276
...@@ -22,6 +22,8 @@ ...@@ -22,6 +22,8 @@
#include <linux/iio/triggered_buffer.h> #include <linux/iio/triggered_buffer.h>
#include <linux/iio/sysfs.h> #include <linux/iio/sysfs.h>
#include <asm/unaligned.h>
/* Commands */ /* Commands */
#define ADS124S08_CMD_NOP 0x00 #define ADS124S08_CMD_NOP 0x00
#define ADS124S08_CMD_WAKEUP 0x02 #define ADS124S08_CMD_WAKEUP 0x02
...@@ -188,7 +190,6 @@ static int ads124s_read(struct iio_dev *indio_dev, unsigned int chan) ...@@ -188,7 +190,6 @@ static int ads124s_read(struct iio_dev *indio_dev, unsigned int chan)
{ {
struct ads124s_private *priv = iio_priv(indio_dev); struct ads124s_private *priv = iio_priv(indio_dev);
int ret; int ret;
u32 tmp;
struct spi_transfer t[] = { struct spi_transfer t[] = {
{ {
.tx_buf = &priv->data[0], .tx_buf = &priv->data[0],
...@@ -208,9 +209,7 @@ static int ads124s_read(struct iio_dev *indio_dev, unsigned int chan) ...@@ -208,9 +209,7 @@ static int ads124s_read(struct iio_dev *indio_dev, unsigned int chan)
if (ret < 0) if (ret < 0)
return ret; return ret;
tmp = priv->data[2] << 16 | priv->data[3] << 8 | priv->data[4]; return get_unaligned_be24(&priv->data[2]);
return tmp;
} }
static int ads124s_read_raw(struct iio_dev *indio_dev, static int ads124s_read_raw(struct iio_dev *indio_dev,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment