From patchwork Tue Nov 26 10:05:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 21770 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f200.google.com (mail-vc0-f200.google.com [209.85.220.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4A790202DA for ; Tue, 26 Nov 2013 10:05:33 +0000 (UTC) Received: by mail-vc0-f200.google.com with SMTP id hu19sf12001948vcb.7 for ; Tue, 26 Nov 2013 02:05:33 -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=2PmfG5gAFPBfJMN8p9rcA0nI8K58iHC/ek5YGsPm2vM=; b=mJxuC8h7quetD3AXLFrCAUQLhLRGFHK7xosOPBVz7+EczemFsgiFUvmLXnePU0G9jZ WkjuZ+FXkIlvjTLUBSV5Clq3zdwM5vPMAAI8lkneruU6EW96knZWmpIolKzRRk+6z2vw J3dPjhBuaYj8zJigGJdN1N5PrvvVqPaN/t81f3kMhRMb/4xnVhztaVULuzD2rJ6q3Jej thLPeZ9o5MBpQOVlcct0HIXMJ1xTEo9D9GbRZQqhK3Z7gefGMQP92IEQyBFktgcWSxXK FWa4lVAywY94ikZ4K7ihINFxFsNHJLhklzYuW4Qbppc7lKNrGQuItuiDKDG19+sSaKIs cB+g== X-Gm-Message-State: ALoCoQmPSw5oaURB9JF66rGoXhKnCofmk1OONVSxqVkr41Zm9qWRII62j8N4Cdt0MU6xPr4z5iUs X-Received: by 10.236.112.161 with SMTP id y21mr462621yhg.51.1385460333596; Tue, 26 Nov 2013 02:05:33 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.94.81 with SMTP id da17ls376383qeb.22.gmail; Tue, 26 Nov 2013 02:05:33 -0800 (PST) X-Received: by 10.220.98.70 with SMTP id p6mr33559vcn.59.1385460333527; Tue, 26 Nov 2013 02:05:33 -0800 (PST) Received: from mail-ve0-f176.google.com (mail-ve0-f176.google.com [209.85.128.176]) by mx.google.com with ESMTPS id gs7si19271013veb.129.2013.11.26.02.05.33 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 26 Nov 2013 02:05:33 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.176 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.176; Received: by mail-ve0-f176.google.com with SMTP id oz11so3753154veb.7 for ; Tue, 26 Nov 2013 02:05:33 -0800 (PST) X-Received: by 10.52.227.233 with SMTP id sd9mr392079vdc.53.1385460333281; Tue, 26 Nov 2013 02:05:33 -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 u4csp200217vcz; Tue, 26 Nov 2013 02:05:32 -0800 (PST) X-Received: by 10.112.89.232 with SMTP id br8mr24398347lbb.20.1385460332265; Tue, 26 Nov 2013 02:05:32 -0800 (PST) Received: from mail-lb0-f175.google.com (mail-lb0-f175.google.com [209.85.217.175]) by mx.google.com with ESMTPS id h4si10470635lam.146.2013.11.26.02.05.31 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 26 Nov 2013 02:05:32 -0800 (PST) Received-SPF: neutral (google.com: 209.85.217.175 is neither permitted nor denied by best guess record for domain of linus.walleij@linaro.org) client-ip=209.85.217.175; Received: by mail-lb0-f175.google.com with SMTP id x18so4150467lbi.20 for ; Tue, 26 Nov 2013 02:05:31 -0800 (PST) X-Received: by 10.112.37.134 with SMTP id y6mr4510013lbj.29.1385460331654; Tue, 26 Nov 2013 02:05:31 -0800 (PST) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id z3sm33940711lag.10.2013.11.26.02.05.29 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Nov 2013 02:05:30 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Thierry Reding , Lars Poeschel Cc: Alexandre Courbot , Linus Walleij Subject: [PATCH v2] gpio: lock adnp IRQs when enabling them Date: Tue, 26 Nov 2013 11:05:24 +0100 Message-Id: <1385460324-30777-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.128.176 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. Only compile tested on the lpc32xx. Cc: Lars Poeschel Cc: Thierry Reding Signed-off-by: Linus Walleij --- ChangeLog v1->v2: - Use the .enable() callback from the irq_chip - Call .unmask() from the .enable() callback to satisfy semantics. --- drivers/gpio/gpio-adnp.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/gpio/gpio-adnp.c b/drivers/gpio/gpio-adnp.c index b204033acaeb..3988ebc5a40e 100644 --- a/drivers/gpio/gpio-adnp.c +++ b/drivers/gpio/gpio-adnp.c @@ -408,6 +408,25 @@ static void adnp_irq_bus_unlock(struct irq_data *data) mutex_unlock(&adnp->irq_lock); } +static void adnp_irq_enable(struct irq_data *data) +{ + struct adnp *adnp = irq_data_get_irq_chip_data(data); + + if (gpio_lock_as_irq(&adnp->gpio, data->hwirq)) + dev_err(adnp->gpio.dev, + "unable to lock HW IRQ %lu for IRQ\n", + data->hwirq); + /* Satisfy the .enable semantics by unmasking the line */ + adnp_irq_unmask(data); +} + +static void adnp_irq_disable(struct irq_data *data) +{ + struct adnp *adnp = irq_data_get_irq_chip_data(data); + + gpio_unlock_as_irq(&adnp->gpio, data->hwirq); +} + static struct irq_chip adnp_irq_chip = { .name = "gpio-adnp", .irq_mask = adnp_irq_mask, @@ -415,6 +434,8 @@ static struct irq_chip adnp_irq_chip = { .irq_set_type = adnp_irq_set_type, .irq_bus_lock = adnp_irq_bus_lock, .irq_bus_sync_unlock = adnp_irq_bus_unlock, + .irq_enable = adnp_irq_enable, + .irq_disable = adnp_irq_disable, }; static int adnp_irq_map(struct irq_domain *domain, unsigned int irq,