From patchwork Mon Mar 17 13:56:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 26361 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f72.google.com (mail-yh0-f72.google.com [209.85.213.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 05D59202FA for ; Mon, 17 Mar 2014 13:56:27 +0000 (UTC) Received: by mail-yh0-f72.google.com with SMTP id f10sf14622704yha.7 for ; Mon, 17 Mar 2014 06:56:27 -0700 (PDT) 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:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=RZc0PRoGYNSYFg8FKAYw1MSRFiEQkMRCF/FYYQDTqkg=; b=cJdzR+mv7n7iAwA1vGVM4knIA3isqn8yRwCNmV43a9hoRpNaq71S5hAq+Khg+PGE0j 9AzKzGEO90U1zboYqRrsY07YUVHG9u/os72GihtaKppCskfcDfU7m/ejVaFMqdI8Xeg1 kd+eOolN4qtzjOmb7MYnFwZyrDG/mv6nOLJyQB3peUrqvfz53W3WwXALLsIUe34kC9J+ n1mvOuPtQFW/dmRSWPvNCvHDRarlHkSn+oSUr1cGKZs2CmaEq9S/taYfJqgOTX7CuVj4 Pubuc62g15AR2p2XPpOA62rcVA3FtWWJLiKiIs1Z60IYN82ikZZFXQuSVUttkwx2fDIt E87w== X-Gm-Message-State: ALoCoQnp+vCY2ddh8stkhFJGn9OsxFDjGO/7+i7raagc5CUn6YUSS4MXih6UJ4XeJ4S23qo/c0oc X-Received: by 10.58.198.3 with SMTP id iy3mr2098888vec.39.1395064587732; Mon, 17 Mar 2014 06:56:27 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.84.170 with SMTP id l39ls607080qgd.6.gmail; Mon, 17 Mar 2014 06:56:27 -0700 (PDT) X-Received: by 10.58.91.101 with SMTP id cd5mr19724020veb.5.1395064587493; Mon, 17 Mar 2014 06:56:27 -0700 (PDT) Received: from mail-vc0-f182.google.com (mail-vc0-f182.google.com [209.85.220.182]) by mx.google.com with ESMTPS id a8si2824448vej.71.2014.03.17.06.56.27 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 17 Mar 2014 06:56:27 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.182 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.182; Received: by mail-vc0-f182.google.com with SMTP id ks9so5895340vcb.27 for ; Mon, 17 Mar 2014 06:56:27 -0700 (PDT) X-Received: by 10.221.34.211 with SMTP id st19mr20089435vcb.5.1395064587406; Mon, 17 Mar 2014 06:56:27 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.78.9 with SMTP id i9csp129288vck; Mon, 17 Mar 2014 06:56:26 -0700 (PDT) X-Received: by 10.68.138.165 with SMTP id qr5mr26225953pbb.123.1395064582946; Mon, 17 Mar 2014 06:56:22 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id uc9si10060238pac.130.2014.03.17.06.56.22; Mon, 17 Mar 2014 06:56:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756691AbaCQN4W (ORCPT + 1 other); Mon, 17 Mar 2014 09:56:22 -0400 Received: from mail-wi0-f182.google.com ([209.85.212.182]:61790 "EHLO mail-wi0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756531AbaCQN4V (ORCPT ); Mon, 17 Mar 2014 09:56:21 -0400 Received: by mail-wi0-f182.google.com with SMTP id d1so2177295wiv.15 for ; Mon, 17 Mar 2014 06:56:20 -0700 (PDT) X-Received: by 10.194.203.200 with SMTP id ks8mr1810106wjc.61.1395064580439; Mon, 17 Mar 2014 06:56:20 -0700 (PDT) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id f7sm38552861wjb.7.2014.03.17.06.56.18 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Mar 2014 06:56:19 -0700 (PDT) From: Linus Walleij To: linux-gpio@vger.kernel.org Cc: Alexandre Courbot , Thomas Gleixner , Linus Walleij Subject: [PATCH 2/2] pinctrl: coh901: move irq line locking to resource callbacks Date: Mon, 17 Mar 2014 14:56:16 +0100 Message-Id: <1395064576-21219-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 1.8.5.3 Sender: linux-gpio-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-gpio@vger.kernel.org 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.220.182 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 Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , This switches the COH901 GPIO driver over to using the .request_resources() and .release_resources() callbacks from the irqchip vtable and separate the calls from the .enable() and .disable() callbacks as the latter cannot really say no to a request, whereas the resource callbacks can. Signed-off-by: Linus Walleij --- drivers/pinctrl/pinctrl-coh901.c | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/drivers/pinctrl/pinctrl-coh901.c b/drivers/pinctrl/pinctrl-coh901.c index 162ac0d73739..749db595640c 100644 --- a/drivers/pinctrl/pinctrl-coh901.c +++ b/drivers/pinctrl/pinctrl-coh901.c @@ -529,10 +529,6 @@ static void u300_gpio_irq_enable(struct irq_data *d) dev_dbg(gpio->dev, "enable IRQ for hwirq %lu on port %s, offset %d\n", d->hwirq, port->name, offset); - if (gpio_lock_as_irq(&gpio->chip, d->hwirq)) - dev_err(gpio->dev, - "unable to lock HW IRQ %lu for IRQ\n", - d->hwirq); local_irq_save(flags); val = readl(U300_PIN_REG(offset, ien)); writel(val | U300_PIN_BIT(offset), U300_PIN_REG(offset, ien)); @@ -551,6 +547,27 @@ static void u300_gpio_irq_disable(struct irq_data *d) val = readl(U300_PIN_REG(offset, ien)); writel(val & ~U300_PIN_BIT(offset), U300_PIN_REG(offset, ien)); local_irq_restore(flags); +} + +static int u300_gpio_irq_reqres(struct irq_data *d) +{ + struct u300_gpio_port *port = irq_data_get_irq_chip_data(d); + struct u300_gpio *gpio = port->gpio; + + if (gpio_lock_as_irq(&gpio->chip, d->hwirq)) { + dev_err(gpio->dev, + "unable to lock HW IRQ %lu for IRQ\n", + d->hwirq); + return -EINVAL; + } + return 0; +} + +static void u300_gpio_irq_relres(struct irq_data *d) +{ + struct u300_gpio_port *port = irq_data_get_irq_chip_data(d); + struct u300_gpio *gpio = port->gpio; + gpio_unlock_as_irq(&gpio->chip, d->hwirq); } @@ -559,7 +576,8 @@ static struct irq_chip u300_gpio_irqchip = { .irq_enable = u300_gpio_irq_enable, .irq_disable = u300_gpio_irq_disable, .irq_set_type = u300_gpio_irq_type, - + .irq_request_resources = u300_gpio_irq_reqres, + .irq_release_resources = u300_gpio_irq_relres, }; static void u300_gpio_irq_handler(unsigned irq, struct irq_desc *desc)