From patchwork Fri Jun 10 08:49:12 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 868102 Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p5A8nx1Y013393 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 10 Jun 2011 08:50:20 GMT Received: from canuck.infradead.org ([2001:4978:20e::1]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QUxPV-0001uc-Uj; Fri, 10 Jun 2011 08:49:46 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QUxPV-0002Qw-GD; Fri, 10 Jun 2011 08:49:45 +0000 Received: from eu1sys200aog103.obsmtp.com ([207.126.144.115]) by canuck.infradead.org with smtps (Exim 4.76 #1 (Red Hat Linux)) id 1QUxPR-0002QP-I2 for linux-arm-kernel@lists.infradead.org; Fri, 10 Jun 2011 08:49:42 +0000 Received: from beta.dmz-us.st.com ([167.4.1.35]) (using TLSv1) by eu1sys200aob103.postini.com ([207.126.147.11]) with SMTP ID DSNKTfHanE/VkYcqCIMRP62tuFSIKD/xdqpq@postini.com; Fri, 10 Jun 2011 08:49:41 UTC Received: from zeta.dmz-us.st.com (ns4.st.com [167.4.16.71]) by beta.dmz-us.st.com (STMicroelectronics) with ESMTP id 3D7FF3F; Fri, 10 Jun 2011 08:49:17 +0000 (GMT) Received: from relay1.stm.gmessaging.net (unknown [10.230.100.17]) by zeta.dmz-us.st.com (STMicroelectronics) with ESMTP id C0F9D4E; Fri, 10 Jun 2011 08:49:16 +0000 (GMT) Received: from exdcvycastm022.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm022", Issuer "exdcvycastm022" (not verified)) by relay1.stm.gmessaging.net (Postfix) with ESMTPS id 67CE624C2F3; Fri, 10 Jun 2011 10:49:11 +0200 (CEST) Received: from localhost.localdomain (10.230.100.153) by smtp.stericsson.com (10.230.100.30) with Microsoft SMTP Server (TLS) id 8.3.83.0; Fri, 10 Jun 2011 10:49:16 +0200 From: Linus Walleij To: Grant Likely , , Subject: [PATCH 1/2] gpio: expose gpio_to_chip() Date: Fri, 10 Jun 2011 10:49:12 +0200 Message-ID: <1307695752-28051-1-git-send-email-linus.walleij@stericsson.com> X-Mailer: git-send-email 1.7.3.2 MIME-Version: 1.0 X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110610_044941_883832_0A5FC702 X-CRM114-Status: GOOD ( 15.24 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [207.126.144.115 listed in list.dnswl.org] Cc: Linus Walleij , Lee Jones X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Fri, 10 Jun 2011 08:50:20 +0000 (UTC) From: Linus Walleij This makes the gpio_to_chip() function available to drivers. The usecase is when you want to add a few chip-specific operations apart from the ones exposed in struct gpio_chip. Signed-off-by: Linus Walleij --- drivers/gpio/gpiolib.c | 2 +- include/asm-generic/gpio.h | 1 + 2 files changed, 2 insertions(+), 1 deletions(-) diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index a971e3d..dc315e9 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -114,7 +114,7 @@ static int gpio_ensure_requested(struct gpio_desc *desc, unsigned offset) } /* caller holds gpio_lock *OR* gpio is marked as requested */ -static inline struct gpio_chip *gpio_to_chip(unsigned gpio) +struct gpio_chip *gpio_to_chip(unsigned gpio) { return gpio_desc[gpio].chip; } diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h index fcdcb5d..dd8c815 100644 --- a/include/asm-generic/gpio.h +++ b/include/asm-generic/gpio.h @@ -132,6 +132,7 @@ struct gpio_chip { #endif }; +extern struct gpio_chip *gpio_to_chip(unsigned gpio); extern const char *gpiochip_is_requested(struct gpio_chip *chip, unsigned offset); extern int __must_check gpiochip_reserve(int start, int ngpio);