]> git.baikalelectronics.ru Git - kernel.git/commit
iio: adc: at91-sama5d2_adc: lock around oversampling and sample freq
authorClaudiu Beznea <claudiu.beznea@microchip.com>
Wed, 3 Aug 2022 10:28:39 +0000 (13:28 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 26 Oct 2022 11:22:34 +0000 (13:22 +0200)
commit85fa352a526719e70d57e0a24d3bd445a18e0dcd
tree61f8f2dd2bf12d9fdbec7e96012e75f12529369f
parentcae033489c8f705da9e8a29dce1a19d0ffb56bce
iio: adc: at91-sama5d2_adc: lock around oversampling and sample freq

[ Upstream commit 37d973d7049e256eb7d9d4af9d38074cf46638ab ]

.read_raw()/.write_raw() could be called asynchronously from user space
or other in kernel drivers. Without locking on st->lock these could be
called asynchronously while there is a conversion in progress. Read will
be harmless but changing registers while conversion is in progress may
lead to inconsistent results. Thus, to avoid this lock st->lock.

Fixes: 49f576877041 ("iio:adc:at91_adc8xx: introduce new atmel adc driver")
Fixes: 9ab9401f0dd3 ("iio: adc: at91-sama5d2_adc: add support for oversampling resolution")
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Link: https://lore.kernel.org/r/20220803102855.2191070-4-claudiu.beznea@microchip.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/iio/adc/at91-sama5d2_adc.c