]> git.baikalelectronics.ru Git - kernel.git/commitdiff
iio: gyro: adis16130: Use get_unaligned_be24()
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Tue, 21 Apr 2020 00:31:26 +0000 (03:31 +0300)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sun, 3 May 2020 08:47:19 +0000 (09:47 +0100)
This makes the driver code slightly easier to read.

Cc: Lars-Peter Clausen <lars@metafoo.de>
Cc: Michael Hennerich <Michael.Hennerich@analog.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/gyro/adis16130.c

index 79e63c8a2ea874347d0fe06e99a269d02e686ab3..2a9ec08ec5614b95af733c18428ddcc4848a2af5 100644 (file)
@@ -12,6 +12,8 @@
 
 #include <linux/iio/iio.h>
 
+#include <asm/unaligned.h>
+
 #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;