diff options
author | Abhash Jha <abhashkumarjha123@gmail.com> | 2024-09-28 21:48:05 +0530 |
---|---|---|
committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2024-10-05 12:09:15 +0100 |
commit | 0f87813bc338b30a64922f3b05131a9229edab0f (patch) | |
tree | 03aa6169c413b170680cc9c5afe003b2ef62249d /drivers/iio/dac | |
parent | 41c1b5670c182cd09ce175d41c6f31b96c4adc78 (diff) | |
download | lwn-0f87813bc338b30a64922f3b05131a9229edab0f.tar.gz lwn-0f87813bc338b30a64922f3b05131a9229edab0f.zip |
iio: dac: ad5770r: Convert to get_unaligned_le16
Convert the manual shifting to use `get_unaligned_le16` api.
Signed-off-by: Abhash Jha <abhashkumarjha123@gmail.com>
Link: https://patch.msgid.link/20240928161805.165543-1-abhashkumarjha123@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio/dac')
-rw-r--r-- | drivers/iio/dac/ad5770r.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/iio/dac/ad5770r.c b/drivers/iio/dac/ad5770r.c index c360ebf5297a..12c98f3e62a5 100644 --- a/drivers/iio/dac/ad5770r.c +++ b/drivers/iio/dac/ad5770r.c @@ -17,6 +17,7 @@ #include <linux/regmap.h> #include <linux/regulator/consumer.h> #include <linux/spi/spi.h> +#include <asm/unaligned.h> #define ADI_SPI_IF_CONFIG_A 0x00 #define ADI_SPI_IF_CONFIG_B 0x01 @@ -325,7 +326,7 @@ static int ad5770r_read_raw(struct iio_dev *indio_dev, if (ret) return 0; - buf16 = st->transf_buf[0] + (st->transf_buf[1] << 8); + buf16 = get_unaligned_le16(st->transf_buf); *val = buf16 >> 2; return IIO_VAL_INT; case IIO_CHAN_INFO_SCALE: |