mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Julia Lawall <julia.lawall@lip6.fr>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Mika Westerberg <mika.westerberg@linux.intel.com>,
	linux-kernel@vger.kernel.org, grant.likely@secretlab.ca,
	linus.walleij@stericsson.com
Subject: Re: [PATCH] gpio/langwell: re-read the IRQ status register after each iteration
Date: Thu, 10 May 2012 22:34:53 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.02.1205102211060.1957@localhost6.localdomain6> (raw)
In-Reply-To: <CACRpkdbA58UiNLZRPWe1yGckGFrXqtJ3ddqjLLzLntC6+Cin3g@mail.gmail.com>

On Thu, 10 May 2012, Linus Walleij wrote:

> On Thu, May 10, 2012 at 12:01 PM, Mika Westerberg
> <mika.westerberg@linux.intel.com> wrote:
>
>> Spotted by Grant Likely. The IRQ status register should be re-read after
>> each iteration. Otherwise the loop misses the interrupt if it gets raised
>> immediately after handled.
>>
>> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
>> ---
>> This patch applies on top of my previous patch ("gpio: langwell: convert to
>> use irq_domain").
>
> Oh yeah that thing I recognize!
> Acked-by: Linus Walleij <linus.walleij@linaro.org>
>
> If someone has  time I think it would be a good idea to
> conjure a cocienelle sematic patch to catch this pattern, because
> I suspect it might exist in more IRQ handlers.
>
> -               pending = readl(gedr);
> -               while (pending) {
> +               while ((pending = readl(gedr))) {
>                       gpio = __ffs(pending);
>                       mask = BIT(gpio);
> -                       pending &= ~mask;

I tried the following:

@@
expression pending,gedr,e1;
statement S;
@@

*pending = readl(gedr);
... when != pending = e1
while (pending) S

That is, a readl call followed by a while loop with no reassignment of 
pending.

Perhaps the following are suspicious:

arch/arm/mach-msm/dma.c, function msm_datamover_irq_handler
drivers/gpio/gpio-msm-v1.c, function msm_gpio_irq_handler

But I am not completely sure to understand what is wanted (or not wanted).

julia

  reply	other threads:[~2012-05-10 20:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-10 10:01 Mika Westerberg
2012-05-10 12:16 ` Linus Walleij
2012-05-10 20:34   ` Julia Lawall [this message]
2012-05-11 11:57     ` Linus Walleij
2012-05-10 22:35   ` Grant Likely

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=alpine.DEB.2.02.1205102211060.1957@localhost6.localdomain6 \
    --to=julia.lawall@lip6.fr \
    --cc=grant.likely@secretlab.ca \
    --cc=linus.walleij@linaro.org \
    --cc=linus.walleij@stericsson.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    /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

all inboxes | Powered by JetHome®