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

iio: magnetometer: rm3100: Use get_unaligned_be24()

This makes the driver code slightly easier to read.

Cc: Song Qiang <songqiang1304521@gmail.com>
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent d2fa63d2
...@@ -22,6 +22,8 @@ ...@@ -22,6 +22,8 @@
#include <linux/iio/triggered_buffer.h> #include <linux/iio/triggered_buffer.h>
#include <linux/iio/trigger_consumer.h> #include <linux/iio/trigger_consumer.h>
#include <asm/unaligned.h>
#include "rm3100.h" #include "rm3100.h"
/* Cycle Count Registers. */ /* Cycle Count Registers. */
...@@ -223,8 +225,7 @@ static int rm3100_read_mag(struct rm3100_data *data, int idx, int *val) ...@@ -223,8 +225,7 @@ static int rm3100_read_mag(struct rm3100_data *data, int idx, int *val)
goto unlock_return; goto unlock_return;
mutex_unlock(&data->lock); mutex_unlock(&data->lock);
*val = sign_extend32((buffer[0] << 16) | (buffer[1] << 8) | buffer[2], *val = sign_extend32(get_unaligned_be24(&buffer[0]), 23);
23);
return IIO_VAL_INT; return IIO_VAL_INT;
......
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