forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-10 37f49e37ab4cb5d0bc4c60eb5c6d4dd57db767bb
kernel/drivers/iio/gyro/adis16130.c
....@@ -1,9 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * ADIS16130 Digital Output, High Precision Angular Rate Sensor driver
34 *
45 * Copyright 2010 Analog Devices Inc.
5
- *
6
- * Licensed under the GPL-2 or later.
76 */
87
98 #include <linux/mutex.h>
....@@ -12,6 +11,8 @@
1211 #include <linux/module.h>
1312
1413 #include <linux/iio/iio.h>
14
+
15
+#include <asm/unaligned.h>
1516
1617 #define ADIS16130_CON 0x0
1718 #define ADIS16130_CON_RD (1 << 6)
....@@ -60,7 +61,7 @@
6061
6162 ret = spi_sync_transfer(st->us, &xfer, 1);
6263 if (ret == 0)
63
- *val = (st->buf[1] << 16) | (st->buf[2] << 8) | st->buf[3];
64
+ *val = get_unaligned_be24(&st->buf[1]);
6465 mutex_unlock(&st->buf_lock);
6566
6667 return ret;
....@@ -77,9 +78,7 @@
7778 switch (mask) {
7879 case IIO_CHAN_INFO_RAW:
7980 /* Take the iio_dev status lock */
80
- mutex_lock(&indio_dev->mlock);
8181 ret = adis16130_spi_read(indio_dev, chan->address, &temp);
82
- mutex_unlock(&indio_dev->mlock);
8382 if (ret)
8483 return ret;
8584 *val = temp;
....@@ -156,7 +155,6 @@
156155 indio_dev->name = spi->dev.driver->name;
157156 indio_dev->channels = adis16130_channels;
158157 indio_dev->num_channels = ARRAY_SIZE(adis16130_channels);
159
- indio_dev->dev.parent = &spi->dev;
160158 indio_dev->info = &adis16130_info;
161159 indio_dev->modes = INDIO_DIRECT_MODE;
162160