aboutsummaryrefslogtreecommitdiff
path: root/common/env_flags.c
diff options
context:
space:
mode:
authorHeiko Schocher2013-12-19 13:45:04 +0100
committerTom Rini2014-01-14 09:01:06 -0500
commit1b6102718bc5514cf974abeecebebe95c6a9ecc6 (patch)
tree2ebd35092871e6f5dce93498d9ad8e0899848aa3 /common/env_flags.c
parenta113fb39df43546c704aa8eba55720da9a9dfedd (diff)
common, env: optimize boottime
when creating the hashtable, for each environmentvariable getenv(ENV_CALLBACK_VAR) and getenv(ENV_FLAGS_VAR) is called, which costs at this point a lot of time. So call this two getenv() calls only once. Boottime on the ids8313 board without this patch: 2013-12-19 13:38:22,894: NAND: 128 MiB 2013-12-19 13:38:27,659: In: serial (~4.8 sec) Bootime with this patch on the ids8313 board: 2013-12-19 13:40:25,332: NAND: 128 MiB 2013-12-19 13:40:25,546: In: serial (~0.2 sec) Signed-off-by: Heiko Schocher <hs@denx.de> Cc: Tom Rini <trini@ti.com> Cc: Joe Hershberger <joe.hershberger@ni.com> Cc: Wolfgang Denk <wd@denx.de>
Diffstat (limited to 'common/env_flags.c')
-rw-r--r--common/env_flags.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/common/env_flags.c b/common/env_flags.c
index e9b72e60a94..985f92e50e9 100644
--- a/common/env_flags.c
+++ b/common/env_flags.c
@@ -395,6 +395,9 @@ static int env_parse_flags_to_bin(const char *flags)
return binflags;
}
+static int first_call = 1;
+static const char *flags_list;
+
/*
* Look for possible flags for a newly added variable
* This is called specifically when the variable did not exist in the hash
@@ -403,10 +406,13 @@ static int env_parse_flags_to_bin(const char *flags)
void env_flags_init(ENTRY *var_entry)
{
const char *var_name = var_entry->key;
- const char *flags_list = getenv(ENV_FLAGS_VAR);
char flags[ENV_FLAGS_ATTR_MAX_LEN + 1] = "";
int ret = 1;
+ if (first_call) {
+ flags_list = getenv(ENV_FLAGS_VAR);
+ first_call = 0;
+ }
/* look in the ".flags" and static for a reference to this variable */
ret = env_flags_lookup(flags_list, var_name, flags);