[U-Boot] [PATCH 07/11] env: gd flags without ENV_READY is enough to discriminate in

Quentin Schulz quentin.schulz at free-electrons.com
Fri Dec 22 21:13:41 UTC 2017


env_get_default

To prepare the removal of env_valid in an upcoming patch, and since the
ENV_READY flag in gd is enough to discriminate in env_get_char, let's
update env_get_char to return the variable in the default environment
when ENV_READY flag is not set and remove env_valid setting and getting
from env_get_default.

Signed-off-by: Quentin Schulz <quentin.schulz at free-electrons.com>
---
 env/common.c | 3 ---
 env/env.c    | 2 +-
 2 files changed, 1 insertion(+), 4 deletions(-)

diff --git a/env/common.c b/env/common.c
index c8d8993..75b8334 100644
--- a/env/common.c
+++ b/env/common.c
@@ -47,14 +47,11 @@ int env_get_yesno(const char *var)
 char *env_get_default(const char *name)
 {
 	char *ret_val;
-	unsigned long really_valid = gd->env_valid;
 	unsigned long real_gd_flags = gd->flags;
 
 	/* Pretend that the image is bad. */
 	gd->flags &= ~GD_FLG_ENV_READY;
-	gd->env_valid = ENV_INVALID;
 	ret_val = env_get(name);
-	gd->env_valid = really_valid;
 	gd->flags = real_gd_flags;
 	return ret_val;
 }
diff --git a/env/env.c b/env/env.c
index 7c98083..2565e7a 100644
--- a/env/env.c
+++ b/env/env.c
@@ -141,7 +141,7 @@ int env_get_char(int index)
 	struct env_driver *drv;
 	int prio;
 
-	if (gd->env_valid == ENV_INVALID)
+	if (!(gd->flags & GD_FLG_ENV_READY))
 		return default_environment[index];
 
 	for (prio = 0; (drv = env_driver_lookup(ENVO_GET_CHAR, prio)); prio++) {
-- 
git-series 0.9.1


More information about the U-Boot mailing list