iio:ad5449: Use spi_sync_transfer()
authorLars-Peter Clausen <lars@metafoo.de>
Sat, 5 Oct 2013 07:45:00 +0000 (08:45 +0100)
committerJonathan Cameron <jic23@kernel.org>
Sat, 5 Oct 2013 10:58:19 +0000 (11:58 +0100)
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>
drivers/iio/dac/ad5449.c

index fff7d0762c0cb10fd4afbc40d9ac6799e10dad31..82e208f6cde2021f8707e1f45d9a3e3c8a528664 100644 (file)
@@ -101,7 +101,6 @@ static int ad5449_read(struct iio_dev *indio_dev, unsigned int addr,
 {
        struct ad5449 *st = iio_priv(indio_dev);
        int ret;
-       struct spi_message msg;
        struct spi_transfer t[] = {
                {
                        .tx_buf = &st->data[0],
@@ -114,15 +113,11 @@ static int ad5449_read(struct iio_dev *indio_dev, unsigned int addr,
                },
        };
 
-       spi_message_init(&msg);
-       spi_message_add_tail(&t[0], &msg);
-       spi_message_add_tail(&t[1], &msg);
-
        mutex_lock(&indio_dev->mlock);
        st->data[0] = cpu_to_be16(addr << 12);
        st->data[1] = cpu_to_be16(AD5449_CMD_NOOP);
 
-       ret = spi_sync(st->spi, &msg);
+       ret = spi_sync_transfer(st->spi, t, ARRAY_SIZE(t));
        if (ret < 0)
                goto out_unlock;