aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iio/accel
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2013-01-09 12:31:00 -0500
committerJonathan Cameron <jic23@kernel.org>2013-02-09 06:08:42 -0500
commit14543a00fc3ce6dac9f297535c502a0085a50467 (patch)
tree1c244bcc56bd4a48ee2c305856457d102d6eccbe /drivers/iio/accel
parent6d9eecd418afb2c12e5db5be3d72f0f1df43bdd9 (diff)
iio: Use spi_sync_transfer()
Use the new spi_sync_transfer() helper function instead of open-coding it. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/accel')
-rw-r--r--drivers/iio/accel/kxsd9.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/drivers/iio/accel/kxsd9.c b/drivers/iio/accel/kxsd9.c
index 4a24c2ee81a9..c2229a521ab9 100644
--- a/drivers/iio/accel/kxsd9.c
+++ b/drivers/iio/accel/kxsd9.c
@@ -94,7 +94,6 @@ error_ret:
94 94
95static int kxsd9_read(struct iio_dev *indio_dev, u8 address) 95static int kxsd9_read(struct iio_dev *indio_dev, u8 address)
96{ 96{
97 struct spi_message msg;
98 int ret; 97 int ret;
99 struct kxsd9_state *st = iio_priv(indio_dev); 98 struct kxsd9_state *st = iio_priv(indio_dev);
100 struct spi_transfer xfers[] = { 99 struct spi_transfer xfers[] = {
@@ -112,10 +111,7 @@ static int kxsd9_read(struct iio_dev *indio_dev, u8 address)
112 111
113 mutex_lock(&st->buf_lock); 112 mutex_lock(&st->buf_lock);
114 st->tx[0] = KXSD9_READ(address); 113 st->tx[0] = KXSD9_READ(address);
115 spi_message_init(&msg); 114 ret = spi_sync_transfer(st->us, xfers, ARRAY_SIZE(xfers));
116 spi_message_add_tail(&xfers[0], &msg);
117 spi_message_add_tail(&xfers[1], &msg);
118 ret = spi_sync(st->us, &msg);
119 if (ret) 115 if (ret)
120 return ret; 116 return ret;
121 return (((u16)(st->rx[0])) << 8) | (st->rx[1] & 0xF0); 117 return (((u16)(st->rx[0])) << 8) | (st->rx[1] & 0xF0);