Skip to contentSkip to conversation

global_data: Only include driver model fields when DM is enabled

PATCH In review Jonas Karlman 3 participants 4 messages Aug 10 – Aug 18 Generic include/asm header files

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 global_data: Only include driver model fields when DM is enabled

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.

---
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(-)
include/asm-generic/global_data.h +3 -1
index fd116b0cebf2..886c12900ddb 100644
@@ -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
 	 */
Signature · 1 line
2.54.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Jonas Karlman

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.

Signature · 1 line
Tom
Reviewed-by on v1 1/1
#2 lore raw
In reply to Jonas Karlman
Quoted 11 lines · Jonas Karlman

global_data: Only include driver model fields when DM is enabled

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.

Quoted 5 lines

include/asm-generic/global_data.h | 4 +++-

 1 file changed, 3 insertions(+), 1 deletion(-)
#3 lore raw
In reply to Jonas Karlman
Quoted 10 lines · Jonas Karlman

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.

[...]

Applied to u-boot/next, thanks!

[1/1] global_data: Only include driver model fields when DM is enabled

      commit: 41541f47a3af93d76d63c2d6d1f1c859fa3dd61a
Signature · 1 line
Tom