From patchwork Wed Feb 12 10:06:41 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Jacques Hiblot X-Patchwork-Id: 3636071 Return-Path: X-Original-To: patchwork-linux-arm@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 BA1F4BF13A for ; Wed, 12 Feb 2014 10:11:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 34E55201CE for ; Wed, 12 Feb 2014 10:11:18 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EFCEA201E7 for ; Wed, 12 Feb 2014 10:11:11 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WDWmC-0003Ls-Oc; Wed, 12 Feb 2014 10:10:45 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WDWm2-0003z3-5C; Wed, 12 Feb 2014 10:10:34 +0000 Received: from mail-we0-f171.google.com ([74.125.82.171]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WDWlt-0003vv-Vd for linux-arm-kernel@lists.infradead.org; Wed, 12 Feb 2014 10:10:27 +0000 Received: by mail-we0-f171.google.com with SMTP id u56so5719891wes.16 for ; Wed, 12 Feb 2014 02:10:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=/AhZXdKE8YlGv7kKEDuWkfatjdujn/l9TpRYlcKJfSM=; b=k3iD6swF7R6BNKxpecNTkXuDAL8KZqxOfFu5yt82hazZHT2zy38ZeNJy0H2oGbXYO9 RJatujDxGk2R0kd+Q97LTUh8nnerqhS+fjHpWfCmlejoSR8wFq23sWrx3XFgEe423fFP tFziiNwZbM5WF5GJpf+ci2uoYjfQf4v1fIEkiXTpQxiRuUpiRLso3h7nEn1YUWgnNIpA 4P/XysC9CoHYOlS2TSdhe3kFR0MXY3mnDYv84yjGW2DAUXiOdszSNDGLpmxdxCtNApqJ QyEyL/iwPtgVP9vgRHWdDlkSW7EHs2weJHeaxGy1lRQ7IpPSY4thAmJR2M4OjkhKpnA9 u08g== X-Received: by 10.180.165.15 with SMTP id yu15mr1157405wib.28.1392199804381; Wed, 12 Feb 2014 02:10:04 -0800 (PST) Received: from stedf17-labo202.ds.jdsu.net. (4-161.80-90.static-ip.oleane.fr. [90.80.161.4]) by mx.google.com with ESMTPSA id jd2sm4483352wic.9.2014.02.12.02.10.02 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 12 Feb 2014 02:10:03 -0800 (PST) From: Jean-Jacques Hiblot To: nicolas.ferre@atmel.com, plagnioj@jcrosoft.com, b.brezillon@overkiz.com Subject: [PATCH v4 2/8] at91: pinctrl: don't request GPIOs used for interrupts but lock them as IRQ Date: Wed, 12 Feb 2014 11:06:41 +0100 Message-Id: <1392199607-27452-3-git-send-email-jjhiblot@traphandler.com> X-Mailer: git-send-email 1.8.5.3 In-Reply-To: <1392199607-27452-1-git-send-email-jjhiblot@traphandler.com> References: <1392199607-27452-1-git-send-email-jjhiblot@traphandler.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140212_051026_139007_DE581DDE X-CRM114-Status: GOOD ( 11.74 ) X-Spam-Score: -2.6 (--) Cc: gregory.clement@free-electrons.com, Jean-Jacques Hiblot , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 During the xlate stage of the DT interrupt parsing, the at91 pinctrl driver requests the GPIOs that are described as interrupt sources. This prevents a driver to request the gpio later to get its electrical value. This patch replaces the gpio_request with a gpio_lock_as_irq to prevent the gpio to be set as an ouput while allowing a subsequent gpio_request to succeed Signed-off-by: Jean-Jacques Hiblot Acked-by: Nicolas Ferre --- drivers/pinctrl/pinctrl-at91.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c index d990e33..db55b96 100644 --- a/drivers/pinctrl/pinctrl-at91.c +++ b/drivers/pinctrl/pinctrl-at91.c @@ -1478,18 +1478,17 @@ static int at91_gpio_irq_domain_xlate(struct irq_domain *d, { struct at91_gpio_chip *at91_gpio = d->host_data; int ret; - int pin = at91_gpio->chip.base + intspec[0]; if (WARN_ON(intsize < 2)) return -EINVAL; *out_hwirq = intspec[0]; *out_type = intspec[1] & IRQ_TYPE_SENSE_MASK; - ret = gpio_request(pin, ctrlr->full_name); + ret = gpio_lock_as_irq(&at91_gpio->chip, intspec[0]); if (ret) return ret; - ret = gpio_direction_input(pin); + ret = at91_gpio_direction_input(&at91_gpio->chip, intspec[0]); if (ret) return ret;