From f1f0ae6a9ce7f4bd148daac233a70a065623d3dd Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Thu, 1 Aug 2019 09:46:41 -0600 Subject: [PATCH] env: Move get_env_id() to env.h Move this function over to the new header file. Also rename it to have an env_ prefix like the other functions. Signed-off-by: Simon Glass Acked-by: Joe Hershberger --- cmd/nvedit.c | 5 +++-- drivers/net/netconsole.c | 5 +++-- include/common.h | 2 -- include/env.h | 10 ++++++++++ net/eth_common.c | 3 ++- 5 files changed, 18 insertions(+), 7 deletions(-) diff --git a/cmd/nvedit.c b/cmd/nvedit.c index 46b1e60f0a..4f3edab8b9 100644 --- a/cmd/nvedit.c +++ b/cmd/nvedit.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -69,14 +70,14 @@ NAND|NVRAM|ONENAND|SATA|SPI_FLASH|REMOTE|UBI} or CONFIG_ENV_IS_NOWHERE /* * This variable is incremented on each do_env_set(), so it can - * be used via get_env_id() as an indication, if the environment + * be used via env_get_id() as an indication, if the environment * has changed or not. So it is possible to reread an environment * variable only if the environment was changed ... done so for * example in NetInitLoop() */ static int env_id = 1; -int get_env_id(void) +int env_get_id(void) { return env_id; } diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c index ce5a15ef57..73005ff94d 100644 --- a/drivers/net/netconsole.c +++ b/drivers/net/netconsole.c @@ -6,6 +6,7 @@ #include #include +#include #include #include @@ -55,7 +56,7 @@ static int is_broadcast(struct in_addr ip) static struct in_addr netmask; static struct in_addr our_ip; static int env_changed_id; - int env_id = get_env_id(); + int env_id = env_get_id(); /* update only when the environment has changed */ if (env_changed_id != env_id) { @@ -75,7 +76,7 @@ static int refresh_settings_from_env(void) { const char *p; static int env_changed_id; - int env_id = get_env_id(); + int env_id = env_get_id(); /* update only when the environment has changed */ if (env_changed_id != env_id) { diff --git a/include/common.h b/include/common.h index 6b890470c1..997da857b2 100644 --- a/include/common.h +++ b/include/common.h @@ -247,8 +247,6 @@ static inline int env_set_addr(const char *varname, const void *addr) return env_set_hex(varname, (ulong)addr); } -int get_env_id (void); - void pci_init_board(void); /* common/exports.c */ diff --git a/include/env.h b/include/env.h index 157ee9b724..b82d80de17 100644 --- a/include/env.h +++ b/include/env.h @@ -11,6 +11,16 @@ #include +/** + * env_get_id() - Gets a sequence number for the environment + * + * This value increments every time the environment changes, so can be used an + * an indication of this + * + * @return environment ID + */ +int env_get_id(void); + /** * env_complete() - return an auto-complete for environment variables * diff --git a/net/eth_common.c b/net/eth_common.c index 63f9379eec..dcc59186d8 100644 --- a/net/eth_common.c +++ b/net/eth_common.c @@ -7,6 +7,7 @@ #include #include +#include #include #include #include @@ -110,7 +111,7 @@ void eth_set_current(void) static int env_changed_id; int env_id; - env_id = get_env_id(); + env_id = env_get_id(); if ((act == NULL) || (env_changed_id != env_id)) { act = env_get("ethact"); env_changed_id = env_id; -- 2.39.5