CFI: Small cleanup for FLASH_SHOW_PROGRESS
With this patch we don't need that many #ifdef's in the code. It moves the subtraction into the macro and defines a NOP-macro when CONFIG_FLASH_SHOW_PROGRESS is not defined. Signed-off-by: Stefan Roese <sr@denx.de> Acked-by: Gerald Van Baren <vanbaren@cideas.com>
This commit is contained in:
parent
9a042e9ca5
commit
f0105727d1
|
@ -1185,7 +1185,9 @@ void flash_print_info (flash_info_t * info)
|
||||||
* effect updates to digit and dots. Repeated code is nasty too, so
|
* effect updates to digit and dots. Repeated code is nasty too, so
|
||||||
* we define it once here.
|
* we define it once here.
|
||||||
*/
|
*/
|
||||||
#define FLASH_SHOW_PROGRESS(scale, dots, digit) \
|
#ifdef CONFIG_FLASH_SHOW_PROGRESS
|
||||||
|
#define FLASH_SHOW_PROGRESS(scale, dots, digit, dots_sub) \
|
||||||
|
dots -= dots_sub; \
|
||||||
if ((scale > 0) && (dots <= 0)) { \
|
if ((scale > 0) && (dots <= 0)) { \
|
||||||
if ((digit % 5) == 0) \
|
if ((digit % 5) == 0) \
|
||||||
printf ("%d", digit / 5); \
|
printf ("%d", digit / 5); \
|
||||||
|
@ -1194,6 +1196,9 @@ void flash_print_info (flash_info_t * info)
|
||||||
digit--; \
|
digit--; \
|
||||||
dots += scale; \
|
dots += scale; \
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
#define FLASH_SHOW_PROGRESS(scale, dots, digit, dots_sub)
|
||||||
|
#endif
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------
|
/*-----------------------------------------------------------------------
|
||||||
* Copy memory to flash, returns:
|
* Copy memory to flash, returns:
|
||||||
|
@ -1248,10 +1253,7 @@ int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
wp += i;
|
wp += i;
|
||||||
#ifdef CONFIG_FLASH_SHOW_PROGRESS
|
FLASH_SHOW_PROGRESS(scale, dots, digit, i);
|
||||||
dots -= i;
|
|
||||||
FLASH_SHOW_PROGRESS(scale, dots, digit);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* handle the aligned part */
|
/* handle the aligned part */
|
||||||
|
@ -1281,10 +1283,7 @@ int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt)
|
||||||
wp += i;
|
wp += i;
|
||||||
src += i;
|
src += i;
|
||||||
cnt -= i;
|
cnt -= i;
|
||||||
#ifdef CONFIG_FLASH_SHOW_PROGRESS
|
FLASH_SHOW_PROGRESS(scale, dots, digit, i);
|
||||||
dots -= i;
|
|
||||||
FLASH_SHOW_PROGRESS(scale, dots, digit);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
while (cnt >= info->portwidth) {
|
while (cnt >= info->portwidth) {
|
||||||
|
@ -1296,10 +1295,7 @@ int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt)
|
||||||
return rc;
|
return rc;
|
||||||
wp += info->portwidth;
|
wp += info->portwidth;
|
||||||
cnt -= info->portwidth;
|
cnt -= info->portwidth;
|
||||||
#ifdef CONFIG_FLASH_SHOW_PROGRESS
|
FLASH_SHOW_PROGRESS(scale, dots, digit, info->portwidth);
|
||||||
dots -= info->portwidth;
|
|
||||||
FLASH_SHOW_PROGRESS(scale, dots, digit);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
#endif /* CFG_FLASH_USE_BUFFER_WRITE */
|
#endif /* CFG_FLASH_USE_BUFFER_WRITE */
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue