]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
global_data: Remove environment members if not used
authorSimon Glass <sjg@chromium.org>
Wed, 21 Aug 2024 16:19:25 +0000 (10:19 -0600)
committerTom Rini <trini@konsulko.com>
Mon, 26 Aug 2024 20:06:08 +0000 (14:06 -0600)
If the environment is not enabled we don't need these fields in
global_data. Make them conditional.

Make these fields conditional. Move env_buf up one so it can share
an #ifdef.

Signed-off-by: Simon Glass <sjg@chromium.org>
common/hwconfig.c
include/asm-generic/global_data.h
lib/asm-offsets.c

index afaa6cb37ab4252a3ebf9bddf9f50d08b46802d6..25a8cd5bf5da848e7ce258ebcb2738ff865ee03f 100644 (file)
@@ -77,7 +77,13 @@ static const char *__hwconfig(const char *opt, size_t *arglen,
 
        /* if we are passed a buffer use it, otherwise try the environment */
        if (!env_hwconfig) {
-               if (!(gd->flags & GD_FLG_ENV_READY) && gd->env_valid != ENV_VALID) {
+#if CONFIG_IS_ENABLED(ENV_SUPPORT)
+               if (!(gd->flags & GD_FLG_ENV_READY) &&
+                   gd->env_valid != ENV_VALID)
+#else
+               if (true)
+#endif
+               {
                        printf("WARNING: Calling __hwconfig without a buffer "
                                        "and before environment is ready\n");
                        return NULL;
index 6445bd477d49b53085ad1bbab642693a00d6bdee..d6c15e2c406397ef224e0abced34ccb04c16de3b 100644 (file)
@@ -86,6 +86,7 @@ struct global_data {
         * @cpu_clk: CPU clock rate in Hz
         */
        unsigned long cpu_clk;
+#if CONFIG_IS_ENABLED(ENV_SUPPORT)
        /**
         * @env_addr: address of environment structure
         *
@@ -93,6 +94,7 @@ struct global_data {
         * environment variables.
         */
        unsigned long env_addr;
+#endif /* ENV_SUPPORT */
        /**
         * @ram_base: base address of RAM used by U-Boot
         */
@@ -134,6 +136,7 @@ struct global_data {
         * @baudrate: baud rate of the serial interface
         */
        unsigned int baudrate;
+#if CONFIG_IS_ENABLED(ENV_SUPPORT)
        /**
         * @env_has_init: bit mask indicating environment locations
         *
@@ -150,14 +153,15 @@ struct global_data {
         * @env_load_prio: priority of the loaded environment
         */
        char env_load_prio;
-       /**
-        * @fdt_src: Source of FDT
-        */
-       enum fdt_source_t fdt_src;
        /**
         * @env_buf: buffer for env_get() before reloc
         */
        char env_buf[32];
+#endif /* ENV_SUPPORT */
+       /**
+        * @fdt_src: Source of FDT
+        */
+       enum fdt_source_t fdt_src;
        /**
         * @arch: architecture-specific data
         */
index 4e2dbda9a710fbce1f8aeb0d9e2bcb195a2de75e..b6bbcbf76caccd3c540c5659577a81eb9bd4ff3e 100644 (file)
@@ -44,7 +44,9 @@ int main(void)
 
        DEFINE(GD_NEW_GD, offsetof(struct global_data, new_gd));
 
+#if CONFIG_IS_ENABLED(ENV_SUPPORT)
        DEFINE(GD_ENV_ADDR, offsetof(struct global_data, env_addr));
+#endif
 
        return 0;
 }