[patch/rfc 2/2] twl4030: use new handle_threaded_irq() flow handler

From: David Brownell
Date: Tue Mar 17 2009 - 23:07:44 EST


From: David Brownell <dbrownell@xxxxxxxxxxxxxxxxxxxxx>

Make the toplevel twl4030 irq dispatch code use the new
handle_threaded_irq() flow handler. Also, minor cleanup,
use the newish generic_handle_irq_desc().

Since that flow handler guarantees the IRQ handlers are
called only in a normal (sleeping) thread context, remove
some of the workarounds for the lockdep goofage whereby
it breaks various drivers by forcing IRQF_DISABLED on.

Signed-off-by: David Brownell <dbrownell@xxxxxxxxxxxxxxxxxxxxx>
---
drivers/mfd/twl4030-irq.c | 15 +++++----------
drivers/rtc/rtc-twl4030.c | 8 --------
drivers/usb/otg/twl4030-usb.c | 8 --------
3 files changed, 5 insertions(+), 26 deletions(-)

--- a/drivers/mfd/twl4030-irq.c
+++ b/drivers/mfd/twl4030-irq.c
@@ -215,7 +215,6 @@ static int twl4030_irq_thread(void *data
}

/* these handlers deal with the relevant SIH irq status */
- local_irq_disable();
for (module_irq = twl4030_irq_base;
pih_isr;
pih_isr >>= 1, module_irq++) {
@@ -235,10 +234,9 @@ static int twl4030_irq_thread(void *data
note_interrupt(module_irq, d,
IRQ_NONE);
else
- d->handle_irq(module_irq, d);
+ generic_handle_irq_desc(module_irq, d);
}
}
- local_irq_enable();

desc->chip->unmask(irq);
}
@@ -578,7 +576,7 @@ static inline int sih_read_isr(const str
}

/*
- * Generic handler for SIH interrupts ... we "know" this is called
+ * Generic handler for SIH interrupts ... we know this is called
* in task context, with IRQs enabled.
*/
static void handle_twl4030_sih(unsigned irq, struct irq_desc *desc)
@@ -588,10 +586,7 @@ static void handle_twl4030_sih(unsigned
int isr;

/* reading ISR acks the IRQs, using clear-on-read mode */
- local_irq_enable();
isr = sih_read_isr(sih);
- local_irq_disable();
-
if (isr < 0) {
pr_err("twl4030: %s SIH, read ISR error %d\n",
sih->name, isr);
@@ -658,7 +653,7 @@ int twl4030_sih_setup(int module)
irq = irq_base + i;

set_irq_chip_and_handler(irq, &twl4030_sih_irq_chip,
- handle_edge_irq);
+ handle_threaded_irq);
set_irq_chip_data(irq, agent);
activate_irq(irq);
}
@@ -666,7 +661,7 @@ int twl4030_sih_setup(int module)
status = irq_base;
twl4030_irq_next += i;

- /* replace generic PIH handler (handle_simple_irq) */
+ /* replace generic PIH handler (handle_threaded_irq) */
irq = sih_mod + twl4030_irq_base;
set_irq_data(irq, agent);
set_irq_chained_handler(irq, handle_twl4030_sih);
@@ -719,7 +714,7 @@ int twl_init_irq(int irq_num, unsigned i

for (i = irq_base; i < irq_end; i++) {
set_irq_chip_and_handler(i, &twl4030_irq_chip,
- handle_simple_irq);
+ handle_threaded_irq);
activate_irq(i);
}
twl4030_irq_next = i;
--- a/drivers/rtc/rtc-twl4030.c
+++ b/drivers/rtc/rtc-twl4030.c
@@ -325,14 +325,6 @@ static irqreturn_t twl4030_rtc_interrupt
int res;
u8 rd_reg;

-#ifdef CONFIG_LOCKDEP
- /* WORKAROUND for lockdep forcing IRQF_DISABLED on us, which
- * we don't want and can't tolerate. Although it might be
- * friendlier not to borrow this thread context...
- */
- local_irq_enable();
-#endif
-
res = twl4030_rtc_read_u8(&rd_reg, REG_RTC_STATUS_REG);
if (res)
goto out;
--- a/drivers/usb/otg/twl4030-usb.c
+++ b/drivers/usb/otg/twl4030-usb.c
@@ -517,14 +517,6 @@ static irqreturn_t twl4030_usb_irq(int i
struct twl4030_usb *twl = _twl;
int status;

-#ifdef CONFIG_LOCKDEP
- /* WORKAROUND for lockdep forcing IRQF_DISABLED on us, which
- * we don't want and can't tolerate. Although it might be
- * friendlier not to borrow this thread context...
- */
- local_irq_enable();
-#endif
-
status = twl4030_usb_linkstat(twl);
if (status != USB_LINK_UNKNOWN) {


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/