[PATCH 3/3] rtc: ds1685: disable interrupts when moving work to work queue

From: Thomas Bogendoerfer
Date: Thu Apr 11 2019 - 10:33:38 EST


Handling of extended interrupts (kickstart, wake-up, ram-clear) is
moved off to a work queue, but the interrupts aren't acknowledged
in the interrupt handler. This leads to a deadlock, if driver
is used with interrupts. To fix this we now disable in irq handler
and re-enable it after work queue is done.

Fixes: aaaf5fbf56f1 ("rtc: add driver for DS1685 family of real time clocks")
Signed-off-by: Thomas Bogendoerfer <tbogendoerfer@xxxxxxx>
---
drivers/rtc/rtc-ds1685.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/rtc/rtc-ds1685.c b/drivers/rtc/rtc-ds1685.c
index 929f28375b87..5dabfa57bd2a 100644
--- a/drivers/rtc/rtc-ds1685.c
+++ b/drivers/rtc/rtc-ds1685.c
@@ -635,6 +635,7 @@ ds1685_rtc_irq_handler(int irq, void *dev_id)
* to be minimized. Schedule them into a workqueue
* and inform the RTC core that the IRQs were handled.
*/
+ disable_irq_nosync(rtc->irq_num);
spin_unlock(&rtc->lock);
schedule_work(&rtc->work);
rtc_update_irq(rtc->dev, 0, 0);
@@ -741,6 +742,7 @@ ds1685_rtc_work_queue(struct work_struct *work)
ds1685_rtc_switch_to_bank0(rtc);

mutex_unlock(rtc_mutex);
+ enable_irq(rtc->irq_num);
}
/* ----------------------------------------------------------------------- */

--
2.13.7