Skip to contentSkip to conversation

rtc-ds1305: Use disable_irq_nosync() from within irq handlers.

PATCH In review Ben Nizette 2 participants 2 messages Apr 16, 2009 Real time clock (RTC)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rtc-ds1305: Use disable_irq_nosync() from within irq handlers.

disable_irq() should wait for all running handlers to complete before returning. As such, if it's used to disable an interrupt from that interrupt's handler it will deadlock. This replaces the dangerous instances with the _nosync() variant which doesn't have this problem.

---

drivers/rtc/rtc-ds1305.c +1 -1
index fc372df..5c4f789 100644
@@ -514,7 +514,7 @@ static irqreturn_t ds1305_irq(int irq, void *p)
 {
 	struct ds1305		*ds1305 = p;
 
-	disable_irq(irq);
+	disable_irq_nosync(irq);
 	schedule_work(&ds1305->work);
 	return IRQ_HANDLED;
 }
Signature · 1 line
1.6.0.2
Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Ben Nizette

disable_irq() should wait for all running handlers to complete before returning. As such, if it's used to disable an interrupt from that interrupt's handler it will deadlock. This replaces the dangerous instances with the _nosync() variant which doesn't have this problem.

Also ... it would be nice to convert this driver to the new request_threaded_irq() infrastructure. The board I had with this chip has a busted ttyS0 *input* line, so it's not much use for development any more; or I'd update it myself, it's a simple change. Someone with that hardware should think about spending the few minutes needed to make and test that patch.

Quoted 20 lines

---

drivers/rtc/rtc-ds1305.c +1 -1
index fc372df..5c4f789 100644
@@ -514,7 +514,7 @@ static irqreturn_t ds1305_irq(int irq, void *p)
 {
 	struct ds1305		*ds1305 = p;
 
-	disable_irq(irq);
+	disable_irq_nosync(irq);
 	schedule_work(&ds1305->work);
 	return IRQ_HANDLED;
 }
Signature · 1 line
1.6.0.2