mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Bogendoerfer <tbogendoerfer@suse.de>
To: Joshua Kinard <kumba@gentoo.org>,
	Alessandro Zummo <a.zummo@towertech.it>,
	Alexandre Belloni <alexandre.belloni@bootlin.com>,
	linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 3/3] rtc: ds1685: disable interrupts when moving work to work queue
Date: Thu, 11 Apr 2019 16:33:23 +0200	[thread overview]
Message-ID: <20190411143323.20945-3-tbogendoerfer@suse.de> (raw)
In-Reply-To: <20190411143323.20945-1-tbogendoerfer@suse.de>

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@suse.de>
---
 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


  parent reply	other threads:[~2019-04-11 14:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-11 14:33 [PATCH 1/3] rtc: ds1685: fix crash caused by referencing wrong device struct Thomas Bogendoerfer
2019-04-11 14:33 ` [PATCH 2/3] rtc: ds1685: use correct device struct to get platform " Thomas Bogendoerfer
2019-04-12 10:11   ` Alexandre Belloni
2019-04-12 11:44     ` Thomas Bogendoerfer
2019-04-13  5:17       ` Joshua Kinard
2019-04-13  8:19         ` Thomas Bogendoerfer
2019-04-11 14:33 ` Thomas Bogendoerfer [this message]
2019-04-12 10:14   ` [PATCH 3/3] rtc: ds1685: disable interrupts when moving work to work queue Alexandre Belloni
2019-04-12 11:49     ` Thomas Bogendoerfer
2019-04-12 10:14 ` [PATCH 1/3] rtc: ds1685: fix crash caused by referencing wrong device struct Alexandre Belloni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190411143323.20945-3-tbogendoerfer@suse.de \
    --to=tbogendoerfer@suse.de \
    --cc=a.zummo@towertech.it \
    --cc=alexandre.belloni@bootlin.com \
    --cc=kumba@gentoo.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®