* [PATCH 2/2] rb532: check irq number when handling GPIO interrupts
@ 2009-05-21 17:49 Florian Fainelli
2009-05-21 18:52 ` Sergei Shtylyov
0 siblings, 1 reply; 4+ messages in thread
From: Florian Fainelli @ 2009-05-21 17:49 UTC (permalink / raw)
To: Ralf Baechle, linux-mips
This patch makes sure that we are not going to clear
or change the interrupt status of a GPIO interrupt
superior to 13 as this is the maximum number of GPIO
interrupt source (p.232 of the RC32434 reference manual).
Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
diff --git a/arch/mips/rb532/irq.c b/arch/mips/rb532/irq.c
index 53eeb5e..afdcafc 100644
--- a/arch/mips/rb532/irq.c
+++ b/arch/mips/rb532/irq.c
@@ -151,7 +151,8 @@ static void rb532_disable_irq(unsigned int irq_nr)
mask |= intr_bit;
WRITE_MASK(addr, mask);
- if (group == GPIO_MAPPED_IRQ_GROUP)
+ /* There is a maximum of 13 GPIO interrupts */
+ if (group == GPIO_MAPPED_IRQ_GROUP && irq_nr <= (GROUP4_IRQ_BASE + 13))
rb532_gpio_set_istat(0, irq_nr - GPIO_MAPPED_IRQ_BASE);
/*
@@ -174,7 +175,7 @@ static int rb532_set_type(unsigned int irq_nr, unsigned type)
int gpio = irq_nr - GPIO_MAPPED_IRQ_BASE;
int group = irq_to_group(irq_nr);
- if (group != GPIO_MAPPED_IRQ_GROUP)
+ if (group != GPIO_MAPPED_IRQ_GROUP || irq_nr > (GROUP4_IRQ_BASE + 13))
return (type == IRQ_TYPE_LEVEL_HIGH) ? 0 : -EINVAL;
switch (type) {
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] rb532: check irq number when handling GPIO interrupts
2009-05-21 17:49 [PATCH 2/2] rb532: check irq number when handling GPIO interrupts Florian Fainelli
@ 2009-05-21 18:52 ` Sergei Shtylyov
2009-05-22 5:03 ` Florian Fainelli
0 siblings, 1 reply; 4+ messages in thread
From: Sergei Shtylyov @ 2009-05-21 18:52 UTC (permalink / raw)
To: Florian Fainelli; +Cc: Ralf Baechle, linux-mips
Hello.
Florian Fainelli wrote:
> This patch makes sure that we are not going to clear
> or change the interrupt status of a GPIO interrupt
> superior to 13 as this is the maximum number of GPIO
> interrupt source (p.232 of the RC32434 reference manual).
> Signed-off-by: Florian Fainelli <florian@openwrt.org>
> ---
> diff --git a/arch/mips/rb532/irq.c b/arch/mips/rb532/irq.c
> index 53eeb5e..afdcafc 100644
> --- a/arch/mips/rb532/irq.c
> +++ b/arch/mips/rb532/irq.c
> @@ -151,7 +151,8 @@ static void rb532_disable_irq(unsigned int irq_nr)
> mask |= intr_bit;
> WRITE_MASK(addr, mask);
>
> - if (group == GPIO_MAPPED_IRQ_GROUP)
> + /* There is a maximum of 13 GPIO interrupts */
> + if (group == GPIO_MAPPED_IRQ_GROUP && irq_nr <= (GROUP4_IRQ_BASE + 13))
So, 13 or 14? The code seem to allow 14. Probably it should be <, not <=
here...
> rb532_gpio_set_istat(0, irq_nr - GPIO_MAPPED_IRQ_BASE);
>
> /*
> @@ -174,7 +175,7 @@ static int rb532_set_type(unsigned int irq_nr, unsigned type)
> int gpio = irq_nr - GPIO_MAPPED_IRQ_BASE;
> int group = irq_to_group(irq_nr);
>
> - if (group != GPIO_MAPPED_IRQ_GROUP)
> + if (group != GPIO_MAPPED_IRQ_GROUP || irq_nr > (GROUP4_IRQ_BASE + 13))
... and >= here.
> return (type == IRQ_TYPE_LEVEL_HIGH) ? 0 : -EINVAL;
>
> switch (type) {
WBR, Sergei
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] rb532: check irq number when handling GPIO interrupts
2009-05-21 18:52 ` Sergei Shtylyov
@ 2009-05-22 5:03 ` Florian Fainelli
2009-05-22 6:57 ` Ralf Baechle
0 siblings, 1 reply; 4+ messages in thread
From: Florian Fainelli @ 2009-05-22 5:03 UTC (permalink / raw)
To: Sergei Shtylyov; +Cc: Ralf Baechle, linux-mips
Le Thursday 21 May 2009 20:52:13 Sergei Shtylyov, vous avez écrit :
> Hello.
>
> Florian Fainelli wrote:
> > This patch makes sure that we are not going to clear
> > or change the interrupt status of a GPIO interrupt
> > superior to 13 as this is the maximum number of GPIO
> > interrupt source (p.232 of the RC32434 reference manual).
> >
> > Signed-off-by: Florian Fainelli <florian@openwrt.org>
> > ---
> > diff --git a/arch/mips/rb532/irq.c b/arch/mips/rb532/irq.c
> > index 53eeb5e..afdcafc 100644
> > --- a/arch/mips/rb532/irq.c
> > +++ b/arch/mips/rb532/irq.c
> > @@ -151,7 +151,8 @@ static void rb532_disable_irq(unsigned int irq_nr)
> > mask |= intr_bit;
> > WRITE_MASK(addr, mask);
> >
> > - if (group == GPIO_MAPPED_IRQ_GROUP)
> > + /* There is a maximum of 13 GPIO interrupts */
> > + if (group == GPIO_MAPPED_IRQ_GROUP && irq_nr <= (GROUP4_IRQ_BASE +
> > 13))
>
> So, 13 or 14? The code seem to allow 14. Probably it should be <, not
> <= here...
That's actually 14, numbering starting from 0, I should learn how to count.
Ralf, do you want me to resubmit that one with the proper message /
descriptions ?
>
> > rb532_gpio_set_istat(0, irq_nr - GPIO_MAPPED_IRQ_BASE);
> >
> > /*
> > @@ -174,7 +175,7 @@ static int rb532_set_type(unsigned int irq_nr,
> > unsigned type) int gpio = irq_nr - GPIO_MAPPED_IRQ_BASE;
> > int group = irq_to_group(irq_nr);
> >
> > - if (group != GPIO_MAPPED_IRQ_GROUP)
> > + if (group != GPIO_MAPPED_IRQ_GROUP || irq_nr > (GROUP4_IRQ_BASE + 13))
>
> ... and >= here.
>
> > return (type == IRQ_TYPE_LEVEL_HIGH) ? 0 : -EINVAL;
> >
> > switch (type) {
>
> WBR, Sergei
--
Best regards, Florian Fainelli
Email : florian@openwrt.org
http://openwrt.org
-------------------------------
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] rb532: check irq number when handling GPIO interrupts
2009-05-22 5:03 ` Florian Fainelli
@ 2009-05-22 6:57 ` Ralf Baechle
0 siblings, 0 replies; 4+ messages in thread
From: Ralf Baechle @ 2009-05-22 6:57 UTC (permalink / raw)
To: Florian Fainelli; +Cc: Sergei Shtylyov, linux-mips
On Fri, May 22, 2009 at 07:03:28AM +0200, Florian Fainelli wrote:
> That's actually 14, numbering starting from 0, I should learn how to count.
> Ralf, do you want me to resubmit that one with the proper message /
> descriptions ?
>
> >
> > > rb532_gpio_set_istat(0, irq_nr - GPIO_MAPPED_IRQ_BASE);
> > >
> > > /*
> > > @@ -174,7 +175,7 @@ static int rb532_set_type(unsigned int irq_nr,
> > > unsigned type) int gpio = irq_nr - GPIO_MAPPED_IRQ_BASE;
> > > int group = irq_to_group(irq_nr);
> > >
> > > - if (group != GPIO_MAPPED_IRQ_GROUP)
> > > + if (group != GPIO_MAPPED_IRQ_GROUP || irq_nr > (GROUP4_IRQ_BASE + 13))
> >
> > ... and >= here.
> >
> > > return (type == IRQ_TYPE_LEVEL_HIGH) ? 0 : -EINVAL;
> > >
> > > switch (type) {
Queued for 2.6.31 with the comment fix and the change from > to >=.
Thanks,
Ralf
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-05-22 6:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-21 17:49 [PATCH 2/2] rb532: check irq number when handling GPIO interrupts Florian Fainelli
2009-05-21 18:52 ` Sergei Shtylyov
2009-05-22 5:03 ` Florian Fainelli
2009-05-22 6:57 ` Ralf Baechle
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.