summaryrefslogtreecommitdiffstats
path: root/drivers/staging/iio/gyro/adis16130_core.c
diff options
context:
space:
mode:
authorJonathan Cameron2011-08-12 17:55:28 +0200
committerGreg Kroah-Hartman2011-08-23 22:28:42 +0200
commitcdf6e817904412931ba9a54fa0376cf6f4f678fe (patch)
tree30323b3218c4416f9c839f7e319e951e86d52f6c /drivers/staging/iio/gyro/adis16130_core.c
parentstaging: vt6655: Fixed all the indents and other errors in IEEE11h.c (diff)
downloadkernel-qcow2-linux-cdf6e817904412931ba9a54fa0376cf6f4f678fe.tar.gz
kernel-qcow2-linux-cdf6e817904412931ba9a54fa0376cf6f4f678fe.tar.xz
kernel-qcow2-linux-cdf6e817904412931ba9a54fa0376cf6f4f678fe.zip
staging:iio:gyro:adis16130 fix adis16130_spi_read which was never selecting the channel
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk> Acked-by: Michael Hennerich <michael.hennerich@analog.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/iio/gyro/adis16130_core.c')
-rw-r--r--drivers/staging/iio/gyro/adis16130_core.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/drivers/staging/iio/gyro/adis16130_core.c b/drivers/staging/iio/gyro/adis16130_core.c
index c80e908d8acf..caf067ce98ce 100644
--- a/drivers/staging/iio/gyro/adis16130_core.c
+++ b/drivers/staging/iio/gyro/adis16130_core.c
@@ -75,15 +75,24 @@ static int adis16130_spi_read(struct device *dev, u8 reg_addr,
int ret;
struct iio_dev *indio_dev = dev_get_drvdata(dev);
struct adis16130_state *st = iio_priv(indio_dev);
+ struct spi_message msg;
+ struct spi_transfer xfer = {
+ .tx_buf = st->buf,
+ .rx_buf = st->buf,
+ };
mutex_lock(&st->buf_lock);
st->buf[0] = ADIS16130_CON_RD | reg_addr;
+ st->buf[1] = st->buf[2] = st->buf[3] = 0;
+
if (st->mode)
- ret = spi_read(st->us, st->buf, 4);
+ xfer.len = 4;
else
- ret = spi_read(st->us, st->buf, 3);
-
+ xfer.len = 3;
+ spi_message_init(&msg);
+ spi_message_add_tail(&xfer, &msg);
+ ret = spi_sync(st->us, &msg);
if (ret == 0) {
if (st->mode)
*val = (st->buf[1] << 16) |