Skip to content

Commit 82c51ac

Browse files
dlechjic23
authored andcommitted
iio: adc: ad7380: disable offload before using SPI bus
Move disabling of the SPI offload before attempting to use the SPI bus to write a register in ad7380_offload_buffer_predisable(). This caused a crash in the spi_engine_irq() interrupt handler due to being in an invalid state. Fixes: bbeaec8 ("iio: ad7380: add support for SPI offload") Signed-off-by: David Lechner <dlechner@baylibre.com> Reviewed-by: Nuno Sá <nuno.sa@analog.com> Reviewed-by: Angelo Dureghello <adureghello@baylibre.com> Link: https://patch.msgid.link/20250320-iio-adc-ad7380-fix-spi-offload-buffer-predisable-v1-1-6912ac8c0ae0@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
1 parent 839f81d commit 82c51ac

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

drivers/iio/adc/ad7380.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1211,6 +1211,9 @@ static int ad7380_offload_buffer_predisable(struct iio_dev *indio_dev)
12111211
struct ad7380_state *st = iio_priv(indio_dev);
12121212
int ret;
12131213

1214+
spi_offload_trigger_disable(st->offload, st->offload_trigger);
1215+
spi_unoptimize_message(&st->offload_msg);
1216+
12141217
if (st->seq) {
12151218
ret = regmap_update_bits(st->regmap,
12161219
AD7380_REG_ADDR_CONFIG1,
@@ -1222,10 +1225,6 @@ static int ad7380_offload_buffer_predisable(struct iio_dev *indio_dev)
12221225
st->seq = false;
12231226
}
12241227

1225-
spi_offload_trigger_disable(st->offload, st->offload_trigger);
1226-
1227-
spi_unoptimize_message(&st->offload_msg);
1228-
12291228
return 0;
12301229
}
12311230

0 commit comments

Comments
 (0)