iio: adc: exynos: do not rely on 'users' counter in ISR
authordmitry.torokhov@gmail.com <dmitry.torokhov@gmail.com>
Tue, 6 Oct 2020 21:55:09 +0000 (14:55 -0700)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sat, 10 Oct 2020 16:49:52 +0000 (17:49 +0100)
commitc5bf4d645f2d5c4c216dd690c5237d778102c848
tree8395b3ca95fa6c6f04924d9f8e59206030bfd256
parent5b19ca2c78a0838976064c0347e46a2c859b541d
iio: adc: exynos: do not rely on 'users' counter in ISR

The order in which 'users' counter is decremented vs calling drivers'
close() method is implementation specific, and we should not rely on
it. Let's introduce driver private flag and use it to signal ISR
to exit when device is being closed.

This has a side-effect of fixing issue of accessing inut->users
outside of input->mutex protection.

Reported-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Reviewed-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Link: https://lore.kernel.org/r/20201006215509.GA2556081@dtor-ws
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/adc/exynos_adc.c