The struct list_head dmtag_list, struct udevice *dm_root, struct
list_head uclass_root_s and struct list_head *uclass_root fields in
struct global_data takes up 24/48 bytes of memory on ARMv7/AArch64.
However, these fields are only used when $(PHASE_)DM is enabled.

Guard driver model related fields using CONFIG_IS_ENABLED(DM) to save
memory space when U-Boot proper is built with DM=y and xPL is built
without xPL_DM.

Signed-off-by: Jonas Karlman <[email protected]>
---
This change passed CI pipeline #924 [1]

[1] 
https://git.u-boot-project.org/u-boot/contributors/kwiboo/u-boot/-/pipelines/924
---
 include/asm-generic/global_data.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/asm-generic/global_data.h 
b/include/asm-generic/global_data.h
index fd116b0cebf2..886c12900ddb 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -174,10 +174,12 @@ struct global_data {
         * @arch: architecture-specific data
         */
        struct arch_global_data arch;
+#if CONFIG_IS_ENABLED(DM)
        /**
         * @dmtag_list: List of DM tags
         */
        struct list_head dmtag_list;
+#endif
        /**
         * @timebase_h: high 32 bits of timer
         */
@@ -228,7 +230,7 @@ struct global_data {
         */
        long precon_buf_idx;
 #endif
-#ifdef CONFIG_DM
+#if CONFIG_IS_ENABLED(DM)
        /**
         * @dm_root: root instance for Driver Model
         */
-- 
2.54.0

Reply via email to