diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2020-04-21 03:31:24 +0300 |
---|---|---|
committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2020-05-03 11:47:19 +0300 |
commit | e065325997e0138e5feead36b6cad0c684a35a79 (patch) | |
tree | a8527c6c43f393c1d7f00abec97ef6c1a29d8a23 | |
parent | 8b26ab33470f52aa63190eee71c7079ed8e58af1 (diff) | |
download | linux-e065325997e0138e5feead36b6cad0c684a35a79.tar.xz |
iio: dac: ad5624r_spi: Use put_unaligned_be24()
This makes the driver code slightly easier to read.
Cc: Lars-Peter Clausen <lars@metafoo.de>
Cc: Michael Hennerich <Michael.Hennerich@analog.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-rw-r--r-- | drivers/iio/dac/ad5624r_spi.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/iio/dac/ad5624r_spi.c b/drivers/iio/dac/ad5624r_spi.c index e6c022e1dc1c..2015a5df840c 100644 --- a/drivers/iio/dac/ad5624r_spi.c +++ b/drivers/iio/dac/ad5624r_spi.c @@ -18,6 +18,8 @@ #include <linux/iio/iio.h> #include <linux/iio/sysfs.h> +#include <asm/unaligned.h> + #include "ad5624r.h" static int ad5624r_spi_write(struct spi_device *spi, @@ -35,11 +37,9 @@ static int ad5624r_spi_write(struct spi_device *spi, * for the AD5664R, AD5644R, and AD5624R, respectively. */ data = (0 << 22) | (cmd << 19) | (addr << 16) | (val << shift); - msg[0] = data >> 16; - msg[1] = data >> 8; - msg[2] = data; + put_unaligned_be24(data, &msg[0]); - return spi_write(spi, msg, 3); + return spi_write(spi, msg, sizeof(msg)); } static int ad5624r_read_raw(struct iio_dev *indio_dev, |