Skip to contentSkip to conversation

gpio/lynxpoint: check if the interrupt is enabled in IRQ handler

PATCH In review Mika Westerberg 3 participants 4 messages Oct 1, 2013 – Oct 11, 2013 GPIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpio/lynxpoint: check if the interrupt is enabled in IRQ handler

Checking LP_INT_STAT is not enough in the interrupt handler because its contents get updated regardless of whether the pin has interrupt enabled or not. This causes the driver to loop forever for GPIOs that are pulled up.

Fix this by checking the interrupt enable bit for the pin as well.

---
 drivers/gpio/gpio-lynxpoint.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpio/gpio-lynxpoint.c +3 -2
index 2d9ca60..41b5913 100644
@@ -248,14 +248,15 @@ static void lp_gpio_irq_handler(unsigned irq, struct irq_desc *desc)
 	struct lp_gpio *lg = irq_data_get_irq_handler_data(data);
 	struct irq_chip *chip = irq_data_get_irq_chip(data);
 	u32 base, pin, mask;
-	unsigned long reg, pending;
+	unsigned long reg, ena, pending;
 	unsigned virq;
 
 	/* check from GPIO controller which pin triggered the interrupt */
 	for (base = 0; base < lg->chip.ngpio; base += 32) {
 		reg = lp_gpio_reg(&lg->chip, base, LP_INT_STAT);
+		ena = lp_gpio_reg(&lg->chip, base, LP_INT_ENABLE);
 
-		while ((pending = inl(reg))) {
+		while ((pending = (inl(reg) & inl(ena)))) {
 			pin = __ffs(pending);
 			mask = BIT(pin);
 			/* Clear before handling so we don't lose an edge */
Signature · 1 line
1.8.4.rc3
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Mika Westerberg

Checking LP_INT_STAT is not enough in the interrupt handler because its contents get updated regardless of whether the pin has interrupt enabled or not. This causes the driver to loop forever for GPIOs that are pulled up.

Fix this by checking the interrupt enable bit for the pin as well.

#2 lore raw
In reply to Mika Westerberg
Quoted 7 lines · Mika Westerberg

Checking LP_INT_STAT is not enough in the interrupt handler because its contents get updated regardless of whether the pin has interrupt enabled or not. This causes the driver to loop forever for GPIOs that are pulled up.

Fix this by checking the interrupt enable bit for the pin as well.

Patch applied for fixes with Mathias ACK.

Should this be tagged for -stable as well?

Yours,
Linus Walleij

#3 lore raw
Quoted 7 lines · Linus Walleij
Quoted 4 lines · Mika Westerberg

Checking LP_INT_STAT is not enough in the interrupt handler because its contents get updated regardless of whether the pin has interrupt enabled or not. This causes the driver to loop forever for GPIOs that are pulled up.

Quoted 5 lines
Quoted 3 lines

Fix this by checking the interrupt enable bit for the pin as well.

Patch applied for fixes with Mathias ACK.

Thanks!

Quoted 1 line

Should this be tagged for -stable as well?

Yes, please. I think starting from 3.9 when this driver was merged.