Skip to contentSkip to conversation

drm/amdgpu/display: make a const array common_rates static, makes object smaller

PATCH Applied Colin King 2 participants 2 messages Jul 15, 2021

Subsystems (4)
lore
Share & tools
lore

Colin King

author
#0 lore raw

PATCH 1/1 drm/amdgpu/display: make a const array common_rates static, makes object smaller

From: Colin Ian King <[email protected]>

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

Before:
text data bss dec hex filename
268019 98322 256 366597 59805 ../display/amdgpu_dm/amdgpu_dm.o

After:
text data bss dec hex filename
267843 98418 256 366517 597b5 ../display/amdgpu_dm/amdgpu_dm.o

Reduction of 80 bytes

(gcc version 10.3.0)

---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +4 -2
index 2d48bb09645f..b196bb6eafc0 100644
@@ -7580,8 +7580,10 @@ static uint add_fs_modes(struct amdgpu_dm_connector *aconnector)
 	 * 60 	    - Commonly used
 	 * 48,72,96 - Multiples of 24
 	 */
-	const uint32_t common_rates[] = { 23976, 24000, 25000, 29970, 30000,
-					 48000, 50000, 60000, 72000, 96000 };
+	static const uint32_t common_rates[] = {
+		23976, 24000, 25000, 29970, 30000,
+		48000, 50000, 60000, 72000, 96000
+	};
 
 	/*
 	 * Find mode with highest refresh rate with the same resolution
Signature · 1 line
2.31.1
Applied
#1 lore raw
Quoted 14 lines · Colin King

From: Colin Ian King <[email protected]>

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

Before:
text data bss dec hex filename
268019 98322 256 366597 59805 ../display/amdgpu_dm/amdgpu_dm.o

After:
text data bss dec hex filename
267843 98418 256 366517 597b5 ../display/amdgpu_dm/amdgpu_dm.o

Quoted 5 lines

Reduction of 80 bytes

(gcc version 10.3.0)

Applied. Thanks!

Alex

Quoted 24 lines
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +4 -3
index 2d48bb09645f..b196bb6eafc0 100644
@@ -7580,8 +7580,10 @@ static uint add_fs_modes(struct amdgpu_dm_connector *aconnector)
         * 60       - Commonly used
         * 48,72,96 - Multiples of 24
         */
-       const uint32_t common_rates[] = { 23976, 24000, 25000, 29970, 30000,
-                                        48000, 50000, 60000, 72000, 96000 };
+       static const uint32_t common_rates[] = {
+               23976, 24000, 25000, 29970, 30000,
+               48000, 50000, 60000, 72000, 96000
+       };
 
        /*
         * Find mode with highest refresh rate with the same resolution
--

2.31.1