diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2013-10-05 03:45:00 -0400 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2013-10-05 07:00:26 -0400 |
commit | f28607f3bf07a0fce3a34e76554947d2b1eab13d (patch) | |
tree | 8791ff5f0eafd7324d67b6307f91cff156d6ad85 /drivers/iio/gyro | |
parent | 35734fbdb54bbb5c0c3f47fd7ff78c61380c7eaa (diff) |
iio:adis16130: Use spi_sync_transfer()
Use the spi_sync_transfer() helper function instead of open-coding it. Makes
the code a bit shorter.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/gyro')
-rw-r--r-- | drivers/iio/gyro/adis16130.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/drivers/iio/gyro/adis16130.c b/drivers/iio/gyro/adis16130.c index 9155cf6cf287..445c2aecfadd 100644 --- a/drivers/iio/gyro/adis16130.c +++ b/drivers/iio/gyro/adis16130.c | |||
@@ -47,7 +47,6 @@ static int adis16130_spi_read(struct iio_dev *indio_dev, u8 reg_addr, u32 *val) | |||
47 | { | 47 | { |
48 | int ret; | 48 | int ret; |
49 | struct adis16130_state *st = iio_priv(indio_dev); | 49 | struct adis16130_state *st = iio_priv(indio_dev); |
50 | struct spi_message msg; | ||
51 | struct spi_transfer xfer = { | 50 | struct spi_transfer xfer = { |
52 | .tx_buf = st->buf, | 51 | .tx_buf = st->buf, |
53 | .rx_buf = st->buf, | 52 | .rx_buf = st->buf, |
@@ -59,10 +58,7 @@ static int adis16130_spi_read(struct iio_dev *indio_dev, u8 reg_addr, u32 *val) | |||
59 | st->buf[0] = ADIS16130_CON_RD | reg_addr; | 58 | st->buf[0] = ADIS16130_CON_RD | reg_addr; |
60 | st->buf[1] = st->buf[2] = st->buf[3] = 0; | 59 | st->buf[1] = st->buf[2] = st->buf[3] = 0; |
61 | 60 | ||
62 | spi_message_init(&msg); | 61 | ret = spi_sync_transfer(st->us, &xfer, 1); |
63 | spi_message_add_tail(&xfer, &msg); | ||
64 | ret = spi_sync(st->us, &msg); | ||
65 | |||
66 | if (ret == 0) | 62 | if (ret == 0) |
67 | *val = (st->buf[1] << 16) | (st->buf[2] << 8) | st->buf[3]; | 63 | *val = (st->buf[1] << 16) | (st->buf[2] << 8) | st->buf[3]; |
68 | mutex_unlock(&st->buf_lock); | 64 | mutex_unlock(&st->buf_lock); |