All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] gpio/msm-v1: re-read IRQ flags on each iteration
@ 2012-05-11 12:07 Linus Walleij
  2012-05-11 17:41 ` Grant Likely
  0 siblings, 1 reply; 6+ messages in thread
From: Linus Walleij @ 2012-05-11 12:07 UTC (permalink / raw)
  To: Grant Likely, linux-kernel; +Cc: Julia Lawall, Linus Walleij

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>
---
 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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-05-16 18:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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.