diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2013-11-25 07:42:00 -0500 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2013-12-03 15:22:27 -0500 |
commit | 54e018da3141dbb41f3578d48be575087339710f (patch) | |
tree | 55f3b9576e2946a87e68b730182e402460cdb0c9 /drivers/iio/adc | |
parent | 791bb52a0cd2cc95f030e461cfafe26448bc6618 (diff) |
iio:ad7266: Mark transfer buffer as __be16
Fixes the following warnings from sparse:
drivers/iio/adc/ad7266.c:140:16: warning: cast to restricted __be16
drivers/iio/adc/ad7266.c:140:16: warning: cast to restricted __be16
drivers/iio/adc/ad7266.c:140:16: warning: cast to restricted __be16
drivers/iio/adc/ad7266.c:140:16: warning: cast to restricted __be16
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/adc')
-rw-r--r-- | drivers/iio/adc/ad7266.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/drivers/iio/adc/ad7266.c b/drivers/iio/adc/ad7266.c index 58e945594c7b..70f78c3062a7 100644 --- a/drivers/iio/adc/ad7266.c +++ b/drivers/iio/adc/ad7266.c | |||
@@ -43,19 +43,22 @@ struct ad7266_state { | |||
43 | * The buffer needs to be large enough to hold two samples (4 bytes) and | 43 | * The buffer needs to be large enough to hold two samples (4 bytes) and |
44 | * the naturally aligned timestamp (8 bytes). | 44 | * the naturally aligned timestamp (8 bytes). |
45 | */ | 45 | */ |
46 | uint8_t data[ALIGN(4, sizeof(s64)) + sizeof(s64)] ____cacheline_aligned; | 46 | struct { |
47 | __be16 sample[2]; | ||
48 | s64 timestamp; | ||
49 | } data ____cacheline_aligned; | ||
47 | }; | 50 | }; |
48 | 51 | ||
49 | static int ad7266_wakeup(struct ad7266_state *st) | 52 | static int ad7266_wakeup(struct ad7266_state *st) |
50 | { | 53 | { |
51 | /* Any read with >= 2 bytes will wake the device */ | 54 | /* Any read with >= 2 bytes will wake the device */ |
52 | return spi_read(st->spi, st->data, 2); | 55 | return spi_read(st->spi, &st->data.sample[0], 2); |
53 | } | 56 | } |
54 | 57 | ||
55 | static int ad7266_powerdown(struct ad7266_state *st) | 58 | static int ad7266_powerdown(struct ad7266_state *st) |
56 | { | 59 | { |
57 | /* Any read with < 2 bytes will powerdown the device */ | 60 | /* Any read with < 2 bytes will powerdown the device */ |
58 | return spi_read(st->spi, st->data, 1); | 61 | return spi_read(st->spi, &st->data.sample[0], 1); |
59 | } | 62 | } |
60 | 63 | ||
61 | static int ad7266_preenable(struct iio_dev *indio_dev) | 64 | static int ad7266_preenable(struct iio_dev *indio_dev) |
@@ -84,9 +87,9 @@ static irqreturn_t ad7266_trigger_handler(int irq, void *p) | |||
84 | struct ad7266_state *st = iio_priv(indio_dev); | 87 | struct ad7266_state *st = iio_priv(indio_dev); |
85 | int ret; | 88 | int ret; |
86 | 89 | ||
87 | ret = spi_read(st->spi, st->data, 4); | 90 | ret = spi_read(st->spi, st->data.sample, 4); |
88 | if (ret == 0) { | 91 | if (ret == 0) { |
89 | iio_push_to_buffers_with_timestamp(indio_dev, st->data, | 92 | iio_push_to_buffers_with_timestamp(indio_dev, &st->data, |
90 | pf->timestamp); | 93 | pf->timestamp); |
91 | } | 94 | } |
92 | 95 | ||
@@ -137,7 +140,7 @@ static int ad7266_read_single(struct ad7266_state *st, int *val, | |||
137 | ad7266_select_input(st, address); | 140 | ad7266_select_input(st, address); |
138 | 141 | ||
139 | ret = spi_sync(st->spi, &st->single_msg); | 142 | ret = spi_sync(st->spi, &st->single_msg); |
140 | *val = be16_to_cpu(st->data[address % 2]); | 143 | *val = be16_to_cpu(st->data.sample[address % 2]); |
141 | 144 | ||
142 | return ret; | 145 | return ret; |
143 | } | 146 | } |
@@ -442,15 +445,15 @@ static int ad7266_probe(struct spi_device *spi) | |||
442 | ad7266_init_channels(indio_dev); | 445 | ad7266_init_channels(indio_dev); |
443 | 446 | ||
444 | /* wakeup */ | 447 | /* wakeup */ |
445 | st->single_xfer[0].rx_buf = &st->data; | 448 | st->single_xfer[0].rx_buf = &st->data.sample[0]; |
446 | st->single_xfer[0].len = 2; | 449 | st->single_xfer[0].len = 2; |
447 | st->single_xfer[0].cs_change = 1; | 450 | st->single_xfer[0].cs_change = 1; |
448 | /* conversion */ | 451 | /* conversion */ |
449 | st->single_xfer[1].rx_buf = &st->data; | 452 | st->single_xfer[1].rx_buf = st->data.sample; |
450 | st->single_xfer[1].len = 4; | 453 | st->single_xfer[1].len = 4; |
451 | st->single_xfer[1].cs_change = 1; | 454 | st->single_xfer[1].cs_change = 1; |
452 | /* powerdown */ | 455 | /* powerdown */ |
453 | st->single_xfer[2].tx_buf = &st->data; | 456 | st->single_xfer[2].tx_buf = &st->data.sample[0]; |
454 | st->single_xfer[2].len = 1; | 457 | st->single_xfer[2].len = 1; |
455 | 458 | ||
456 | spi_message_init(&st->single_msg); | 459 | spi_message_init(&st->single_msg); |