summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2020-03-11 11:22:23 +0200
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2020-03-21 10:27:23 +0000
commit4be590e3f6ec402abe563db90afff6ce3c44737f (patch)
treedea15b7183556c013a329580d85ade807e874111 /drivers
parent144eb562becf64aeff1975f99932ddba0c1616d0 (diff)
iio: adc: intel_mrfld_adc: Use be16_to_cpu() instead of get_unaligned_be16()
There is no need to call unaligned helpers on stack placed variables because compiler will align them correctly, accordingly to architectural ABI. Moreover, using bitwise type makes it explicit to see what we are reading in bulk transfer. On top of that, use sizeof() instead of magic value. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/iio/adc/intel_mrfld_adc.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/iio/adc/intel_mrfld_adc.c b/drivers/iio/adc/intel_mrfld_adc.c
index c35a1beb817c..a6d2e1f27e76 100644
--- a/drivers/iio/adc/intel_mrfld_adc.c
+++ b/drivers/iio/adc/intel_mrfld_adc.c
@@ -75,7 +75,7 @@ static int mrfld_adc_single_conv(struct iio_dev *indio_dev,
struct regmap *regmap = adc->regmap;
unsigned int req;
long timeout;
- u8 buf[2];
+ __be16 value;
int ret;
reinit_completion(&adc->completion);
@@ -105,11 +105,11 @@ static int mrfld_adc_single_conv(struct iio_dev *indio_dev,
goto done;
}
- ret = regmap_bulk_read(regmap, chan->address, buf, 2);
+ ret = regmap_bulk_read(regmap, chan->address, &value, sizeof(value));
if (ret)
goto done;
- *result = get_unaligned_be16(buf);
+ *result = be16_to_cpu(value);
ret = IIO_VAL_INT;
done: