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
This commit is contained in:
parent
38e9d5caee
commit
ff9111ab3e
|
@ -12,6 +12,7 @@
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/regulator/consumer.h>
|
#include <linux/regulator/consumer.h>
|
||||||
#include <linux/spi/spi.h>
|
#include <linux/spi/spi.h>
|
||||||
|
#include <asm/unaligned.h>
|
||||||
|
|
||||||
#include <linux/iio/iio.h>
|
#include <linux/iio/iio.h>
|
||||||
#include <linux/iio/driver.h>
|
#include <linux/iio/driver.h>
|
||||||
|
@ -63,7 +64,7 @@ static int max11100_read_single(struct iio_dev *indio_dev, int *val)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
*val = (state->buffer[1] << 8) | state->buffer[2];
|
*val = get_unaligned_be16(&state->buffer[1]);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue