]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
env: allow flash and nand env driver to compile together
authorRajesh Bhagat <rajesh.bhagat@nxp.com>
Mon, 5 Nov 2018 18:01:10 +0000 (18:01 +0000)
committerYork Sun <york.sun@nxp.com>
Tue, 4 Dec 2018 21:07:13 +0000 (13:07 -0800)
Define env_ptr as static in flash and nand env driver to
allow these to compile together.

Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
env/flash.c
env/nand.c
include/environment.h

index 32236c716ec7971223613ad57b18ba6f34ef7ddf..dca6567a097debbe6bd2611879ffe30d89e0f879 100644 (file)
@@ -44,16 +44,16 @@ DECLARE_GLOBAL_DATA_PTR;
 #define INITENV
 #endif
 
+#if defined(CONFIG_ENV_ADDR_REDUND) && defined(CMD_SAVEENV) || \
+       !defined(CONFIG_ENV_ADDR_REDUND) && defined(INITENV)
 #ifdef ENV_IS_EMBEDDED
-env_t *env_ptr = &environment;
-
-static __maybe_unused env_t *flash_addr = (env_t *)CONFIG_ENV_ADDR;
-
+static env_t *env_ptr = &environment;
 #else /* ! ENV_IS_EMBEDDED */
 
-env_t *env_ptr = (env_t *)CONFIG_ENV_ADDR;
-static __maybe_unused env_t *flash_addr = (env_t *)CONFIG_ENV_ADDR;
+static env_t *env_ptr = (env_t *)CONFIG_ENV_ADDR;
 #endif /* ENV_IS_EMBEDDED */
+#endif
+static __maybe_unused env_t *flash_addr = (env_t *)CONFIG_ENV_ADDR;
 
 /* CONFIG_ENV_ADDR is supposed to be on sector boundary */
 static ulong __maybe_unused end_addr =
index 3698e689571270b6d6e867bc54899d1e5f6bd1f9..29eda66fad846eadcd9a412b578f0800449fef19 100644 (file)
 #endif
 
 #if defined(ENV_IS_EMBEDDED)
-env_t *env_ptr = &environment;
+static env_t *env_ptr = &environment;
 #elif defined(CONFIG_NAND_ENV_DST)
-env_t *env_ptr = (env_t *)CONFIG_NAND_ENV_DST;
-#else /* ! ENV_IS_EMBEDDED */
-env_t *env_ptr;
+static env_t *env_ptr = (env_t *)CONFIG_NAND_ENV_DST;
 #endif /* ENV_IS_EMBEDDED */
 
 DECLARE_GLOBAL_DATA_PTR;
index 5e90f157e8d0b7069b1e48032382445468e70233..7da1291d5bd24a1ae90e492d61f241bb37b05532 100644 (file)
@@ -157,7 +157,6 @@ extern env_t environment;
 #endif /* ENV_IS_EMBEDDED */
 
 extern const unsigned char default_environment[];
-extern env_t *env_ptr;
 
 #if defined(CONFIG_NEEDS_MANUAL_RELOC)
 extern void env_reloc(void);