aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/iio/adc/max1363.c
diff options
context:
space:
mode:
authorAbhash Jha <abhashkumarjha123@gmail.com>2024-09-20 23:44:37 +0530
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2024-10-05 12:09:13 +0100
commitc2c4826cfa466dac828c84335bab821766f25efa (patch)
tree080eb5d9d5869ebbe5f9daa90686ceab61e32f39 /drivers/iio/adc/max1363.c
parentstaging: iio: Fix alignment warning (diff)
downloadwireguard-linux-c2c4826cfa466dac828c84335bab821766f25efa.tar.xz
wireguard-linux-c2c4826cfa466dac828c84335bab821766f25efa.zip
iio: adc: max1363: Convert to get_unaligned_be16
Converted manual shifting and or to use `get_unaligned_be16` api instead. Signed-off-by: Abhash Jha <abhashkumarjha123@gmail.com> Link: https://patch.msgid.link/20240920181437.20194-1-abhashkumarjha123@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio/adc/max1363.c')
-rw-r--r--drivers/iio/adc/max1363.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/iio/adc/max1363.c b/drivers/iio/adc/max1363.c
index d0c6e94f7204..d59cd638db96 100644
--- a/drivers/iio/adc/max1363.c
+++ b/drivers/iio/adc/max1363.c
@@ -34,6 +34,8 @@
#include <linux/iio/trigger_consumer.h>
#include <linux/iio/triggered_buffer.h>
+#include <asm/unaligned.h>
+
#define MAX1363_SETUP_BYTE(a) ((a) | 0x80)
/* There is a fair bit more defined here than currently
@@ -392,7 +394,7 @@ static int max1363_read_single_chan(struct iio_dev *indio_dev,
if (data < 0)
return data;
- data = (rxbuf[1] | rxbuf[0] << 8) &
+ data = get_unaligned_be16(rxbuf) &
((1 << st->chip_info->bits) - 1);
} else {
/* Get reading */