Re: [PATCH v1 10/16] iio: light: zopt2201: Use get_unaligned_le24()

Jonathan Cameron
2020-04-25T16:42:22Z

On Tue, 21 Apr 2020 03:31:29 +0300
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> This makes the driver code slightly easier to read.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Applied with asm/unaligned.h include added.

J
> ---
> drivers/iio/light/zopt2201.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iio/light/zopt2201.c b/drivers/iio/light/zopt2201.c
> index 5f54f39e7a4c..0df45b42c091 100644
> --- a/drivers/iio/light/zopt2201.c
> +++ b/drivers/iio/light/zopt2201.c
> @@ -219,7 +219,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);