Commit 00d5e7b2 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Jonathan Cameron
Browse files

iio: pressure: ms5611: Use get_unaligned_be24()



This makes the driver code slightly easier to read.

Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: default avatarTomasz Duszynski <tduszyns@gmail.com>
Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent b3ab0adb
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@
#include <linux/module.h>
#include <linux/of_device.h>

#include <asm/unaligned.h>

#include "ms5611.h"

static int ms5611_i2c_reset(struct device *dev)
@@ -50,7 +52,7 @@ static int ms5611_i2c_read_adc(struct ms5611_state *st, s32 *val)
	if (ret < 0)
		return ret;

	*val = (buf[0] << 16) | (buf[1] << 8) | buf[2];
	*val = get_unaligned_be24(&buf[0]);

	return 0;
}
+3 −1
Original line number Diff line number Diff line
@@ -11,6 +11,8 @@
#include <linux/spi/spi.h>
#include <linux/of_device.h>

#include <asm/unaligned.h>

#include "ms5611.h"

static int ms5611_spi_reset(struct device *dev)
@@ -45,7 +47,7 @@ static int ms5611_spi_read_adc(struct device *dev, s32 *val)
	if (ret < 0)
		return ret;

	*val = (buf[0] << 16) | (buf[1] << 8) | buf[2];
	*val = get_unaligned_be24(&buf[0]);

	return 0;
}