Commit ff9111ab authored by Jonathan Cameron's avatar Jonathan Cameron
Browse files

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: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: default avatarAlexandru Ardelean <aardelean@deviqon.com>
Link: https://lore.kernel.org/r/20210516172520.1398835-2-jic23@kernel.org
parent 38e9d5ca
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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;
}