Skip to contentSkip to conversation

memory: tegra: make the array list static const, makes object smaller

PATCH Applied Colin King 3 participants 4 messages Aug 19, 2021 – Sep 15, 2021

Subsystems (3)
lore
Share & tools
lore

Colin King

author
#0 lore raw

PATCH 1/1 memory: tegra: make the array list static const, makes object smaller

From: Colin Ian King <[email protected]>

Don't populate the array list on the stack but instead it static const. Makes the object code smaller by 110 bytes:

Before:
text data bss dec hex filename
37713 21992 64 59769 e979 .../tegra/tegra210-emc-cc-r21021.o

After:
text data bss dec hex filename
37539 22056 64 59659 e90b .../tegra/tegra210-emc-cc-r21021.o

(gcc version 10.3.0)

---
 drivers/memory/tegra/tegra210-emc-cc-r21021.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/memory/tegra/tegra210-emc-cc-r21021.c +1 -1
index 0ebfa8eccf0c..550d6b2dda30 100644
@@ -478,7 +478,7 @@ static u32 periodic_compensation_handler(struct tegra210_emc *emc, u32 type,
 static u32 tegra210_emc_r21021_periodic_compensation(struct tegra210_emc *emc)
 {
 	u32 emc_cfg, emc_cfg_o, emc_cfg_update, del, value;
-	u32 list[] = {
+	static const u32 list[] = {
 		EMC_PMACRO_OB_DDLL_LONG_DQ_RANK0_0,
 		EMC_PMACRO_OB_DDLL_LONG_DQ_RANK0_1,
 		EMC_PMACRO_OB_DDLL_LONG_DQ_RANK0_2,
Signature · 1 line
2.32.0
Acked-by on v1 1/1
#1 lore raw
Quoted 13 lines · Colin King

From: Colin Ian King <[email protected]>

Don't populate the array list on the stack but instead it static const. Makes the object code smaller by 110 bytes:

Before:
text data bss dec hex filename
37713 21992 64 59769 e979 .../tegra/tegra210-emc-cc-r21021.o

After:
text data bss dec hex filename
37539 22056 64 59659 e90b .../tegra/tegra210-emc-cc-r21021.o

Quoted 6 lines

(gcc version 10.3.0)

---
 drivers/memory/tegra/tegra210-emc-cc-r21021.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Wow, didn't think this was going to save us 110 bytes. Nice one!

#2 lore raw
In reply to Colin King
Quoted 13 lines · Colin King

From: Colin Ian King <[email protected]>

Don't populate the array list on the stack but instead it static const. Makes the object code smaller by 110 bytes:

Before:
text data bss dec hex filename
37713 21992 64 59769 e979 .../tegra/tegra210-emc-cc-r21021.o

After:
text data bss dec hex filename
37539 22056 64 59659 e90b .../tegra/tegra210-emc-cc-r21021.o

Quoted 7 lines

(gcc version 10.3.0)

---
 drivers/memory/tegra/tegra210-emc-cc-r21021.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Looks good, it's too late for this cycle, so I'll take it after merge window.

Best regards,
Krzysztof

#3 lore raw
In reply to Colin King
Quoted 10 lines · Colin King

From: Colin Ian King <[email protected]>

Don't populate the array list on the stack but instead it static const. Makes the object code smaller by 110 bytes:

Before:
text data bss dec hex filename
37713 21992 64 59769 e979 .../tegra/tegra210-emc-cc-r21021.o

[...]

Applied, thanks!

[1/1] memory: tegra: make the array list static const, makes object smaller

      commit: d71b90e3633ff4af8e915ba7adc3c26f7f5edcfe

Best regards,

Signature · 1 line
Krzysztof Kozlowski <[email protected]>