summaryrefslogtreecommitdiffstats
path: root/drivers/iio/adc/max11100.c
diff options
context:
space:
mode:
authorJonathan Cameron <Jonathan.Cameron@huawei.com>2021-05-16 18:25:13 +0100
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2021-06-03 18:24:13 +0100
commitff9111ab3e1f01cad2318c6bc989c8bf51a570ac (patch)
treec4236d95f4a4bb9a2e31adde3e5fdf40337ee3db /drivers/iio/adc/max11100.c
parent38e9d5caeedb58b5bfdf66567b534698aeb432bc (diff)
downloadlinux-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.c3
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;
}