提交 112917c5 编写于 作者: C Colin Ian King 提交者: Yang Yingliang

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

driver inclusion
category: bugfix
bugzilla: NA
CVE: NA

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)
Signed-off-by: NColin Ian King <colin.king@canonical.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
Signed-off-by: NGuangbin Huang <huangguangbin2@huawei.com>
Reviewed-by: NPeng Li <lipeng321@huawei.com>
Reviewed-by: NZhong Zhaohui <zhongzhaohui@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 e278a917
...@@ -75,7 +75,7 @@ static bool hclgevf_cmd_csq_done(struct hclgevf_hw *hw) ...@@ -75,7 +75,7 @@ static bool hclgevf_cmd_csq_done(struct hclgevf_hw *hw)
static bool hclgevf_is_special_opcode(u16 opcode) static bool hclgevf_is_special_opcode(u16 opcode)
{ {
u16 spec_opcode[] = {0x30, 0x31, 0x32}; static const u16 spec_opcode[] = {0x30, 0x31, 0x32};
int i; int i;
for (i = 0; i < ARRAY_SIZE(spec_opcode); i++) { for (i = 0; i < ARRAY_SIZE(spec_opcode); i++) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册