Commit 0bc277cb authored by Colin Ian King's avatar Colin Ian King Committed by David S. Miller
Browse files

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



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

Before:
   text   data   bss     dec    hex filename
  12271   3976   128   16375   3ff7 .../hisilicon/hns3/hns3pf/hclge_cmd.o

After:
   text   data   bss     dec    hex filename
  12017   4072   128   16217   3f59 .../hisilicon/hns3/hns3pf/hclge_cmd.o

(gcc version 10.3.0)

Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 36d5825b
Loading
Loading
Loading
Loading
+13 −11
Original line number Original line Diff line number Diff line
@@ -169,7 +169,8 @@ static bool hclge_is_special_opcode(u16 opcode)
	/* these commands have several descriptors,
	/* these commands have several descriptors,
	 * and use the first one to save opcode and return value
	 * and use the first one to save opcode and return value
	 */
	 */
	u16 spec_opcode[] = {HCLGE_OPC_STATS_64_BIT,
	static const u16 spec_opcode[] = {
		HCLGE_OPC_STATS_64_BIT,
		HCLGE_OPC_STATS_32_BIT,
		HCLGE_OPC_STATS_32_BIT,
		HCLGE_OPC_STATS_MAC,
		HCLGE_OPC_STATS_MAC,
		HCLGE_OPC_STATS_MAC_ALL,
		HCLGE_OPC_STATS_MAC_ALL,
@@ -179,7 +180,8 @@ static bool hclge_is_special_opcode(u16 opcode)
		HCLGE_QUERY_CLEAR_PF_RAS_INT,
		HCLGE_QUERY_CLEAR_PF_RAS_INT,
		HCLGE_QUERY_CLEAR_ALL_MPF_MSIX_INT,
		HCLGE_QUERY_CLEAR_ALL_MPF_MSIX_INT,
		HCLGE_QUERY_CLEAR_ALL_PF_MSIX_INT,
		HCLGE_QUERY_CLEAR_ALL_PF_MSIX_INT,
			     HCLGE_QUERY_ALL_ERR_INFO};
		HCLGE_QUERY_ALL_ERR_INFO
	};
	int i;
	int i;


	for (i = 0; i < ARRAY_SIZE(spec_opcode); i++) {
	for (i = 0; i < ARRAY_SIZE(spec_opcode); i++) {