Re: [PATCH v1 11/16] iio: magnetometer: rm3100: Use get_unaligned_be24()

Jonathan Cameron
2020-04-25T16:44:04Z

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

> This makes the driver code slightly easier to read.
>
> Cc: Song Qiang <songqiang1304521@gmail.com>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Header and typo (see below fixed)

Applied to the togreg branch of iio.git and pushed out as testing
to see what else we missed :(

> ---
> drivers/iio/magnetometer/rm3100-core.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/iio/magnetometer/rm3100-core.c b/drivers/iio/magnetometer/rm3100-core.c
> index 7c20918d8108..b3ae9a6c439b 100644
> --- a/drivers/iio/magnetometer/rm3100-core.c
> +++ b/drivers/iio/magnetometer/rm3100-core.c
> @@ -223,8 +223,7 @@ static int rm3100_read_mag(struct rm3100_data *data, int idx, int *val)
> goto unlock_return;
> mutex_unlock(&data->lock);
>
> - *val = sign_extend32((buffer[0] << 16) | (buffer[1] << 8) | buffer[2],
> - 23);
> + *val = sign_extend32(get_unalinged_be24(&buffer[0]), 23);

unaligned

>
> return IIO_VAL_INT;
>