* [PATCH] gpio/lynxpoint: check if the interrupt is enabled in IRQ handler
@ 2013-10-01 14:35 Mika Westerberg
2013-10-02 11:03 ` Mathias Nyman
2013-10-11 10:57 ` Linus Walleij
0 siblings, 2 replies; 4+ messages in thread
From: Mika Westerberg @ 2013-10-01 14:35 UTC (permalink / raw)
To: linux-gpio; +Cc: Linus Walleij, Mathias Nyman, linux-kernel, 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.
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
---
drivers/gpio/gpio-lynxpoint.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/gpio/gpio-lynxpoint.c b/drivers/gpio/gpio-lynxpoint.c
index 2d9ca60..41b5913 100644
--- a/drivers/gpio/gpio-lynxpoint.c
+++ b/drivers/gpio/gpio-lynxpoint.c
@@ -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 */
--
1.8.4.rc3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] gpio/lynxpoint: check if the interrupt is enabled in IRQ handler
2013-10-01 14:35 [PATCH] gpio/lynxpoint: check if the interrupt is enabled in IRQ handler Mika Westerberg
@ 2013-10-02 11:03 ` Mathias Nyman
2013-10-11 10:57 ` Linus Walleij
1 sibling, 0 replies; 4+ messages in thread
From: Mathias Nyman @ 2013-10-02 11:03 UTC (permalink / raw)
To: Mika Westerberg, linux-gpio; +Cc: Linus Walleij, linux-kernel
On 10/01/2013 05:35 PM, Mika Westerberg wrote:
> 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.
>
> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Acked-by: Mathias Nyman <mathias.nyman@linux.intel.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] gpio/lynxpoint: check if the interrupt is enabled in IRQ handler
2013-10-01 14:35 [PATCH] gpio/lynxpoint: check if the interrupt is enabled in IRQ handler Mika Westerberg
2013-10-02 11:03 ` Mathias Nyman
@ 2013-10-11 10:57 ` Linus Walleij
2013-10-11 11:09 ` Mika Westerberg
1 sibling, 1 reply; 4+ messages in thread
From: Linus Walleij @ 2013-10-11 10:57 UTC (permalink / raw)
To: Mika Westerberg
Cc: linux-gpio@vger.kernel.org, Mathias Nyman,
linux-kernel@vger.kernel.org
On Tue, Oct 1, 2013 at 4:35 PM, Mika Westerberg
<mika.westerberg@linux.intel.com> wrote:
> 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.
>
> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Patch applied for fixes with Mathias ACK.
Should this be tagged for -stable as well?
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] gpio/lynxpoint: check if the interrupt is enabled in IRQ handler
2013-10-11 10:57 ` Linus Walleij
@ 2013-10-11 11:09 ` Mika Westerberg
0 siblings, 0 replies; 4+ messages in thread
From: Mika Westerberg @ 2013-10-11 11:09 UTC (permalink / raw)
To: Linus Walleij
Cc: linux-gpio@vger.kernel.org, Mathias Nyman,
linux-kernel@vger.kernel.org
On Fri, Oct 11, 2013 at 12:57:37PM +0200, Linus Walleij wrote:
> On Tue, Oct 1, 2013 at 4:35 PM, Mika Westerberg
> <mika.westerberg@linux.intel.com> wrote:
>
> > 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.
> >
> > Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
>
> Patch applied for fixes with Mathias ACK.
Thanks!
> Should this be tagged for -stable as well?
Yes, please. I think starting from 3.9 when this driver was merged.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-10-11 11:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-01 14:35 [PATCH] gpio/lynxpoint: check if the interrupt is enabled in IRQ handler Mika Westerberg
2013-10-02 11:03 ` Mathias Nyman
2013-10-11 10:57 ` Linus Walleij
2013-10-11 11:09 ` Mika Westerberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).