]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
iio: proximity: rfd77402: Fix completion race condition in IRQ mode
authorFelix Gu <ustc.gu@gmail.com>
Wed, 4 Mar 2026 14:14:32 +0000 (22:14 +0800)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sat, 14 Mar 2026 11:15:32 +0000 (11:15 +0000)
commit9978d74031f25fde575bef3e4e3e35c5009091ce
tree4ab3cbce76a9af8d95b0587dd18f0c8b57be6127
parentea7e2e43d768102e2601dbbda42041c78d7a99f9
iio: proximity: rfd77402: Fix completion race condition in IRQ mode

In IRQ mode, the completion was being reinitialized after the
measurement command had already been sent to the hardware. This
created a race condition where the IRQ handler could call complete()
before reinit_completion() was executed. Consequently,
wait_for_completion_timeout() would fail to see the signal and wait
until it timed out.

Move reinit_completion() to occur before the measurement command is
triggered to ensure the synchronization primitive is ready to
capture the interrupt.

Fixes: dc81be96a73a ("iio: proximity: rfd77402: Add interrupt handling support")
Signed-off-by: Felix Gu <ustc.gu@gmail.com>
Reviewed-by: Shrikant Raskar <raskar.shree97@gmail.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/proximity/rfd77402.c