public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Grant Likely <grant.likely@secretlab.ca>
To: Linus Walleij <linus.walleij@stericsson.com>,
	linux-kernel@vger.kernel.org
Cc: Julia Lawall <julia.lawall@lip6.fr>,
	Linus Walleij <linus.walleij@linaro.org>
Subject: Re: [PATCH] gpio/msm-v1: re-read IRQ flags on each iteration
Date: Fri, 11 May 2012 11:41:12 -0600	[thread overview]
Message-ID: <20120511174112.D9EEE3E0791@localhost> (raw)
In-Reply-To: <1336738032-14940-1-git-send-email-linus.walleij@stericsson.com>

On Fri, 11 May 2012 14:07:12 +0200, Linus Walleij <linus.walleij@stericsson.com> wrote:
> From: Linus Walleij <linus.walleij@linaro.org>
> 
> We have recently found a number or erroneous IRQ handlers in
> the kernel where the flag iterator loop miss IRQs that get
> raised when the loop is executing. This was spotted in the
> MSM v1 GPIO driver by Julia Lawall using this cocinelle
> snippet:
> 
> @@
> expression pending,gedr,e1;
> statement S;
> @@
> 
> *pending = readl(gedr);
> ... when != pending = e1
> while (pending) S
> 
> Reported-by: Julia Lawall <julia.lawall@lip6.fr>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

Thanks Linus,

I'll need an ack from an msm developer before applying this.

g.

> ---
>  drivers/gpio/gpio-msm-v1.c |    6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpio/gpio-msm-v1.c b/drivers/gpio/gpio-msm-v1.c
> index 52a4d42..68ca760 100644
> --- a/drivers/gpio/gpio-msm-v1.c
> +++ b/drivers/gpio/gpio-msm-v1.c
> @@ -567,9 +567,9 @@ static void msm_gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
>  
>  	for (i = 0; i < msm_gpio_count; i++) {
>  		struct msm_gpio_chip *msm_chip = &msm_gpio_chips[i];
> -		val = readl(msm_chip->regs.int_status);
> -		val &= msm_chip->int_enable[0];
> -		while (val) {
> +
> +		while (val = (readl(msm_chip->regs.int_status) &
> +			      msm_chip->int_enable[0])) {
>  			mask = val & -val;
>  			j = fls(mask) - 1;
>  			/* printk("%s %08x %08x bit %d gpio %d irq %d\n",
> -- 
> 1.7.9.2
> 

-- 
Grant Likely, B.Sc, P.Eng.
Secret Lab Technologies, Ltd.

  reply	other threads:[~2012-05-11 17:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-11 12:07 [PATCH] gpio/msm-v1: re-read IRQ flags on each iteration Linus Walleij
2012-05-11 17:41 ` Grant Likely [this message]
2012-05-11 21:22   ` Linus Walleij
2012-05-16  1:09   ` David Brown
2012-05-16  7:23     ` Linus Walleij
2012-05-16 18:38       ` David Brown

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=20120511174112.D9EEE3E0791@localhost \
    --to=grant.likely@secretlab.ca \
    --cc=julia.lawall@lip6.fr \
    --cc=linus.walleij@linaro.org \
    --cc=linus.walleij@stericsson.com \
    --cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox