mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-09-22 09:34:56 +02:00
iio: temperature: ltc2983: Fix reinit_completion() called after conversion start
commit5cb9fdb446upstream. 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:f110f3188e("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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
ae73df471a
commit
46a2cbf57d
@@ -1231,12 +1231,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.
|
||||
|
||||
Reference in New Issue
Block a user