mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2025-01-09 23:34:42 +08:00
iio: dac: ltc2632: Use put_unaligned_be24()
This makes the driver code slightly easier to read. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
parent
3321f29e4f
commit
8b26ab3347
@ -12,6 +12,8 @@
|
|||||||
#include <linux/iio/iio.h>
|
#include <linux/iio/iio.h>
|
||||||
#include <linux/regulator/consumer.h>
|
#include <linux/regulator/consumer.h>
|
||||||
|
|
||||||
|
#include <asm/unaligned.h>
|
||||||
|
|
||||||
#define LTC2632_CMD_WRITE_INPUT_N 0x0
|
#define LTC2632_CMD_WRITE_INPUT_N 0x0
|
||||||
#define LTC2632_CMD_UPDATE_DAC_N 0x1
|
#define LTC2632_CMD_UPDATE_DAC_N 0x1
|
||||||
#define LTC2632_CMD_WRITE_INPUT_N_UPDATE_ALL 0x2
|
#define LTC2632_CMD_WRITE_INPUT_N_UPDATE_ALL 0x2
|
||||||
@ -75,9 +77,7 @@ static int ltc2632_spi_write(struct spi_device *spi,
|
|||||||
* 10-, 8-bit input code followed by 4, 6, or 8 don't care bits.
|
* 10-, 8-bit input code followed by 4, 6, or 8 don't care bits.
|
||||||
*/
|
*/
|
||||||
data = (cmd << 20) | (addr << 16) | (val << shift);
|
data = (cmd << 20) | (addr << 16) | (val << shift);
|
||||||
msg[0] = data >> 16;
|
put_unaligned_be24(data, &msg[0]);
|
||||||
msg[1] = data >> 8;
|
|
||||||
msg[2] = data;
|
|
||||||
|
|
||||||
return spi_write(spi, msg, sizeof(msg));
|
return spi_write(spi, msg, sizeof(msg));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user