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 06:58:19 -0400 |
commit | 66a1891642cf71877ddb89945882281f5ef28672 (patch) | |
tree | bb17b429f7b1993ab5b856e4074d258fdb579607 /drivers/iio/dac | |
parent | 476b9547e872c709c07a45bd47301ce7236f3dc1 (diff) |
iio:ad5449: 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/dac')
-rw-r--r-- | drivers/iio/dac/ad5449.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/drivers/iio/dac/ad5449.c b/drivers/iio/dac/ad5449.c index fff7d0762c0c..82e208f6cde2 100644 --- a/drivers/iio/dac/ad5449.c +++ b/drivers/iio/dac/ad5449.c | |||
@@ -101,7 +101,6 @@ static int ad5449_read(struct iio_dev *indio_dev, unsigned int addr, | |||
101 | { | 101 | { |
102 | struct ad5449 *st = iio_priv(indio_dev); | 102 | struct ad5449 *st = iio_priv(indio_dev); |
103 | int ret; | 103 | int ret; |
104 | struct spi_message msg; | ||
105 | struct spi_transfer t[] = { | 104 | struct spi_transfer t[] = { |
106 | { | 105 | { |
107 | .tx_buf = &st->data[0], | 106 | .tx_buf = &st->data[0], |
@@ -114,15 +113,11 @@ static int ad5449_read(struct iio_dev *indio_dev, unsigned int addr, | |||
114 | }, | 113 | }, |
115 | }; | 114 | }; |
116 | 115 | ||
117 | spi_message_init(&msg); | ||
118 | spi_message_add_tail(&t[0], &msg); | ||
119 | spi_message_add_tail(&t[1], &msg); | ||
120 | |||
121 | mutex_lock(&indio_dev->mlock); | 116 | mutex_lock(&indio_dev->mlock); |
122 | st->data[0] = cpu_to_be16(addr << 12); | 117 | st->data[0] = cpu_to_be16(addr << 12); |
123 | st->data[1] = cpu_to_be16(AD5449_CMD_NOOP); | 118 | st->data[1] = cpu_to_be16(AD5449_CMD_NOOP); |
124 | 119 | ||
125 | ret = spi_sync(st->spi, &msg); | 120 | ret = spi_sync_transfer(st->spi, t, ARRAY_SIZE(t)); |
126 | if (ret < 0) | 121 | if (ret < 0) |
127 | goto out_unlock; | 122 | goto out_unlock; |
128 | 123 | ||