flash: prefix error codes with FL_
Prefix the flash status codes (ERR_*) with FL_ in order to avoid clashes
with third-party libraries. Case in point: including the lwIP library
header file <lwip/err.h> which defines err_enum_t as an enum with values
being ERR_*.
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Peter Robinson <pbrobinson@gmail.com>
diff --git a/common/flash.c b/common/flash.c
index 24ddc8b..a64e51a 100644
--- a/common/flash.c
+++ b/common/flash.c
@@ -110,13 +110,13 @@
* Make sure all target addresses are within Flash bounds,
* and no protected sectors are hit.
* Returns:
- * ERR_OK 0 - OK
- * ERR_TIMEOUT 1 - write timeout
- * ERR_NOT_ERASED 2 - Flash not erased
- * ERR_PROTECTED 4 - target range includes protected sectors
- * ERR_INVAL 8 - target address not in Flash memory
- * ERR_ALIGN 16 - target address not aligned on boundary
- * (only some targets require alignment)
+ * FL_ERR_OK 0 - OK
+ * FL_ERR_TIMEOUT 1 - write timeout
+ * FL_ERR_NOT_ERASED 2 - Flash not erased
+ * FL_ERR_PROTECTED 4 - target range includes protected sectors
+ * FL_ERR_INVAL 8 - target address not in Flash memory
+ * FL_ERR_ALIGN 16 - target address not aligned on boundary
+ * (only some targets require alignment)
*/
int
flash_write(char *src, ulong addr, ulong cnt)
@@ -131,11 +131,11 @@
__maybe_unused ulong cnt_orig = cnt;
if (cnt == 0) {
- return (ERR_OK);
+ return (FL_ERR_OK);
}
if (!info_first || !info_last) {
- return (ERR_INVAL);
+ return (FL_ERR_INVAL);
}
for (info = info_first; info <= info_last; ++info) {
@@ -146,7 +146,7 @@
if ((end >= info->start[i]) && (addr < e_addr) &&
(info->protect[i] != 0) ) {
- return (ERR_PROTECTED);
+ return (FL_ERR_PROTECTED);
}
}
}
@@ -169,11 +169,11 @@
#if defined(CONFIG_FLASH_VERIFY)
if (memcmp(src_orig, addr_orig, cnt_orig)) {
printf("\nVerify failed!\n");
- return ERR_PROG_ERROR;
+ return FL_ERR_PROG_ERROR;
}
#endif /* CONFIG_SYS_FLASH_VERIFY_AFTER_WRITE */
- return (ERR_OK);
+ return (FL_ERR_OK);
}
/*-----------------------------------------------------------------------
@@ -182,33 +182,33 @@
void flash_perror(int err)
{
switch (err) {
- case ERR_OK:
+ case FL_ERR_OK:
break;
- case ERR_TIMEOUT:
+ case FL_ERR_TIMEOUT:
puts ("Timeout writing to Flash\n");
break;
- case ERR_NOT_ERASED:
+ case FL_ERR_NOT_ERASED:
puts ("Flash not Erased\n");
break;
- case ERR_PROTECTED:
+ case FL_ERR_PROTECTED:
puts ("Can't write to protected Flash sectors\n");
break;
- case ERR_INVAL:
+ case FL_ERR_INVAL:
puts ("Outside available Flash\n");
break;
- case ERR_ALIGN:
+ case FL_ERR_ALIGN:
puts ("Start and/or end address not on sector boundary\n");
break;
- case ERR_UNKNOWN_FLASH_VENDOR:
+ case FL_ERR_UNKNOWN_FLASH_VENDOR:
puts ("Unknown Vendor of Flash\n");
break;
- case ERR_UNKNOWN_FLASH_TYPE:
+ case FL_ERR_UNKNOWN_FLASH_TYPE:
puts ("Unknown Type of Flash\n");
break;
- case ERR_PROG_ERROR:
+ case FL_ERR_PROG_ERROR:
puts ("General Flash Programming Error\n");
break;
- case ERR_ABORTED:
+ case FL_ERR_ABORTED:
puts("Flash Programming Aborted\n");
break;
default: