From patchwork Tue Nov 26 10:23:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 21774 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f198.google.com (mail-ie0-f198.google.com [209.85.223.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3EBE8202DA for ; Tue, 26 Nov 2013 10:23:46 +0000 (UTC) Received: by mail-ie0-f198.google.com with SMTP id tp5sf18040164ieb.9 for ; Tue, 26 Nov 2013 02:23:46 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=1Qj3GkgnxAXvJSRQUSFkSqM30+V5xNmwv7hJryvd48g=; b=TEIkLjt82+dKIANp5m+b1ltwsaRrYEgWEtuJfoPO/zBN+DB1OEJ2taN5TvCylc3t6P paa2cIfcs72tOKMN0vU8SkvWePh5vb+URf4DJ++ejy7Mc+yraHBRxKzzak3cKfOo36g/ dJhkG8iTDfAWk3hZZcDs6YJG7K7KYPEvreEsZU+C76gnJBEMvGNvOHm/NyGVM5N7bVsZ muvmLPrF0r9Qp38F8CauuwF6pxdHnL8XIp6ILsb7EqnRszrZ+9aB7rjRtVJFhmgo6ZIN iUV/8uYNOFE1z5bCdv0Uww1fGkyBF5htYVjFKMvaeaJKMoP93qKO/v4yTNcFPt0AjFAT OXsg== X-Gm-Message-State: ALoCoQnfTJQYbOrOSLJsdePqifXblfoeYgpL1zTD9VNG02vXjnsMjzXnUxiw8WFyVeEnI0oU5qkS X-Received: by 10.182.108.136 with SMTP id hk8mr10648439obb.11.1385461426458; Tue, 26 Nov 2013 02:23:46 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.81.199 with SMTP id c7ls2724805qey.23.gmail; Tue, 26 Nov 2013 02:23:46 -0800 (PST) X-Received: by 10.58.217.130 with SMTP id oy2mr4991618vec.24.1385461426314; Tue, 26 Nov 2013 02:23:46 -0800 (PST) Received: from mail-vb0-f53.google.com (mail-vb0-f53.google.com [209.85.212.53]) by mx.google.com with ESMTPS id q6si7650305vdw.10.2013.11.26.02.23.46 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 26 Nov 2013 02:23:46 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.53 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.53; Received: by mail-vb0-f53.google.com with SMTP id g10so3815279vbg.12 for ; Tue, 26 Nov 2013 02:23:46 -0800 (PST) X-Received: by 10.52.227.233 with SMTP id sd9mr427262vdc.53.1385461426210; Tue, 26 Nov 2013 02:23:46 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp201233vcz; Tue, 26 Nov 2013 02:23:45 -0800 (PST) X-Received: by 10.112.89.42 with SMTP id bl10mr23403890lbb.18.1385461425090; Tue, 26 Nov 2013 02:23:45 -0800 (PST) Received: from mail-la0-f54.google.com (mail-la0-f54.google.com [209.85.215.54]) by mx.google.com with ESMTPS id 6si17210066laz.155.2013.11.26.02.23.44 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 26 Nov 2013 02:23:45 -0800 (PST) Received-SPF: neutral (google.com: 209.85.215.54 is neither permitted nor denied by best guess record for domain of linus.walleij@linaro.org) client-ip=209.85.215.54; Received: by mail-la0-f54.google.com with SMTP id hp15so2239323lab.27 for ; Tue, 26 Nov 2013 02:23:44 -0800 (PST) X-Received: by 10.112.29.147 with SMTP id k19mr24665022lbh.9.1385461424472; Tue, 26 Nov 2013 02:23:44 -0800 (PST) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id dv8sm30708372lbc.15.2013.11.26.02.23.42 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Nov 2013 02:23:43 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Mathias Nyman , Mika Westerberg Cc: Alexandre Courbot , Linus Walleij Subject: [PATCH v2] gpio: lynxpoint: lock IRQs when starting them Date: Tue, 26 Nov 2013 11:23:39 +0100 Message-Id: <1385461419-5979-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 1.8.3.1 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: linus.walleij@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.53 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , This uses the new API for tagging GPIO lines as in use by IRQs. This enforces a few semantic checks on how the underlying GPIO line is used. Cc: Mathias Nyman Cc: Mika Westerberg Signed-off-by: Linus Walleij --- ChangeLog v1->v2: - Explicitly call .enable()/.disable() callbacks from the startup()/shutdown() callbacks to satisfy implicit semantics. --- drivers/gpio/gpio-lynxpoint.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/gpio/gpio-lynxpoint.c b/drivers/gpio/gpio-lynxpoint.c index a0804740a0b7..70831e4b2c8b 100644 --- a/drivers/gpio/gpio-lynxpoint.c +++ b/drivers/gpio/gpio-lynxpoint.c @@ -301,6 +301,26 @@ static void lp_irq_disable(struct irq_data *d) spin_unlock_irqrestore(&lg->lock, flags); } +static unsigned int lp_irq_startup(struct irq_data *d) +{ + struct lp_gpio *lg = irq_data_get_irq_chip_data(d); + + if (gpio_lock_as_irq(&lg->chip, irqd_to_hwirq(d))) + dev_err(lg->chip.dev, + "unable to lock HW IRQ %lu for IRQ\n", + irqd_to_hwirq(d)); + lp_irq_enable(d); + return 0; +} + +static void lp_irq_shutdown(struct irq_data *d) +{ + struct lp_gpio *lg = irq_data_get_irq_chip_data(d); + + lp_irq_disable(d); + gpio_unlock_as_irq(&lg->chip, irqd_to_hwirq(d)); +} + static struct irq_chip lp_irqchip = { .name = "LP-GPIO", .irq_mask = lp_irq_mask, @@ -308,6 +328,8 @@ static struct irq_chip lp_irqchip = { .irq_enable = lp_irq_enable, .irq_disable = lp_irq_disable, .irq_set_type = lp_irq_type, + .irq_startup = lp_irq_startup, + .irq_shutdown = lp_irq_shutdown, .flags = IRQCHIP_SKIP_SET_WAKE, };