common/memsize.c: Check for overflow in get_effective_memsize() only for mpc85xx
[platform/kernel/u-boot.git] / common / flash.c
index cde648d..848f44e 100644 (file)
@@ -8,12 +8,11 @@
 
 #include <common.h>
 #include <flash.h>
+#include <log.h>
 #include <uuid.h>
 
 #include <mtd/cfi_flash.h>
 
-extern flash_info_t  flash_info[]; /* info for FLASH chips */
-
 /*-----------------------------------------------------------------------
  * Functions
  */
@@ -41,7 +40,7 @@ flash_protect(int flag, ulong from, ulong to, flash_info_t *info)
 
        debug("%s %s: from 0x%08lX to 0x%08lX\n", __func__,
              (flag & FLAG_PROTECT_SET) ? "ON" :
-                     (flag & FLAG_PROTECT_CLEAR) ? "OFF" : "???",
+             (flag & FLAG_PROTECT_CLEAR) ? "OFF" : "???",
              from, to);
 
        /* There is nothing to do if we have no data about the flash
@@ -67,7 +66,7 @@ flash_protect(int flag, ulong from, ulong to, flash_info_t *info)
 #else
                                info->protect[i] = 0;
 #endif /* CONFIG_SYS_FLASH_PROTECTION */
-                               debug ("protect off %d\n", i);
+                               debug("protect off %d\n", i);
                        }
                        else if (flag & FLAG_PROTECT_SET) {
 #if defined(CONFIG_SYS_FLASH_PROTECTION)
@@ -75,7 +74,7 @@ flash_protect(int flag, ulong from, ulong to, flash_info_t *info)
 #else
                                info->protect[i] = 1;
 #endif /* CONFIG_SYS_FLASH_PROTECTION */
-                               debug ("protect on %d\n", i);
+                               debug("protect on %d\n", i);
                        }
                }
        }
@@ -90,7 +89,7 @@ addr2info(ulong addr)
        flash_info_t *info;
        int i;
 
-       for (i=0, info = &flash_info[0]; i<CONFIG_SYS_MAX_FLASH_BANKS; ++i, ++info) {
+       for (i = 0, info = &flash_info[0]; i < CFI_FLASH_BANKS; ++i, ++info) {
                if (info->flash_id != FLASH_UNKNOWN &&
                    addr >= info->start[0] &&
                    /* WARNING - The '- 1' is needed if the flash