[PATCH 7/7] iio: adis_buffer: update device page after changing it

Nuno Sa
2021-04-13T11:19:11Z

With commit 41f2770a07e0 ("iio: adis_buffer: don't push data to buffers on
failure"), we return if 'spi_sync()' fails which would leave
'adis->current_page' in an incoherent state. Hence, set this variable
right after we change the device page.

Signed-off-by: Nuno Sa <nuno.sa@analog.com>
---
drivers/iio/imu/adis_buffer.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/iio/imu/adis_buffer.c b/drivers/iio/imu/adis_buffer.c
index 73790b71102b..aa37981c28f1 100644
--- a/drivers/iio/imu/adis_buffer.c
+++ b/drivers/iio/imu/adis_buffer.c
@@ -142,6 +142,8 @@ static irqreturn_t adis_trigger_handler(int irq, void *p)
dev_err(&adis->spi->dev, "Failed to change device page: %d\n", ret);
goto irq_done;
}
+
+ adis->current_page = 0;
}
}

@@ -151,10 +153,8 @@ static irqreturn_t adis_trigger_handler(int irq, void *p)
goto irq_done;
}

- if (adis->data->has_paging) {
- adis->current_page = 0;
+ if (adis->data->has_paging)
mutex_unlock(&adis->state_lock);
- }

iio_push_to_buffers_with_timestamp(indio_dev, adis->buffer,
pf->timestamp);
--
2.31.1