public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH] env: make file-scope env_ptr variables static
@ 2020-02-18  8:54 Rasmus Villemoes
  2020-04-21 12:25 ` Tom Rini
  0 siblings, 1 reply; 2+ messages in thread
From: Rasmus Villemoes @ 2020-02-18  8:54 UTC (permalink / raw)
  To: u-boot

The combination ENV_IS_IN_NVRAM=y, ENV_IS_IN_REMOTE=y fails to build:

env/remote.o:/mnt/ext4/devel/u-boot/env/remote.c:17: multiple definition of `env_ptr'
env/nvram.o:/mnt/ext4/devel/u-boot/env/nvram.c:41: first defined here

It's not necessarily a meaningful combination, but for build-testing
it's nice to be able to enable most ENV_IS_IN_* at the same time, and
since these env_ptr are not declared anywhere, they really have no
reason to have external linkage.

nand.c and flash.c similarly already define file-scope static env_ptr
variables.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
---
 env/nvram.c  | 2 +-
 env/remote.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/env/nvram.c b/env/nvram.c
index a78db21623..1a9fcf1c06 100644
--- a/env/nvram.c
+++ b/env/nvram.c
@@ -38,7 +38,7 @@ DECLARE_GLOBAL_DATA_PTR;
 extern void *nvram_read(void *dest, const long src, size_t count);
 extern void nvram_write(long dest, const void *src, size_t count);
 #else
-env_t *env_ptr = (env_t *)CONFIG_ENV_ADDR;
+static env_t *env_ptr = (env_t *)CONFIG_ENV_ADDR;
 #endif
 
 #ifdef CONFIG_SYS_NVRAM_ACCESS_ROUTINE
diff --git a/env/remote.c b/env/remote.c
index 50d77b8dfe..e3f0608b16 100644
--- a/env/remote.c
+++ b/env/remote.c
@@ -12,9 +12,9 @@
 #include <u-boot/crc.h>
 
 #ifdef ENV_IS_EMBEDDED
-env_t *env_ptr = &environment;
+static env_t *env_ptr = &environment;
 #else /* ! ENV_IS_EMBEDDED */
-env_t *env_ptr = (env_t *)CONFIG_ENV_ADDR;
+static env_t *env_ptr = (env_t *)CONFIG_ENV_ADDR;
 #endif /* ENV_IS_EMBEDDED */
 
 DECLARE_GLOBAL_DATA_PTR;
-- 
2.23.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH] env: make file-scope env_ptr variables static
  2020-02-18  8:54 [PATCH] env: make file-scope env_ptr variables static Rasmus Villemoes
@ 2020-04-21 12:25 ` Tom Rini
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Rini @ 2020-04-21 12:25 UTC (permalink / raw)
  To: u-boot

On Tue, Feb 18, 2020 at 08:54:09AM +0000, Rasmus Villemoes wrote:

> The combination ENV_IS_IN_NVRAM=y, ENV_IS_IN_REMOTE=y fails to build:
> 
> env/remote.o:/mnt/ext4/devel/u-boot/env/remote.c:17: multiple definition of `env_ptr'
> env/nvram.o:/mnt/ext4/devel/u-boot/env/nvram.c:41: first defined here
> 
> It's not necessarily a meaningful combination, but for build-testing
> it's nice to be able to enable most ENV_IS_IN_* at the same time, and
> since these env_ptr are not declared anywhere, they really have no
> reason to have external linkage.
> 
> nand.c and flash.c similarly already define file-scope static env_ptr
> variables.
> 
> Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200421/d360ad0d/attachment.sig>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-04-21 12:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-18  8:54 [PATCH] env: make file-scope env_ptr variables static Rasmus Villemoes
2020-04-21 12:25 ` Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox