Commit 6ef9d68b authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Jonathan Cameron

iio: dac: ad5446: 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: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent e0653259
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
#include <linux/iio/iio.h> #include <linux/iio/iio.h>
#include <linux/iio/sysfs.h> #include <linux/iio/sysfs.h>
#include <asm/unaligned.h>
#define MODE_PWRDWN_1k 0x1 #define MODE_PWRDWN_1k 0x1
#define MODE_PWRDWN_100k 0x2 #define MODE_PWRDWN_100k 0x2
#define MODE_PWRDWN_TRISTATE 0x3 #define MODE_PWRDWN_TRISTATE 0x3
...@@ -302,9 +304,7 @@ static int ad5660_write(struct ad5446_state *st, unsigned val) ...@@ -302,9 +304,7 @@ static int ad5660_write(struct ad5446_state *st, unsigned val)
struct spi_device *spi = to_spi_device(st->dev); struct spi_device *spi = to_spi_device(st->dev);
uint8_t data[3]; uint8_t data[3];
data[0] = (val >> 16) & 0xFF; put_unaligned_be24(val, &data[0]);
data[1] = (val >> 8) & 0xFF;
data[2] = val & 0xFF;
return spi_write(spi, data, sizeof(data)); return spi_write(spi, data, sizeof(data));
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment