Commit d2fa63d2 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Jonathan Cameron

iio: light: zopt2201: Use get_unaligned_le24()

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