[PATCH] iio:adc:ti-adc084s021: Endian casting tidy ups.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>

Highlighted by sparse:
CHECK   drivers/iio/adc/ti-adc084s021.c
drivers/iio/adc/ti-adc084s021.c:79:26: warning: incorrect type in assignment (different base types)
drivers/iio/adc/ti-adc084s021.c:79:26:    expected unsigned short [unsigned] [short] [usertype] <noident>
drivers/iio/adc/ti-adc084s021.c:79:26:    got restricted __be16 <noident>
drivers/iio/adc/ti-adc084s021.c:110:24: warning: cast to restricted __be16
drivers/iio/adc/ti-adc084s021.c:110:24: warning: cast to restricted __be16
drivers/iio/adc/ti-adc084s021.c:110:24: warning: cast to restricted __be16
drivers/iio/adc/ti-adc084s021.c:110:24: warning: cast to restricted __be16

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>
Cc: Mårten Lindahl <martenli@xxxxxxxx>
---
 drivers/iio/adc/ti-adc084s021.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/iio/adc/ti-adc084s021.c b/drivers/iio/adc/ti-adc084s021.c
index bdedf456ee05..42966f2eb3d8 100644
--- a/drivers/iio/adc/ti-adc084s021.c
+++ b/drivers/iio/adc/ti-adc084s021.c
@@ -68,7 +68,7 @@ static int adc084s021_adc_conversion(struct adc084s021 *adc, void *data)
 {
 	int n_words = (adc->spi_trans.len >> 1) - 1; /* Discard first word */
 	int ret, i = 0;
-	u16 *p = data;
+	__be16 *p = data;
 
 	/* Do the transfer */
 	ret = spi_sync(adc->spi, &adc->message);
@@ -87,6 +87,7 @@ static int adc084s021_read_raw(struct iio_dev *indio_dev,
 {
 	struct adc084s021 *adc = iio_priv(indio_dev);
 	int ret;
+	__be16 value;
 
 	switch (mask) {
 	case IIO_CHAN_INFO_RAW:
@@ -101,13 +102,13 @@ static int adc084s021_read_raw(struct iio_dev *indio_dev,
 		}
 
 		adc->tx_buf[0] = channel->channel << 3;
-		ret = adc084s021_adc_conversion(adc, val);
+		ret = adc084s021_adc_conversion(adc, &value);
 		iio_device_release_direct_mode(indio_dev);
 		regulator_disable(adc->reg);
 		if (ret < 0)
 			return ret;
 
-		*val = be16_to_cpu(*val);
+		*val = be16_to_cpu(value);
 		*val = (*val >> channel->scan_type.shift) & 0xff;
 
 		return IIO_VAL_INT;
-- 
2.23.0




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux