On Fri, 6 Dec 2024 18:28:38 +0100 Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxx> wrote: > The ad_sigma_delta driver helper uses irq_disable_nosync(). With that > one it is possible that the irq handler still runs after the > irq_disable_nosync() function call returns. Also to properly synchronize > irq disabling in the different threads proper locking is needed and > because it's unclear if the irq handler's irq_disable_nosync() call > comes first or the one in the enabler's error path, all code locations > that disable the irq must check for .irq_dis first to ensure there is > exactly one disable call per enable call. > > So add a spinlock to the struct ad_sigma_delta and use it to synchronize > irq enabling and disabling. Also only act in the irq handler if the irq > is still enabled. > > Fixes: af3008485ea0 ("iio:adc: Add common code for ADI Sigma Delta devices") > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxx>