diff mbox series

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

Message ID 20181012144454.3707-3-rajesh.bhagat@nxp.com
State Superseded
Delegated to: York Sun
Headers show
Series TF-A Boot support for NXP Chassis 2 platforms | expand

Commit Message

Rajesh Bhagat Oct. 12, 2018, 2:44 p.m. UTC
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>
---
Change in v4: None

Change in v3:
 - Merged env nand specific patches to remove compilation warning

Change in v2: None

 env/flash.c           | 4 ++--
 env/nand.c            | 6 ++----
 include/environment.h | 1 -
 3 files changed, 4 insertions(+), 7 deletions(-)

Comments

York Sun Oct. 26, 2018, 2:30 p.m. UTC | #1
On 10/12/18 07:45, 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@nxp.com>
> ---
> Change in v4: None
> 
> Change in v3:
>  - Merged env nand specific patches to remove compilation warning
> 
> Change in v2: None
> 
>  env/flash.c           | 4 ++--
>  env/nand.c            | 6 ++----
>  include/environment.h | 1 -
>  3 files changed, 4 insertions(+), 7 deletions(-)
> 
> diff --git a/env/flash.c b/env/flash.c
> index 32236c716e..33b199f05b 100644
> --- a/env/flash.c
> +++ b/env/flash.c
> @@ -45,13 +45,13 @@ DECLARE_GLOBAL_DATA_PTR;
>  #endif
>  
>  #ifdef ENV_IS_EMBEDDED
> -env_t *env_ptr = &environment;
> +static env_t *env_ptr = &environment;
>  
>  static __maybe_unused env_t *flash_addr = (env_t *)CONFIG_ENV_ADDR;
>  
>  #else /* ! ENV_IS_EMBEDDED */
>  
> -env_t *env_ptr = (env_t *)CONFIG_ENV_ADDR;
> +static env_t *env_ptr = (env_t *)CONFIG_ENV_ADDR;
>  static __maybe_unused env_t *flash_addr = (env_t *)CONFIG_ENV_ADDR;
>  #endif /* ENV_IS_EMBEDDED */
>  

Compiling warning env_ptr defined but not used for boards mccmon6_sd and
mccmon6_nor. Please check.

York
Rajesh Bhagat Oct. 26, 2018, 4:08 p.m. UTC | #2
> -----Original Message-----
> From: York Sun
> Sent: Friday, October 26, 2018 8:01 PM
> To: Rajesh Bhagat <rajesh.bhagat@nxp.com>; u-boot@lists.denx.de
> Cc: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
> Subject: Re: [PATCH v4 02/27] env: allow flash and nand env driver to compile
> together
> 
> On 10/12/18 07:45, 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@nxp.com>
> > ---
> > Change in v4: None
> >
> > Change in v3:
> >  - Merged env nand specific patches to remove compilation warning
> >
> > Change in v2: None
> >
> >  env/flash.c           | 4 ++--
> >  env/nand.c            | 6 ++----
> >  include/environment.h | 1 -
> >  3 files changed, 4 insertions(+), 7 deletions(-)
> >
> > diff --git a/env/flash.c b/env/flash.c index 32236c716e..33b199f05b
> > 100644
> > --- a/env/flash.c
> > +++ b/env/flash.c
> > @@ -45,13 +45,13 @@ DECLARE_GLOBAL_DATA_PTR;  #endif
> >
> >  #ifdef ENV_IS_EMBEDDED
> > -env_t *env_ptr = &environment;
> > +static env_t *env_ptr = &environment;
> >
> >  static __maybe_unused env_t *flash_addr = (env_t *)CONFIG_ENV_ADDR;
> >
> >  #else /* ! ENV_IS_EMBEDDED */
> >
> > -env_t *env_ptr = (env_t *)CONFIG_ENV_ADDR;
> > +static env_t *env_ptr = (env_t *)CONFIG_ENV_ADDR;
> >  static __maybe_unused env_t *flash_addr = (env_t *)CONFIG_ENV_ADDR;
> > #endif /* ENV_IS_EMBEDDED */
> >
> 
> Compiling warning env_ptr defined but not used for boards mccmon6_sd and
> mccmon6_nor. Please check.
> 

Hi York, 

Thanks for pointing it out. Let me check this. 

- Rajesh

> York
diff mbox series

Patch

diff --git a/env/flash.c b/env/flash.c
index 32236c716e..33b199f05b 100644
--- a/env/flash.c
+++ b/env/flash.c
@@ -45,13 +45,13 @@  DECLARE_GLOBAL_DATA_PTR;
 #endif
 
 #ifdef ENV_IS_EMBEDDED
-env_t *env_ptr = &environment;
+static env_t *env_ptr = &environment;
 
 static __maybe_unused env_t *flash_addr = (env_t *)CONFIG_ENV_ADDR;
 
 #else /* ! ENV_IS_EMBEDDED */
 
-env_t *env_ptr = (env_t *)CONFIG_ENV_ADDR;
+static env_t *env_ptr = (env_t *)CONFIG_ENV_ADDR;
 static __maybe_unused env_t *flash_addr = (env_t *)CONFIG_ENV_ADDR;
 #endif /* ENV_IS_EMBEDDED */
 
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);