mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-16 07:35:14 +00:00
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>
This commit is contained in:
parent
476b9547e8
commit
66a1891642
1 changed files with 1 additions and 6 deletions
|
@ -101,7 +101,6 @@ static int ad5449_read(struct iio_dev *indio_dev, unsigned int addr,
|
||||||
{
|
{
|
||||||
struct ad5449 *st = iio_priv(indio_dev);
|
struct ad5449 *st = iio_priv(indio_dev);
|
||||||
int ret;
|
int ret;
|
||||||
struct spi_message msg;
|
|
||||||
struct spi_transfer t[] = {
|
struct spi_transfer t[] = {
|
||||||
{
|
{
|
||||||
.tx_buf = &st->data[0],
|
.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);
|
mutex_lock(&indio_dev->mlock);
|
||||||
st->data[0] = cpu_to_be16(addr << 12);
|
st->data[0] = cpu_to_be16(addr << 12);
|
||||||
st->data[1] = cpu_to_be16(AD5449_CMD_NOOP);
|
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)
|
if (ret < 0)
|
||||||
goto out_unlock;
|
goto out_unlock;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue