Skip to contentSkip to conversation

net: hns3: make array spec_opcode static const, makes object smaller

PATCH Applied Colin King 2 participants 2 messages Sep 6, 2019 – Sep 7, 2019

Subsystems (5)
lore
Share & tools
lore

Colin King

author
#0 lore raw

PATCH 1/1 net: hns3: make array spec_opcode static const, makes object smaller

From: Colin Ian King <[email protected]>

Don't populate the array spec_opcode on the stack but instead make it static const. Makes the object code smaller by 48 bytes.

Before:

   text	   data	    bss	    dec	    hex	filename
   6914	   1040	    128	   8082	   1f92	hns3/hns3vf/hclgevf_cmd.o

After:

   text	   data	    bss	    dec	    hex	filename
   6866	   1040	    128	   8034	   1f62	hns3/hns3vf/hclgevf_cmd.o

(gcc version 9.2.1, amd64)

---
 drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_cmd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_cmd.c +1 -1
index 4c2c9458648f..d5d1cc5d1b6e 100644
@@ -74,7 +74,7 @@ static bool hclgevf_cmd_csq_done(struct hclgevf_hw *hw)
 
 static bool hclgevf_is_special_opcode(u16 opcode)
 {
-	u16 spec_opcode[] = {0x30, 0x31, 0x32};
+	static const u16 spec_opcode[] = {0x30, 0x31, 0x32};
 	int i;
 
 	for (i = 0; i < ARRAY_SIZE(spec_opcode); i++) {
Signature · 1 line
2.20.1
maintainer Applied
#1 lore raw

From: Colin King <[email protected]>
Date: Fri, 6 Sep 2019 12:28:04 +0100

Quoted 9 lines

From: Colin Ian King <[email protected]>

Don't populate the array spec_opcode on the stack but instead make it static const. Makes the object code smaller by 48 bytes.

Before:

   text	   data	    bss	    dec	    hex	filename
   6914	   1040	    128	   8082	   1f92	hns3/hns3vf/hclgevf_cmd.o
Quoted 7 lines

After:

   text	   data	    bss	    dec	    hex	filename
   6866	   1040	    128	   8034	   1f62	hns3/hns3vf/hclgevf_cmd.o

(gcc version 9.2.1, amd64)

Applied.