]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
blackfin: make name_to_gpio be a weak symbol
authorIan Campbell <ijc@hellion.org.uk>
Thu, 27 Mar 2014 20:34:13 +0000 (20:34 +0000)
committerTom Rini <trini@ti.com>
Fri, 18 Apr 2014 14:42:29 +0000 (10:42 -0400)
This required moving it into a C file from the header.

The only user of a non-default name_to_gpio is blackfin, therefore build tested
with the blackfin bct-brettl2 build, which is one I picked at random. Also
tested with a build for the ARM tec board which uses the default/fallback
implementation. Inspection with objdump shows that both have done the right
thing.

This change was requested by Marek during review of the sunxi patch series.

Signed-off-by: Ian Campbell <ijc@hellion.org.uk>
Cc: Marek Vasut <marex@denx.de>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Sonic Zhang <sonic.adi@gmail.com>
arch/blackfin/cpu/gpio.c
arch/blackfin/include/asm/gpio.h
common/cmd_gpio.c

index 86da706f08d2164349b485c47c988b566916d2c5..4b4cf93c2dc06d2c3aab7ad4dfb8f59cfc011dfe 100644 (file)
@@ -759,6 +759,54 @@ void bfin_reset_boot_spi_cs(unsigned short pin)
        udelay(1);
 }
 
+int name_to_gpio(const char *name)
+{
+       int port_base;
+
+       if (tolower(*name) == 'p') {
+               ++name;
+
+               switch (tolower(*name)) {
+#ifdef GPIO_PA0
+               case 'a': port_base = GPIO_PA0; break;
+#endif
+#ifdef GPIO_PB0
+               case 'b': port_base = GPIO_PB0; break;
+#endif
+#ifdef GPIO_PC0
+               case 'c': port_base = GPIO_PC0; break;
+#endif
+#ifdef GPIO_PD0
+               case 'd': port_base = GPIO_PD0; break;
+#endif
+#ifdef GPIO_PE0
+               case 'e': port_base = GPIO_PE0; break;
+#endif
+#ifdef GPIO_PF0
+               case 'f': port_base = GPIO_PF0; break;
+#endif
+#ifdef GPIO_PG0
+               case 'g': port_base = GPIO_PG0; break;
+#endif
+#ifdef GPIO_PH0
+               case 'h': port_base = GPIO_PH0; break;
+#endif
+#ifdef GPIO_PI0
+               case 'i': port_base = GPIO_PI0; break;
+#endif
+#ifdef GPIO_PJ
+               case 'j': port_base = GPIO_PJ0; break;
+#endif
+               default:  return -1;
+               }
+
+               ++name;
+       } else
+               port_base = 0;
+
+       return port_base + simple_strtoul(name, NULL, 10);
+}
+
 void gpio_labels(void)
 {
        int c, gpio;
index 6ebcf01aff87303a25557316ae05bf5e20768514..1fa1a8e6ecf79dc045660ba6d242e4b8bff43404 100644 (file)
@@ -160,55 +160,6 @@ static inline int gpio_is_valid(int number)
 
 #include <linux/ctype.h>
 
-static inline int name_to_gpio(const char *name)
-{
-       int port_base;
-
-       if (tolower(*name) == 'p') {
-               ++name;
-
-               switch (tolower(*name)) {
-#ifdef GPIO_PA0
-               case 'a': port_base = GPIO_PA0; break;
-#endif
-#ifdef GPIO_PB0
-               case 'b': port_base = GPIO_PB0; break;
-#endif
-#ifdef GPIO_PC0
-               case 'c': port_base = GPIO_PC0; break;
-#endif
-#ifdef GPIO_PD0
-               case 'd': port_base = GPIO_PD0; break;
-#endif
-#ifdef GPIO_PE0
-               case 'e': port_base = GPIO_PE0; break;
-#endif
-#ifdef GPIO_PF0
-               case 'f': port_base = GPIO_PF0; break;
-#endif
-#ifdef GPIO_PG0
-               case 'g': port_base = GPIO_PG0; break;
-#endif
-#ifdef GPIO_PH0
-               case 'h': port_base = GPIO_PH0; break;
-#endif
-#ifdef GPIO_PI0
-               case 'i': port_base = GPIO_PI0; break;
-#endif
-#ifdef GPIO_PJ
-               case 'j': port_base = GPIO_PJ0; break;
-#endif
-               default:  return -1;
-               }
-
-               ++name;
-       } else
-               port_base = 0;
-
-       return port_base + simple_strtoul(name, NULL, 10);
-}
-#define name_to_gpio(n) name_to_gpio(n)
-
 #define gpio_status() gpio_labels()
 
 #endif /* __ASSEMBLY__ */
index 778aa5f0987baa732fce85a94672f5a39616fea8..aff044518f455e520ca7d9d8ea305ea32ad0d9c3 100644 (file)
 #include <dm.h>
 #include <asm/gpio.h>
 
-#ifndef name_to_gpio
-#define name_to_gpio(name) simple_strtoul(name, NULL, 10)
-#endif
+int __weak name_to_gpio(const char *name)
+{
+       return simple_strtoul(name, NULL, 10);
+}
 
 enum gpio_cmd {
        GPIO_INPUT,