]> git.baikalelectronics.ru Git - kernel.git/commitdiff
iio: light: zopt2201: Use get_unaligned_le24()
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Tue, 21 Apr 2020 00:31:29 +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.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/light/zopt2201.c

index 5f54f39e7a4c43663239689ca040a2b71834700f..80ae530720cdb6a29c202849f03d2db0189a1ef2 100644 (file)
@@ -19,6 +19,8 @@
 #include <linux/iio/iio.h>
 #include <linux/iio/sysfs.h>
 
+#include <asm/unaligned.h>
+
 #define ZOPT2201_DRV_NAME "zopt2201"
 
 /* Registers */
@@ -219,7 +221,7 @@ static int zopt2201_read(struct zopt2201_data *data, u8 reg)
                goto fail;
        mutex_unlock(&data->lock);
 
-       return (buf[2] << 16) | (buf[1] << 8) | buf[0];
+       return get_unaligned_le24(&buf[0]);
 
 fail:
        mutex_unlock(&data->lock);