iio: light: zopt2201: Use get_unaligned_le24()

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>
This commit is contained in:
Andy Shevchenko 2020-04-21 03:31:29 +03:00 committed by Jonathan Cameron
parent 76170adb65
commit d2fa63d2d1

View 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);