From patchwork Mon Mar 3 10:05:56 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: 3753471 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 179A1BF13A for ; Mon, 3 Mar 2014 10:32:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2AF402038C for ; Mon, 3 Mar 2014 10:32:56 +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 214CA201F4 for ; Mon, 3 Mar 2014 10:32:55 +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 1WKPqX-0001VX-8F; Mon, 03 Mar 2014 10:11:42 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WKPpg-0001lC-7M; Mon, 03 Mar 2014 10:10:48 +0000 Received: from mail-we0-f170.google.com ([74.125.82.170]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WKPpJ-0001eR-OM for linux-arm-kernel@lists.infradead.org; Mon, 03 Mar 2014 10:10:27 +0000 Received: by mail-we0-f170.google.com with SMTP id w61so2933516wes.15 for ; Mon, 03 Mar 2014 02:10:02 -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=xOd3xl9VC9NQc3viMx9dlCORIFqk3HP75rBGJzhhz70=; b=OCEMGumz7QFM8wGxPoMns9YqjKq2w08l1ZMA3NLnIykqk72MD8rqJZ2104Gw/cr59T e3u/jC0Kr8QVWWOhlhp2iEyVUfPUV5EfaVdpIQP35q+sN3V0IOW3ShiSOfAKvtMHH3or 6DsLFLZimaE52fkro1Sw/Z3yhrdvewVVPDLDceQaPecTSemwWIlxZx2bV7omGErZLqkl iMEcDBaolINUMCxerQmk7kXhtcjrRLepdOHc75rqFMFJ2egtbIcpIK5+oj5dDQlSBBri 7MEBoM2fUmLLjSt9PufbZam2RCeGWxruG6bkOJFjCqrBJXBmxTUCRFi03MCSOZiRNyop fqpA== X-Received: by 10.194.22.129 with SMTP id d1mr16389483wjf.22.1393841402278; Mon, 03 Mar 2014 02:10:02 -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 t5sm32769710wjw.15.2014.03.03.02.09.57 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 03 Mar 2014 02:10:01 -0800 (PST) From: Jean-Jacques Hiblot To: nicolas.ferre@atmel.com Subject: [PATCH v5 3/9] at91: pinctrl: don't request GPIOs used for interrupts but lock them as IRQ Date: Mon, 3 Mar 2014 11:05:56 +0100 Message-Id: <1393841162-25339-4-git-send-email-jjhiblot@traphandler.com> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1393841162-25339-1-git-send-email-jjhiblot@traphandler.com> References: <1393841162-25339-1-git-send-email-jjhiblot@traphandler.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140303_051025_941969_A869E2B2 X-CRM114-Status: GOOD ( 11.34 ) X-Spam-Score: -2.6 (--) Cc: thomas.petazzoni@free-electrons.com, devicetree@vger.kernel.org, Jean-Jacques Hiblot , linux-kernel@vger.kernel.org, b.brezillon@overkiz.com, alexandre.belloni@free-electrons.com, gregory.clement@free-electrons.com, plagnioj@jcrosoft.com, 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.2 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 --- 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;