From patchwork Thu Jun 13 16:38:42 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 2717891 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 7906EC0AB1 for ; Thu, 13 Jun 2013 16:40:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 57AB420476 for ; Thu, 13 Jun 2013 16:40:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 77A0920473 for ; Thu, 13 Jun 2013 16:40:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757811Ab3FMQkl (ORCPT ); Thu, 13 Jun 2013 12:40:41 -0400 Received: from mail-qc0-f202.google.com ([209.85.216.202]:56947 "EHLO mail-qc0-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757640Ab3FMQkk (ORCPT ); Thu, 13 Jun 2013 12:40:40 -0400 Received: by mail-qc0-f202.google.com with SMTP id z1so461224qcx.1 for ; Thu, 13 Jun 2013 09:40:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=7f+YL0/LUaxYHnHbQBxsTH3ajcOHMlY2ctQUepLIBIU=; b=BMsBUO/i0IgnAyV35SmpvEOczbNwZskn6jRoQ3Mdvhb2rvLIf4FToPoeEhLJKT6Zy0 +PCuYLWupNrGvqkBhPnUiXNlsp6k4QF5EIDL+6BA2WIlQ1vrs59v9Mwva9Odr3aB+mH1 iVxSdTqrmPQnKsVx49TAMT9zdsCG6MRqmStiEqyPYi7yqQr1JkoYOsJcFBgv9Jvdg5wz i5aBcOIP5gztTl6VvsaTM8Rw4eRAfHlhJjALcE70UDSPG+38ZQc3tu9qch879zzpUoxm /kT1vT9+pMRL8qnTLVD1Lyn4XqEVM20c7x4ub8bs2xZow3VBGrU7J4IbGqcGdiN2+3LI ahXQ== X-Received: by 10.236.14.233 with SMTP id d69mr670180yhd.51.1371141639571; Thu, 13 Jun 2013 09:40:39 -0700 (PDT) Received: from corp2gmr1-2.hot.corp.google.com (corp2gmr1-2.hot.corp.google.com [172.24.189.93]) by gmr-mx.google.com with ESMTPS id x42si274348yha.7.2013.06.13.09.40.39 for (version=TLSv1.1 cipher=AES128-SHA bits=128/128); Thu, 13 Jun 2013 09:40:39 -0700 (PDT) Received: from tictac.mtv.corp.google.com (tictac.mtv.corp.google.com [172.22.162.34]) by corp2gmr1-2.hot.corp.google.com (Postfix) with ESMTP id 66C155A41E8; Thu, 13 Jun 2013 09:40:39 -0700 (PDT) Received: by tictac.mtv.corp.google.com (Postfix, from userid 121310) id 072AB80720; Thu, 13 Jun 2013 09:40:38 -0700 (PDT) From: Doug Anderson To: Linus Walleij Cc: Kukjin Kim , Tomasz Figa , Olof Johansson , Simon Glass , Luigi Semenzato , ilho215.lee@samsung.com, eunki_kim@samsung.com, linux-samsung-soc@vger.kernel.org, Doug Anderson , linux-kernel@vger.kernel.org Subject: [PATCH v2 3/3] pinctrl: exynos: ack level-triggered interrupts before unmasking Date: Thu, 13 Jun 2013 09:38:42 -0700 Message-Id: <1371141522-29255-3-git-send-email-dianders@chromium.org> X-Mailer: git-send-email 1.8.3 In-Reply-To: <1371058399-31933-1-git-send-email-dianders@chromium.org> References: <1371058399-31933-1-git-send-email-dianders@chromium.org> X-Gm-Message-State: ALoCoQnrM+jgA6G0i3Kzdv1whXYZwoDTe0C8OK95rbOLMvZZYaRMhxSCyF1t+SBgZhCYdiqSHfgLm3tl861A07nYxbh1WBOkGCsu3mQsvrL6NCKzs63fG2bX8PgmLExWtH6eLBTV3gAAEP4ielmz6rYG0BQQ4KI80L3nEWa4Ax86qU/Q5pYNoupHkUova2/41RGCN8jp9wPvXB1/nYNGTZWR6LmRVNjx3g== Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP A level-triggered interrupt should be acked after the interrupt line becomes inactive and before it is unmasked, or else another interrupt will be immediately triggered. Acking before or after calling the handler is not enough. Signed-off-by: Luigi Semenzato Signed-off-by: Doug Anderson Acked-by: Tomasz Figa --- Changes in v2: - Greatly simplified using Tomasz's suggestion of irqd_get_trigger_type - Moved acking out of the bank spinlock since since it's not needed. - Linus W. has already applied parts 1 and 2, so not resending. drivers/pinctrl/pinctrl-exynos.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/pinctrl/pinctrl-exynos.c b/drivers/pinctrl/pinctrl-exynos.c index c0729a3..ef75321 100644 --- a/drivers/pinctrl/pinctrl-exynos.c +++ b/drivers/pinctrl/pinctrl-exynos.c @@ -84,6 +84,17 @@ static void exynos_gpio_irq_unmask(struct irq_data *irqd) unsigned long mask; unsigned long flags; + /* + * Ack level interrupts right before unmask + * + * If we don't do this we'll get a double-interrupt. Level triggered + * interrupts must not fire an interrupt if the level is not + * _currently_ active, even if it was active while the interrupt was + * masked. + */ + if (irqd_get_trigger_type(irqd) & IRQ_TYPE_LEVEL_MASK) + exynos_gpio_irq_ack(irqd); + spin_lock_irqsave(&bank->slock, flags); mask = readl(d->virt_base + reg_mask); @@ -302,6 +313,17 @@ static void exynos_wkup_irq_unmask(struct irq_data *irqd) unsigned long mask; unsigned long flags; + /* + * Ack level interrupts right before unmask + * + * If we don't do this we'll get a double-interrupt. Level triggered + * interrupts must not fire an interrupt if the level is not + * _currently_ active, even if it was active while the interrupt was + * masked. + */ + if (irqd_get_trigger_type(irqd) & IRQ_TYPE_LEVEL_MASK) + exynos_wkup_irq_ack(irqd); + spin_lock_irqsave(&b->slock, flags); mask = readl(d->virt_base + reg_mask);