summaryrefslogtreecommitdiff
path: root/drivers/staging/iio
diff options
context:
space:
mode:
authorKsenija Stanojevic <ksenija.stanojevic@gmail.com>2015-10-27 16:08:37 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-10-29 07:55:17 +0900
commitb8732dd2f58a8e5d86044ed8dd913825157c8495 (patch)
tree8343090dd25e99869782698871e501878ab3a6a6 /drivers/staging/iio
parent4c3577db3e4f2a7f516462e7ef2b4fb1f09ffd8c (diff)
Staging: iio: adc: Fix sparse warning
Fix following sparse endianness problems: CHECK drivers/staging/iio/adc/ad7816.c drivers/staging/iio/adc/ad7816.c:91:17: warning: cast to restricted __be16 drivers/staging/iio/adc/ad7816.c:91:17: warning: cast to restricted __be16 drivers/staging/iio/adc/ad7816.c:91:17: warning: cast to restricted __be16 drivers/staging/iio/adc/ad7816.c:91:17: warning: cast to restricted __be16 Signed-off-by: Ksenija Stanojevic <ksenija.stanojevic@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/iio')
-rw-r--r--drivers/staging/iio/adc/ad7816.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/staging/iio/adc/ad7816.c b/drivers/staging/iio/adc/ad7816.c
index b3dec7060d40..ccec57c5f70d 100644
--- a/drivers/staging/iio/adc/ad7816.c
+++ b/drivers/staging/iio/adc/ad7816.c
@@ -59,6 +59,7 @@ static int ad7816_spi_read(struct ad7816_chip_info *chip, u16 *data)
{
struct spi_device *spi_dev = chip->spi_dev;
int ret = 0;
+ __be16 buf;
gpio_set_value(chip->rdwr_pin, 1);
gpio_set_value(chip->rdwr_pin, 0);
@@ -82,13 +83,13 @@ static int ad7816_spi_read(struct ad7816_chip_info *chip, u16 *data)
gpio_set_value(chip->rdwr_pin, 0);
gpio_set_value(chip->rdwr_pin, 1);
- ret = spi_read(spi_dev, (u8 *)data, sizeof(*data));
+ ret = spi_read(spi_dev, &buf, sizeof(*data));
if (ret < 0) {
dev_err(&spi_dev->dev, "SPI data read error\n");
return ret;
}
- *data = be16_to_cpu(*data);
+ *data = be16_to_cpu(buf);
return ret;
}