#endif
 
 static unsigned short reserved_gpio_map[gpio_bank(MAX_BLACKFIN_GPIOS)];
-static unsigned short reserved_peri_map[gpio_bank(MAX_BLACKFIN_GPIOS + 16)];
+static unsigned short reserved_peri_map[gpio_bank(MAX_RESOURCES)];
 
-#define MAX_RESOURCES          256
 #define RESOURCE_LABEL_SIZE    16
 
-struct str_ident {
+static struct str_ident {
        char name[RESOURCE_LABEL_SIZE];
-} *str_ident;
-
+} str_ident[MAX_RESOURCES];
 
 #ifdef CONFIG_PM
 static unsigned short wakeup_map[gpio_bank(MAX_BLACKFIN_GPIOS)];
 
 static int cmp_label(unsigned short ident, const char *label)
 {
+       if (label == NULL) {
+               dump_stack();
+               printk(KERN_ERR "Please provide none-null label\n");
+       }
+
        if (label && str_ident)
                return strncmp(str_ident[ident].name,
                                 label, strlen(label));
 
 static int __init bfin_gpio_init(void)
 {
-       str_ident = kcalloc(MAX_RESOURCES,
-                                sizeof(struct str_ident), GFP_KERNEL);
-       if (str_ident == NULL)
-               return -ENOMEM;
-
-       memset(str_ident, 0, MAX_RESOURCES * sizeof(struct str_ident));
 
        printk(KERN_INFO "Blackfin GPIO Controller\n");
 
 }
 
 #endif
+#else /* BF548_FAMILY */
+
+unsigned short get_gpio_dir(unsigned short gpio)
+{
+       return (0x01 & (gpio_array[gpio_bank(gpio)]->port_dir_clear >> gpio_sub_n(gpio)));
+}
+EXPORT_SYMBOL(get_gpio_dir);
+
 #endif /* BF548_FAMILY */
 
 /***********************************************************
 
        for (c = 0; c < MAX_RESOURCES; c++) {
                if (!check_gpio(c) && (reserved_gpio_map[gpio_bank(c)] & gpio_bit(c)))
-                       len = sprintf(buf, "GPIO_%d: %s \tGPIO %s\n", c,
+                       len = sprintf(buf, "GPIO_%d: %s \t\tGPIO %s\n", c,
                                 get_label(c), get_gpio_dir(c) ? "OUTPUT" : "INPUT");
                else if (reserved_peri_map[gpio_bank(c)] & gpio_bit(c))
-                       len = sprintf(buf, "GPIO_%d: %s \tPeripheral\n", c, get_label(c));
+                       len = sprintf(buf, "GPIO_%d: %s \t\tPeripheral\n", c, get_label(c));
                else
                        continue;
                buf += len;