From patchwork Fri May 11 12:07:12 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 8532 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id E114823E20 for ; Fri, 11 May 2012 12:07:48 +0000 (UTC) Received: from mail-gg0-f180.google.com (mail-gg0-f180.google.com [209.85.161.180]) by fiordland.canonical.com (Postfix) with ESMTP id A2D9CA18B2A for ; Fri, 11 May 2012 12:07:48 +0000 (UTC) Received: by ggnf1 with SMTP id f1so1508907ggn.11 for ; Fri, 11 May 2012 05:07:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:mime-version:content-type :x-gm-message-state; bh=LcT+LsOBCL+ZHQ3i24eEoH/+blqObV6blAcRsH7cZic=; b=kjhUv1MtVUx1vufJR6z2KJlMrdQQL/lYshtiFZi2KDm+5GwOAk1CvOxJJANdM4zni1 vVDldPEXMDSqzaXJX3LBwE1c/CilHvpbHMDP3IMuUuS4nEvA402smpwvqgq7XiKE2cQ8 KxrQ+VoJKS06tH6RPGn1WT/mB9z67wsW1hx7QZMR1VqFhlDVB7AbF//Esvpz7vkXrr4y fZ2Nret8ujmNz7DL34Z101oq+z3D9YL9BWtusEy7ybK0S9UsXCcknDkaKF7E8xB4x04q RIzkiBzw0x6KFvyXdt9F4dwic2HaSuGbTGwfBzzUCfT3RIV12CVfVHUjYN/AbL5ZhJqc qSUw== Received: by 10.42.142.71 with SMTP id r7mr4168440icu.7.1336738067930; Fri, 11 May 2012 05:07:47 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.73.147 with SMTP id q19csp168821ibj; Fri, 11 May 2012 05:07:46 -0700 (PDT) Received: by 10.213.11.2 with SMTP id r2mr2426827ebr.63.1336738065982; Fri, 11 May 2012 05:07:45 -0700 (PDT) Received: from eu1sys200aog110.obsmtp.com (eu1sys200aog110.obsmtp.com. [207.126.144.129]) by mx.google.com with SMTP id m56si2812909eef.115.2012.05.11.05.07.41 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 11 May 2012 05:07:45 -0700 (PDT) Received-SPF: neutral (google.com: 207.126.144.129 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) client-ip=207.126.144.129; Authentication-Results: mx.google.com; spf=neutral (google.com: 207.126.144.129 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) smtp.mail=linus.walleij@stericsson.com Received: from beta.dmz-eu.st.com ([164.129.1.35]) (using TLSv1) by eu1sys200aob110.postini.com ([207.126.147.11]) with SMTP ID DSNKT60BDM3Mh+jKn9C3zJRUoZtIJtARt7iz@postini.com; Fri, 11 May 2012 12:07:45 UTC Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 80490104; Fri, 11 May 2012 12:07:25 +0000 (GMT) Received: from relay2.stm.gmessaging.net (unknown [10.230.100.18]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 87DBB2CAC; Fri, 11 May 2012 12:07:24 +0000 (GMT) Received: from exdcvycastm022.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm022", Issuer "exdcvycastm022" (not verified)) by relay2.stm.gmessaging.net (Postfix) with ESMTPS id 425CBA807B; Fri, 11 May 2012 14:07:19 +0200 (CEST) Received: from steludxu4075.lud.stericsson.com (10.230.100.153) by smtp.stericsson.com (10.230.100.30) with Microsoft SMTP Server (TLS) id 8.3.83.0; Fri, 11 May 2012 14:07:23 +0200 From: Linus Walleij To: Grant Likely , Cc: Julia Lawall , Linus Walleij Subject: [PATCH] gpio/msm-v1: re-read IRQ flags on each iteration Date: Fri, 11 May 2012 14:07:12 +0200 Message-ID: <1336738032-14940-1-git-send-email-linus.walleij@stericsson.com> X-Mailer: git-send-email 1.7.9.2 MIME-Version: 1.0 X-Gm-Message-State: ALoCoQkOxKqpJtxJyLcaSb0Vh+xL5FGxFvWiUCbfSrP1kqWVb3571P7s+AkbwrH60wH/T2wRq3Ev From: Linus Walleij 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 Signed-off-by: Linus Walleij --- 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",