[U-Boot] [PATCH v6 02/27] env: allow flash and nand env driver to compile together

York Sun york.sun at nxp.com
Mon Dec 3 18:14:48 UTC 2018


Maintainers,

Please review this patch as it slightly changes common code for ENV.

Rajesh,

If you run get_maintainers, or use patman, you would have expanded the
CC list.

York

On 11/5/18 10:01 AM, Rajesh Bhagat wrote:
> Define env_ptr as static in flash and nand env driver to
> allow these to compile together.
> 
> Signed-off-by: Rajesh Bhagat <rajesh.bhagat at nxp.com>
> ---
> Change in v6: None
> 
> Change in v5:
>  - Solved compilation warning for boards mccmon6_sd and mccmon6_nor
>  
> Change in v4: None
> 
> Change in v3:
>  - Merged env nand specific patches to remove compilation warning
> 
> Change in v2: None
> 
> 
> 
>  env/flash.c           | 12 ++++++------
>  env/nand.c            |  6 ++----
>  include/environment.h |  1 -
>  3 files changed, 8 insertions(+), 11 deletions(-)
> 
> diff --git a/env/flash.c b/env/flash.c
> index 32236c716e..dca6567a09 100644
> --- a/env/flash.c
> +++ b/env/flash.c
> @@ -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 =
> diff --git a/env/nand.c b/env/nand.c
> index 3698e68957..29eda66fad 100644
> --- a/env/nand.c
> +++ b/env/nand.c
> @@ -40,11 +40,9 @@
>  #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;
> diff --git a/include/environment.h b/include/environment.h
> index 5e90f157e8..7da1291d5b 100644
> --- a/include/environment.h
> +++ b/include/environment.h
> @@ -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);
> 



More information about the U-Boot mailing list