You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
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>
This commit is contained in:
committed by
Jonathan Cameron
parent
35734fbdb5
commit
f28607f3bf
@@ -47,7 +47,6 @@ static int adis16130_spi_read(struct iio_dev *indio_dev, u8 reg_addr, u32 *val)
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct adis16130_state *st = iio_priv(indio_dev);
|
struct adis16130_state *st = iio_priv(indio_dev);
|
||||||
struct spi_message msg;
|
|
||||||
struct spi_transfer xfer = {
|
struct spi_transfer xfer = {
|
||||||
.tx_buf = st->buf,
|
.tx_buf = st->buf,
|
||||||
.rx_buf = st->buf,
|
.rx_buf = st->buf,
|
||||||
@@ -59,10 +58,7 @@ static int adis16130_spi_read(struct iio_dev *indio_dev, u8 reg_addr, u32 *val)
|
|||||||
st->buf[0] = ADIS16130_CON_RD | reg_addr;
|
st->buf[0] = ADIS16130_CON_RD | reg_addr;
|
||||||
st->buf[1] = st->buf[2] = st->buf[3] = 0;
|
st->buf[1] = st->buf[2] = st->buf[3] = 0;
|
||||||
|
|
||||||
spi_message_init(&msg);
|
ret = spi_sync_transfer(st->us, &xfer, 1);
|
||||||
spi_message_add_tail(&xfer, &msg);
|
|
||||||
ret = spi_sync(st->us, &msg);
|
|
||||||
|
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
*val = (st->buf[1] << 16) | (st->buf[2] << 8) | st->buf[3];
|
*val = (st->buf[1] << 16) | (st->buf[2] << 8) | st->buf[3];
|
||||||
mutex_unlock(&st->buf_lock);
|
mutex_unlock(&st->buf_lock);
|
||||||
|
|||||||
Reference in New Issue
Block a user