diff options
author | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2021-05-16 18:25:13 +0100 |
---|---|---|
committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2021-06-03 18:24:13 +0100 |
commit | ff9111ab3e1f01cad2318c6bc989c8bf51a570ac (patch) | |
tree | c4236d95f4a4bb9a2e31adde3e5fdf40337ee3db /drivers/iio/adc/max11100.c | |
parent | 38e9d5caeedb58b5bfdf66567b534698aeb432bc (diff) | |
download | linux-stable-ff9111ab3e1f01cad2318c6bc989c8bf51a570ac.tar.gz linux-stable-ff9111ab3e1f01cad2318c6bc989c8bf51a570ac.tar.bz2 linux-stable-ff9111ab3e1f01cad2318c6bc989c8bf51a570ac.zip |
iio: adc: max11100: Use get_unaligned_be16() rather than opencoding.
The function is more explicit in showing the intent + quicker on some
platforms.
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Alexandru Ardelean <aardelean@deviqon.com>
Link: https://lore.kernel.org/r/20210516172520.1398835-2-jic23@kernel.org
Diffstat (limited to 'drivers/iio/adc/max11100.c')
-rw-r--r-- | drivers/iio/adc/max11100.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/iio/adc/max11100.c b/drivers/iio/adc/max11100.c index 6cf21758ca66..69d607fa17aa 100644 --- a/drivers/iio/adc/max11100.c +++ b/drivers/iio/adc/max11100.c @@ -12,6 +12,7 @@ #include <linux/module.h> #include <linux/regulator/consumer.h> #include <linux/spi/spi.h> +#include <asm/unaligned.h> #include <linux/iio/iio.h> #include <linux/iio/driver.h> @@ -63,7 +64,7 @@ static int max11100_read_single(struct iio_dev *indio_dev, int *val) return -EINVAL; } - *val = (state->buffer[1] << 8) | state->buffer[2]; + *val = get_unaligned_be16(&state->buffer[1]); return 0; } |