All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sshtylyov@ru.mvista.com>
To: Florian Fainelli <florian@openwrt.org>
Cc: Ralf Baechle <ralf@linux-mips.org>, linux-mips@linux-mips.org
Subject: Re: [PATCH 2/2] rb532: check irq number when handling GPIO interrupts
Date: Thu, 21 May 2009 22:52:13 +0400	[thread overview]
Message-ID: <4A15A2DD.2000203@ru.mvista.com> (raw)
In-Reply-To: <200905211949.47486.florian@openwrt.org>

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

  reply	other threads:[~2009-05-21 18:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2009-05-22  5:03   ` Florian Fainelli
2009-05-22  6:57     ` Ralf Baechle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A15A2DD.2000203@ru.mvista.com \
    --to=sshtylyov@ru.mvista.com \
    --cc=florian@openwrt.org \
    --cc=linux-mips@linux-mips.org \
    --cc=ralf@linux-mips.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.