Skip to contentSkip to conversation

drm/nouveau/bios/dp: make array vsoff static, shrinks object size

PATCH In review Colin King 2 participants 3 messages Sep 4, 2018 – Jan 24, 2019

Subsystems (4)
lore
Share & tools
lore

Colin King

author
#0 lore raw

PATCH 1/1 drm/nouveau/bios/dp: make array vsoff static, shrinks object size

From: Colin Ian King <[email protected]>

Don't populate the array vsoff on the stack but instead make it static. Makes the object code smaller by 67 bytes:

Before:
text data bss dec hex filename
5753 112 0 5865 16e9 .../nouveau/nvkm/subdev/bios/dp.o

After:
text data bss dec hex filename
5622 176 0 5798 16a6 .../nouveau/nvkm/subdev/bios/dp.o

(gcc version 8.2.0 x86_64)

---
 drivers/gpu/drm/nouveau/nvkm/subdev/bios/dp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nvkm/subdev/bios/dp.c +1 -1
index 3133b28f849c..b099d1209be8 100644
@@ -212,7 +212,7 @@ nvbios_dpcfg_match(struct nvkm_bios *bios, u16 outp, u8 pc, u8 vs, u8 pe,
 	u16 data;
 
 	if (*ver >= 0x30) {
-		const u8 vsoff[] = { 0, 4, 7, 9 };
+		static const u8 vsoff[] = { 0, 4, 7, 9 };
 		idx = (pc * 10) + vsoff[vs] + pe;
 		if (*ver >= 0x40 && *ver <= 0x41 && *hdr >= 0x12)
 			idx += nvbios_rd08(bios, outp + 0x11) * 40;
Signature · 6 lines
2.17.1

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau
#1 lore raw

ping?

Quoted 34 lines · Colin King

From: Colin Ian King <[email protected]>

Don't populate the array vsoff on the stack but instead make it static. Makes the object code smaller by 67 bytes:

Before:
text data bss dec hex filename
5753 112 0 5865 16e9 .../nouveau/nvkm/subdev/bios/dp.o

After:
text data bss dec hex filename
5622 176 0 5798 16a6 .../nouveau/nvkm/subdev/bios/dp.o

(gcc version 8.2.0 x86_64)

---
 drivers/gpu/drm/nouveau/nvkm/subdev/bios/dp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nvkm/subdev/bios/dp.c +1 -1
index 3133b28f849c..b099d1209be8 100644
@@ -212,7 +212,7 @@ nvbios_dpcfg_match(struct nvkm_bios *bios, u16 outp, u8 pc, u8 vs, u8 pe,
 	u16 data;
 
 	if (*ver >= 0x30) {
-		const u8 vsoff[] = { 0, 4, 7, 9 };
+		static const u8 vsoff[] = { 0, 4, 7, 9 };
 		idx = (pc * 10) + vsoff[vs] + pe;
 		if (*ver >= 0x40 && *ver <= 0x41 && *hdr >= 0x12)
 			idx += nvbios_rd08(bios, outp + 0x11) * 40;
#2 lore raw
Quoted 2 lines · Colin Ian King

ping?

I've pushed this, and the others you pinged about, to my tree.

Thank you,
Ben.

Quoted 37 lines · Colin King
Quoted 34 lines

From: Colin Ian King <[email protected]>

Don't populate the array vsoff on the stack but instead make it static. Makes the object code smaller by 67 bytes:

Before:
text data bss dec hex filename
5753 112 0 5865 16e9 .../nouveau/nvkm/subdev/bios/dp.o

After:
text data bss dec hex filename
5622 176 0 5798 16a6 .../nouveau/nvkm/subdev/bios/dp.o

(gcc version 8.2.0 x86_64)

---
 drivers/gpu/drm/nouveau/nvkm/subdev/bios/dp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nvkm/subdev/bios/dp.c +1 -1
index 3133b28f849c..b099d1209be8 100644
@@ -212,7 +212,7 @@ nvbios_dpcfg_match(struct nvkm_bios *bios, u16 outp, u8 pc, u8 vs, u8 pe,
      u16 data;
 
      if (*ver >= 0x30) {
-             const u8 vsoff[] = { 0, 4, 7, 9 };
+             static const u8 vsoff[] = { 0, 4, 7, 9 };
              idx = (pc * 10) + vsoff[vs] + pe;
              if (*ver >= 0x40 && *ver <= 0x41 && *hdr >= 0x12)
                      idx += nvbios_rd08(bios, outp + 0x11) * 40;