From patchwork Tue Nov 19 12:40:27 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 21625 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f69.google.com (mail-oa0-f69.google.com [209.85.219.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6D2D523FB4 for ; Tue, 19 Nov 2013 12:40:38 +0000 (UTC) Received: by mail-oa0-f69.google.com with SMTP id h16sf6524803oag.0 for ; Tue, 19 Nov 2013 04:40:37 -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=KCCZE2yKZjU+mvriu9Rzv4nqZfH/B1E/rNoprzgju6w=; b=edjbluKgDacMMiFDfcodAC8V5t0EbMPihahuEfAygdxiVx1dyTTsCsmneSRKOGYTxY 95DE/gkDih+K3XW9M9x91omcNOvW3QrtnhdaJYMHcX9KCQwqr9QUfxoh/e69h89rldT7 oT3HjP5xeV8eihBnQtvfvwk5Li4WIOFK18W78cc8I1/wR/PTI+ZXqiklnHgor7cpq9HZ RLmQqP+VueSeKHZrMTf5hknP9YQbvhOxF1fqsIbWR0diEo0DuIN7BREYR1+c+pYt7hxX vuU3fEDzCjv3KyKUOMKQ2wO2me1w67k0vBjx8MFAd6lUJiWWJ3j7xLoNzDdGtXRDP0FQ Z9DQ== X-Gm-Message-State: ALoCoQl2vQnYahWxNRTeJYDO2lm1eq716j2rJloDC3xUxmSQbPIdQbSrWMh1GUPP0geB2sHKpKjf X-Received: by 10.182.16.199 with SMTP id i7mr691044obd.42.1384864837557; Tue, 19 Nov 2013 04:40:37 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.116.135 with SMTP id jw7ls3133932qeb.58.gmail; Tue, 19 Nov 2013 04:40:37 -0800 (PST) X-Received: by 10.220.95.139 with SMTP id d11mr1118363vcn.21.1384864837466; Tue, 19 Nov 2013 04:40:37 -0800 (PST) Received: from mail-vb0-f47.google.com (mail-vb0-f47.google.com [209.85.212.47]) by mx.google.com with ESMTPS id a6si8055464vdp.26.2013.11.19.04.40.37 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 19 Nov 2013 04:40:37 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.47 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.47; Received: by mail-vb0-f47.google.com with SMTP id x11so1651307vbb.20 for ; Tue, 19 Nov 2013 04:40:37 -0800 (PST) X-Received: by 10.52.168.106 with SMTP id zv10mr15155310vdb.21.1384864837362; Tue, 19 Nov 2013 04:40:37 -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 u4csp274829vcz; Tue, 19 Nov 2013 04:40:36 -0800 (PST) X-Received: by 10.194.175.133 with SMTP id ca5mr20860913wjc.19.1384864836419; Tue, 19 Nov 2013 04:40:36 -0800 (PST) Received: from mail-we0-f172.google.com (mail-we0-f172.google.com [74.125.82.172]) by mx.google.com with ESMTPS id t10si7564477wjy.151.2013.11.19.04.40.35 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 19 Nov 2013 04:40:36 -0800 (PST) Received-SPF: neutral (google.com: 74.125.82.172 is neither permitted nor denied by best guess record for domain of linus.walleij@linaro.org) client-ip=74.125.82.172; Received: by mail-we0-f172.google.com with SMTP id t60so2622455wes.17 for ; Tue, 19 Nov 2013 04:40:35 -0800 (PST) X-Received: by 10.194.232.133 with SMTP id to5mr1683128wjc.41.1384864835752; Tue, 19 Nov 2013 04:40:35 -0800 (PST) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id gm2sm34157804wib.4.2013.11.19.04.40.33 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Nov 2013 04:40:35 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Thierry Reding , Lars Poeschel Cc: Alexandre Courbot , Linus Walleij Subject: [PATCH] gpio: lock adnp IRQs when starting them Date: Tue, 19 Nov 2013 13:40:27 +0100 Message-Id: <1384864827-29694-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.47 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 --- drivers/gpio/gpio-adnp.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/gpio/gpio-adnp.c b/drivers/gpio/gpio-adnp.c index b204033acaeb..bf6fb54fa436 100644 --- a/drivers/gpio/gpio-adnp.c +++ b/drivers/gpio/gpio-adnp.c @@ -408,6 +408,24 @@ static void adnp_irq_bus_unlock(struct irq_data *data) mutex_unlock(&adnp->irq_lock); } +static unsigned int adnp_irq_startup(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); + return 0; +} + +static void adnp_irq_shutdown(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 +433,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_startup = adnp_irq_startup, + .irq_shutdown = adnp_irq_shutdown, }; static int adnp_irq_map(struct irq_domain *domain, unsigned int irq,