diff options
| author | Liviu Stan <liviu.stan@analog.com> | 2026-05-25 19:39:29 +0300 |
|---|---|---|
| committer | Jonathan Cameron <jic23@kernel.org> | 2026-05-31 11:01:50 +0100 |
| commit | 5cb9fdb446bfc3ae0524496f53fb68e67051701b (patch) | |
| tree | 6fece5b2f445309cdd7f817ba6ff65a17d6ba6ea /drivers/iio | |
| parent | 434c150752675f44dc52c384a7fa22e5176bc35a (diff) | |
| download | linux-next-5cb9fdb446bfc3ae0524496f53fb68e67051701b.tar.gz linux-next-5cb9fdb446bfc3ae0524496f53fb68e67051701b.zip | |
iio: temperature: ltc2983: Fix reinit_completion() called after conversion start
reinit_completion() was called after regmap_write() initiated the hardware
conversion, creating a race window where the interrupt could fire and call
complete() before reinit_completion() reset the completion.
Move reinit_completion() before the regmap_write() to close the race.
ltc2983_eeprom_cmd() already does it in the correct order.
Fixes: f110f3188e56 ("iio: temperature: Add support for LTC2983")
Signed-off-by: Liviu Stan <liviu.stan@analog.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio')
| -rw-r--r-- | drivers/iio/temperature/ltc2983.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/iio/temperature/ltc2983.c b/drivers/iio/temperature/ltc2983.c index 1f835e326b93..2bc5cd46a72f 100644 --- a/drivers/iio/temperature/ltc2983.c +++ b/drivers/iio/temperature/ltc2983.c @@ -1177,12 +1177,11 @@ static int ltc2983_chan_read(struct ltc2983_data *st, start_conversion |= LTC2983_STATUS_CHAN_SEL(sensor->chan); dev_dbg(&st->spi->dev, "Start conversion on chan:%d, status:%02X\n", sensor->chan, start_conversion); + reinit_completion(&st->completion); /* start conversion */ ret = regmap_write(st->regmap, LTC2983_STATUS_REG, start_conversion); if (ret) return ret; - - reinit_completion(&st->completion); /* * wait for conversion to complete. * 300 ms should be more than enough to complete the conversion. |
