| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * AD5624R, AD5644R, AD5664R Digital to analog convertors spi driver |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright 2010-2011 Analog Devices Inc. |
|---|
| 5 | | - * |
|---|
| 6 | | - * Licensed under the GPL-2. |
|---|
| 7 | 6 | */ |
|---|
| 8 | 7 | |
|---|
| 9 | 8 | #include <linux/interrupt.h> |
|---|
| .. | .. |
|---|
| 18 | 17 | |
|---|
| 19 | 18 | #include <linux/iio/iio.h> |
|---|
| 20 | 19 | #include <linux/iio/sysfs.h> |
|---|
| 20 | + |
|---|
| 21 | +#include <asm/unaligned.h> |
|---|
| 21 | 22 | |
|---|
| 22 | 23 | #include "ad5624r.h" |
|---|
| 23 | 24 | |
|---|
| .. | .. |
|---|
| 36 | 37 | * for the AD5664R, AD5644R, and AD5624R, respectively. |
|---|
| 37 | 38 | */ |
|---|
| 38 | 39 | data = (0 << 22) | (cmd << 19) | (addr << 16) | (val << shift); |
|---|
| 39 | | - msg[0] = data >> 16; |
|---|
| 40 | | - msg[1] = data >> 8; |
|---|
| 41 | | - msg[2] = data; |
|---|
| 40 | + put_unaligned_be24(data, &msg[0]); |
|---|
| 42 | 41 | |
|---|
| 43 | | - return spi_write(spi, msg, 3); |
|---|
| 42 | + return spi_write(spi, msg, sizeof(msg)); |
|---|
| 44 | 43 | } |
|---|
| 45 | 44 | |
|---|
| 46 | 45 | static int ad5624r_read_raw(struct iio_dev *indio_dev, |
|---|
| .. | .. |
|---|
| 270 | 269 | |
|---|
| 271 | 270 | st->us = spi; |
|---|
| 272 | 271 | |
|---|
| 273 | | - indio_dev->dev.parent = &spi->dev; |
|---|
| 274 | 272 | indio_dev->name = spi_get_device_id(spi)->name; |
|---|
| 275 | 273 | indio_dev->info = &ad5624r_info; |
|---|
| 276 | 274 | indio_dev->modes = INDIO_DIRECT_MODE; |
|---|