From e33ff8ac6dc9b4f1b8ee75ee3690561040ec0c1a Mon Sep 17 00:00:00 2001 From: Andy Shevchenko Date: Tue, 21 Apr 2020 03:31:26 +0300 Subject: [PATCH] iio: gyro: adis16130: Use get_unaligned_be24() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This makes the driver code slightly easier to read. Cc: Lars-Peter Clausen Cc: Michael Hennerich Signed-off-by: Andy Shevchenko Acked-by: Nuno Sá Signed-off-by: Jonathan Cameron --- drivers/iio/gyro/adis16130.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/iio/gyro/adis16130.c b/drivers/iio/gyro/adis16130.c index 79e63c8a2ea8..2a9ec08ec561 100644 --- a/drivers/iio/gyro/adis16130.c +++ b/drivers/iio/gyro/adis16130.c @@ -12,6 +12,8 @@ #include +#include + #define ADIS16130_CON 0x0 #define ADIS16130_CON_RD (1 << 6) #define ADIS16130_IOP 0x1 @@ -59,7 +61,7 @@ static int adis16130_spi_read(struct iio_dev *indio_dev, u8 reg_addr, u32 *val) ret = spi_sync_transfer(st->us, &xfer, 1); if (ret == 0) - *val = (st->buf[1] << 16) | (st->buf[2] << 8) | st->buf[3]; + *val = get_unaligned_be24(&st->buf[1]); mutex_unlock(&st->buf_lock); return ret;