All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot-Users] [PATCH] cfi_flash.c: use addr2info
@ 2007-03-23 11:52 Ladislav Michl
  2007-03-24 18:27 ` [U-Boot-Users] u-boot.lds Charles Krinke
  2007-04-24 10:26 ` [U-Boot-Users] [PATCH] cfi_flash.c: use addr2info Ladislav Michl
  0 siblings, 2 replies; 9+ messages in thread
From: Ladislav Michl @ 2007-03-23 11:52 UTC (permalink / raw)
  To: u-boot

Hi,

cfi_flash.c is providing functionality already present elsewhere as
addr2info (in common/flash.c). Lets sava few bytes by using it.

Btw, I'm considering name flash_get_info a bit more descriptive than
addr2info... I'll eventually send renaming patch on top of this one.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>

Use addr2info instead of private flash_get_info.

diff --git a/drivers/cfi_flash.c b/drivers/cfi_flash.c
index 5579a1e..0536e20 100644
--- a/drivers/cfi_flash.c
+++ b/drivers/cfi_flash.c
@@ -196,9 +196,6 @@ static int flash_write_cfiword (flash_info_t * info, ulong dest, cfiword_t cword
 static int flash_full_status_check (flash_info_t * info, flash_sect_t sector,
 				    ulong tout, char *prompt);
 ulong flash_get_size (ulong base, int banknum);
-#if defined(CFG_ENV_IS_IN_FLASH) || defined(CFG_ENV_ADDR_REDUND) || (CFG_MONITOR_BASE >= CFG_FLASH_BASE)
-static flash_info_t *flash_get_info(ulong base);
-#endif
 #ifdef CFG_FLASH_USE_BUFFER_WRITE
 static int flash_write_cfibuffer (flash_info_t * info, ulong dest, uchar * cp, int len);
 #endif
@@ -401,7 +398,7 @@ unsigned long flash_init (void)
 	flash_protect (FLAG_PROTECT_SET,
 		       CFG_MONITOR_BASE,
 		       CFG_MONITOR_BASE + monitor_flash_len  - 1,
-		       flash_get_info(CFG_MONITOR_BASE));
+		       addr2info(CFG_MONITOR_BASE));
 #endif
 
 	/* Environment protection ON by default */
@@ -409,7 +406,7 @@ unsigned long flash_init (void)
 	flash_protect (FLAG_PROTECT_SET,
 		       CFG_ENV_ADDR,
 		       CFG_ENV_ADDR + CFG_ENV_SECT_SIZE - 1,
-		       flash_get_info(CFG_ENV_ADDR));
+		       addr2info(CFG_ENV_ADDR));
 #endif
 
 	/* Redundant environment protection ON by default */
@@ -417,32 +414,13 @@ unsigned long flash_init (void)
 	flash_protect (FLAG_PROTECT_SET,
 		       CFG_ENV_ADDR_REDUND,
 		       CFG_ENV_ADDR_REDUND + CFG_ENV_SIZE_REDUND - 1,
-		       flash_get_info(CFG_ENV_ADDR_REDUND));
+		       addr2info(CFG_ENV_ADDR_REDUND));
 #endif
 	return (size);
 }
 
 /*-----------------------------------------------------------------------
  */
-#if defined(CFG_ENV_IS_IN_FLASH) || defined(CFG_ENV_ADDR_REDUND) || (CFG_MONITOR_BASE >= CFG_FLASH_BASE)
-static flash_info_t *flash_get_info(ulong base)
-{
-	int i;
-	flash_info_t * info = 0;
-
-	for (i = 0; i < CFG_MAX_FLASH_BANKS; i ++) {
-		info = & flash_info[i];
-		if (info->size && info->start[0] <= base &&
-		    base <= info->start[0] + info->size - 1)
-			break;
-	}
-
-	return i == CFG_MAX_FLASH_BANKS ? 0 : info;
-}
-#endif
-
-/*-----------------------------------------------------------------------
- */
 int flash_erase (flash_info_t * info, int s_first, int s_last)
 {
 	int rcode = 0;

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2007-05-16 10:45 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-23 11:52 [U-Boot-Users] [PATCH] cfi_flash.c: use addr2info Ladislav Michl
2007-03-24 18:27 ` [U-Boot-Users] u-boot.lds Charles Krinke
2007-03-25 20:38   ` Wolfgang Denk
2007-04-24 10:26 ` [U-Boot-Users] [PATCH] cfi_flash.c: use addr2info Ladislav Michl
2007-05-02 21:50   ` Tolunay Orkun
2007-05-03 10:04     ` Ladislav Michl
2007-05-03 21:06       ` Tolunay Orkun
2007-05-16 10:27         ` Ladislav Michl
2007-05-16 10:45           ` Stefan Roese

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.