diff options
author | Simon Glass <sjg@chromium.org> | 2019-08-01 18:47:08 +0300 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2019-08-11 23:43:41 +0300 |
commit | d3716dd64bb8bb4c4ba2d19bac164d24ada72a68 (patch) | |
tree | 0813ae10d149c97f5dedb88624366dff087dcd05 /env/flash.c | |
parent | 25e51e90feec10b7d534b123cd9c4ed7a3a2dc1a (diff) | |
download | u-boot-d3716dd64bb8bb4c4ba2d19bac164d24ada72a68.tar.xz |
env: Rename the redundancy flags
Add an ENV prefix to these two flags so that it is clear what they relate
to. Also move them to env.h since they are part of the public API. Use an
enum rather than a #define to tie them together.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'env/flash.c')
-rw-r--r-- | env/flash.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/env/flash.c b/env/flash.c index 7a73466cf2..bdba09e306 100644 --- a/env/flash.c +++ b/env/flash.c @@ -95,10 +95,12 @@ static int env_flash_init(void) } else if (!crc1_ok && !crc2_ok) { gd->env_addr = addr_default; gd->env_valid = ENV_INVALID; - } else if (flag1 == ACTIVE_FLAG && flag2 == OBSOLETE_FLAG) { + } else if (flag1 == ENV_REDUND_ACTIVE && + flag2 == ENV_REDUND_OBSOLETE) { gd->env_addr = addr1; gd->env_valid = ENV_VALID; - } else if (flag1 == OBSOLETE_FLAG && flag2 == ACTIVE_FLAG) { + } else if (flag1 == ENV_REDUND_OBSOLETE && + flag2 == ENV_REDUND_ACTIVE) { gd->env_addr = addr2; gd->env_valid = ENV_VALID; } else if (flag1 == flag2) { @@ -121,7 +123,7 @@ static int env_flash_save(void) { env_t env_new; char *saved_data = NULL; - char flag = OBSOLETE_FLAG, new_flag = ACTIVE_FLAG; + char flag = ENV_REDUND_OBSOLETE, new_flag = ENV_REDUND_ACTIVE; int rc = 1; #if CONFIG_ENV_SECT_SIZE > CONFIG_ENV_SIZE ulong up_data = 0; @@ -322,9 +324,9 @@ static int env_flash_load(void) end_addr_new = ltmp; } - if (flash_addr_new->flags != OBSOLETE_FLAG && + if (flash_addr_new->flags != ENV_REDUND_OBSOLETE && crc32(0, flash_addr_new->data, ENV_SIZE) == flash_addr_new->crc) { - char flag = OBSOLETE_FLAG; + char flag = ENV_REDUND_OBSOLETE; gd->env_valid = ENV_REDUND; flash_sect_protect(0, (ulong)flash_addr_new, end_addr_new); @@ -334,9 +336,9 @@ static int env_flash_load(void) flash_sect_protect(1, (ulong)flash_addr_new, end_addr_new); } - if (flash_addr->flags != ACTIVE_FLAG && - (flash_addr->flags & ACTIVE_FLAG) == ACTIVE_FLAG) { - char flag = ACTIVE_FLAG; + if (flash_addr->flags != ENV_REDUND_ACTIVE && + (flash_addr->flags & ENV_REDUND_ACTIVE) == ENV_REDUND_ACTIVE) { + char flag = ENV_REDUND_ACTIVE; gd->env_valid = ENV_REDUND; flash_sect_protect(0, (ulong)flash_addr, end_addr); |