{"id":519,"url":"http://patchwork.ozlabs.org/api/1.0/patches/519/?format=json","project":{"id":2,"url":"http://patchwork.ozlabs.org/api/1.0/projects/2/?format=json","name":"Linux PPC development","link_name":"linuxppc-dev","list_id":"linuxppc-dev.lists.ozlabs.org","list_email":"linuxppc-dev@lists.ozlabs.org","web_url":"https://github.com/linuxppc/wiki/wiki","scm_url":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git","webscm_url":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/"},"msgid":"<20080918151729.GA31187@oksana.dev.rtsoft.ru>","date":"2008-09-18T15:17:29","name":"[1/3] gpiolib: make gpio_to_chip() public","commit_ref":null,"pull_url":null,"state":"not-applicable","archived":true,"hash":"f7462b91dbc1c1711f0038626989361cc7dcd95f","submitter":{"id":45,"url":"http://patchwork.ozlabs.org/api/1.0/people/45/?format=json","name":"Anton Vorontsov","email":"avorontsov@ru.mvista.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20080918151729.GA31187@oksana.dev.rtsoft.ru/mbox/","series":[],"check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/519/checks/","tags":{},"headers":{"Return-Path":"<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org>","X-Original-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@ozlabs.org"],"Delivered-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@ozlabs.org"],"Received":["from ozlabs.org (localhost [127.0.0.1])\n\tby ozlabs.org (Postfix) with ESMTP id 9CC5BDE303\n\tfor <patchwork-incoming@ozlabs.org>;\n\tFri, 19 Sep 2008 01:17:44 +1000 (EST)","from buildserver.ru.mvista.com (unknown [85.21.88.6])\n\tby ozlabs.org (Postfix) with ESMTP id 77D42DDFC5\n\tfor <linuxppc-dev@ozlabs.org>; Fri, 19 Sep 2008 01:17:31 +1000 (EST)","from localhost (unknown [10.150.0.9])\n\tby buildserver.ru.mvista.com (Postfix) with ESMTP\n\tid 01023881B; Thu, 18 Sep 2008 20:17:30 +0500 (SAMST)"],"Date":"Thu, 18 Sep 2008 19:17:29 +0400","From":"Anton Vorontsov <avorontsov@ru.mvista.com>","To":"Andrew Morton <akpm@linux-foundation.org>","Subject":"[PATCH 1/3] gpiolib: make gpio_to_chip() public","Message-ID":"<20080918151729.GA31187@oksana.dev.rtsoft.ru>","References":"<20080918151659.GA20140@oksana.dev.rtsoft.ru>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20080918151659.GA20140@oksana.dev.rtsoft.ru>","User-Agent":"Mutt/1.5.18 (2008-05-17)","Cc":"David Brownell <dbrownell@users.sourceforge.net>,\n\tGreg Kroah-Hartman <greg@kroah.com>, linux-usb@vger.kernel.org,\n\tlinux-kernel@vger.kernel.org, linuxppc-dev@ozlabs.org,\n\tLi Yang <leoli@freescale.com>, Timur Tabi <timur@freescale.com>","X-BeenThere":"linuxppc-dev@ozlabs.org","X-Mailman-Version":"2.1.11","Precedence":"list","List-Id":"Linux on PowerPC Developers Mail List <linuxppc-dev.ozlabs.org>","List-Unsubscribe":"<https://ozlabs.org/mailman/options/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@ozlabs.org?subject=unsubscribe>","List-Archive":"<http://ozlabs.org/pipermail/linuxppc-dev>","List-Post":"<mailto:linuxppc-dev@ozlabs.org>","List-Help":"<mailto:linuxppc-dev-request@ozlabs.org?subject=help>","List-Subscribe":"<https://ozlabs.org/mailman/listinfo/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@ozlabs.org?subject=subscribe>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Sender":"linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org","Errors-To":"linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org"},"content":"We'll need this function to write platform-specific hooks to deal\nwith pin's dedicated functions. Quite obviously this will work only\nfor the platforms with 1-to-1 GPIO to PIN mapping.\n\nThis is stopgap solution till we think out and implement a proper\napi (pinlib?).\n\np.s. This patch actually exports gpio_desc and places gpio_to_chip\ninto the asm-generic/gpio.h as `static inline'. This is needed\nto not cause function calls for this trivial translation.\n\nAlso, the patch does not export FLAG_*s... the names are too\ngeneric, and nobody is using them outside of gpiolib.c.\n\nSigned-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>","diff":"diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c\nindex 8d29405..fb36a90 100644\n--- a/drivers/gpio/gpiolib.c\n+++ b/drivers/gpio/gpiolib.c\n@@ -40,9 +40,6 @@\n  */\n static DEFINE_SPINLOCK(gpio_lock);\n \n-struct gpio_desc {\n-\tstruct gpio_chip\t*chip;\n-\tunsigned long\t\tflags;\n /* flag symbols are bit numbers */\n #define FLAG_REQUESTED\t0\n #define FLAG_IS_OUT\t1\n@@ -50,11 +47,8 @@ struct gpio_desc {\n #define FLAG_EXPORT\t3\t/* protected by sysfs_lock */\n #define FLAG_SYSFS\t4\t/* exported via /sys/class/gpio/control */\n \n-#ifdef CONFIG_DEBUG_FS\n-\tconst char\t\t*label;\n-#endif\n-};\n-static struct gpio_desc gpio_desc[ARCH_NR_GPIOS];\n+struct gpio_desc gpio_desc[ARCH_NR_GPIOS];\n+EXPORT_SYMBOL_GPL(gpio_desc);\n \n static inline void desc_set_label(struct gpio_desc *d, const char *label)\n {\n@@ -80,12 +74,6 @@ static void gpio_ensure_requested(struct gpio_desc *desc)\n \t}\n }\n \n-/* caller holds gpio_lock *OR* gpio is marked as requested */\n-static inline struct gpio_chip *gpio_to_chip(unsigned gpio)\n-{\n-\treturn gpio_desc[gpio].chip;\n-}\n-\n /* dynamic allocation of GPIOs, e.g. on a hotplugged device */\n static int gpiochip_find_base(int ngpio)\n {\ndiff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h\nindex 0f99ad3..88962f0 100644\n--- a/include/asm-generic/gpio.h\n+++ b/include/asm-generic/gpio.h\n@@ -81,6 +81,23 @@ struct gpio_chip {\n \tunsigned\t\texported:1;\n };\n \n+struct gpio_desc {\n+\tstruct gpio_chip\t*chip;\n+\tunsigned long\t\tflags;\n+\n+#ifdef CONFIG_DEBUG_FS\n+\tconst char\t\t*label;\n+#endif\n+};\n+\n+extern struct gpio_desc gpio_desc[ARCH_NR_GPIOS];\n+\n+/* caller holds gpio_lock *OR* gpio is marked as requested */\n+static inline struct gpio_chip *gpio_to_chip(unsigned gpio)\n+{\n+\treturn gpio_desc[gpio].chip;\n+}\n+\n extern const char *gpiochip_is_requested(struct gpio_chip *chip,\n \t\t\tunsigned offset);\n extern int __must_check gpiochip_reserve(int start, int ngpio);\n","prefixes":["1/3"]}