drivers: atmel_maxtouch: Fix IRQ handling in a possible race condition
Possibility of the IRQ being disabled twice if IRQ hander and the
missed interrupt check execute simultaneously. This can case the IRQ
to be disabled forever.
Change-Id: If1d1cac138727c866dcd99b882b778d4b31b1774
Signed-off-by: Anirudh Ghayal <aghayal@codeaurora.org>
diff --git a/drivers/input/touchscreen/atmel_maxtouch.c b/drivers/input/touchscreen/atmel_maxtouch.c
index e397774..cc18bc7 100644
--- a/drivers/input/touchscreen/atmel_maxtouch.c
+++ b/drivers/input/touchscreen/atmel_maxtouch.c
@@ -1832,16 +1832,14 @@
if (error < 0)
goto err_write_block;
- enable_irq(mxt->irq);
+ /* Make sure we just didn't miss a interrupt. */
+ if (mxt->read_chg() == 0)
+ schedule_delayed_work(&mxt->dwork, 0);
+ else
+ enable_irq(mxt->irq);
mxt->is_suspended = false;
- /* Make sure we just didn't miss a interrupt. */
- if (mxt->read_chg() == 0) {
- disable_irq(mxt->irq);
- schedule_delayed_work(&mxt->dwork, 0);
- }
-
return 0;
err_write_block: