Skip to content

Commit

Permalink
iio: adis_buffer: check return value on page change
Browse files Browse the repository at this point in the history
On the trigger handler, we might need to change the device page. Hence,
we should check the return value from 'spi_write()' and act accordingly.

Signed-off-by: Nuno Sa <nuno.sa@analog.com>
Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com>
Link: https://lore.kernel.org/r/20210422101911.135630-5-nuno.sa@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
  • Loading branch information
Nuno Sa authored and Jonathan Cameron committed May 17, 2021
1 parent ab3df79 commit 00f6742
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion drivers/iio/imu/adis_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,12 @@ static irqreturn_t adis_trigger_handler(int irq, void *p)
if (adis->current_page != 0) {
adis->tx[0] = ADIS_WRITE_REG(ADIS_REG_PAGE_ID);
adis->tx[1] = 0;
spi_write(adis->spi, adis->tx, 2);
ret = spi_write(adis->spi, adis->tx, 2);
if (ret) {
dev_err(&adis->spi->dev, "Failed to change device page: %d\n", ret);
mutex_unlock(&adis->state_lock);
goto irq_done;
}
}
}

Expand All @@ -151,6 +156,7 @@ static irqreturn_t adis_trigger_handler(int irq, void *p)
iio_push_to_buffers_with_timestamp(indio_dev, adis->buffer,
pf->timestamp);

irq_done:
iio_trigger_notify_done(indio_dev->trig);

return IRQ_HANDLED;
Expand Down

0 comments on commit 00f6742

Please sign in to comment.