| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * ADIS16130 Digital Output, High Precision Angular Rate Sensor driver |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright 2010 Analog Devices Inc. |
|---|
| 5 | | - * |
|---|
| 6 | | - * Licensed under the GPL-2 or later. |
|---|
| 7 | 6 | */ |
|---|
| 8 | 7 | |
|---|
| 9 | 8 | #include <linux/mutex.h> |
|---|
| .. | .. |
|---|
| 12 | 11 | #include <linux/module.h> |
|---|
| 13 | 12 | |
|---|
| 14 | 13 | #include <linux/iio/iio.h> |
|---|
| 14 | + |
|---|
| 15 | +#include <asm/unaligned.h> |
|---|
| 15 | 16 | |
|---|
| 16 | 17 | #define ADIS16130_CON 0x0 |
|---|
| 17 | 18 | #define ADIS16130_CON_RD (1 << 6) |
|---|
| .. | .. |
|---|
| 60 | 61 | |
|---|
| 61 | 62 | ret = spi_sync_transfer(st->us, &xfer, 1); |
|---|
| 62 | 63 | if (ret == 0) |
|---|
| 63 | | - *val = (st->buf[1] << 16) | (st->buf[2] << 8) | st->buf[3]; |
|---|
| 64 | + *val = get_unaligned_be24(&st->buf[1]); |
|---|
| 64 | 65 | mutex_unlock(&st->buf_lock); |
|---|
| 65 | 66 | |
|---|
| 66 | 67 | return ret; |
|---|
| .. | .. |
|---|
| 77 | 78 | switch (mask) { |
|---|
| 78 | 79 | case IIO_CHAN_INFO_RAW: |
|---|
| 79 | 80 | /* Take the iio_dev status lock */ |
|---|
| 80 | | - mutex_lock(&indio_dev->mlock); |
|---|
| 81 | 81 | ret = adis16130_spi_read(indio_dev, chan->address, &temp); |
|---|
| 82 | | - mutex_unlock(&indio_dev->mlock); |
|---|
| 83 | 82 | if (ret) |
|---|
| 84 | 83 | return ret; |
|---|
| 85 | 84 | *val = temp; |
|---|
| .. | .. |
|---|
| 156 | 155 | indio_dev->name = spi->dev.driver->name; |
|---|
| 157 | 156 | indio_dev->channels = adis16130_channels; |
|---|
| 158 | 157 | indio_dev->num_channels = ARRAY_SIZE(adis16130_channels); |
|---|
| 159 | | - indio_dev->dev.parent = &spi->dev; |
|---|
| 160 | 158 | indio_dev->info = &adis16130_info; |
|---|
| 161 | 159 | indio_dev->modes = INDIO_DIRECT_MODE; |
|---|
| 162 | 160 | |
|---|