]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
net: hns3: Use enums instead of magic number in hclge_is_special_opcode
authorHuazhong Tan <tanhuazhong@huawei.com>
Sat, 19 May 2018 15:53:20 +0000 (16:53 +0100)
committerKhalid Elmously <khalid.elmously@canonical.com>
Wed, 6 Jun 2018 18:41:10 +0000 (14:41 -0400)
BugLink: https://bugs.launchpad.net/bugs/1768670
This patch does bit of a clean-up by using already defined enums for
certain values in function hclge_is_special_opcode(). Below enums from
have been used as replacements for magic values:

enum hclge_opcode_type{
<snip>
HCLGE_OPC_STATS_64_BIT = 0x0030,
HCLGE_OPC_STATS_32_BIT = 0x0031,
HCLGE_OPC_STATS_MAC = 0x0032,
<snip>
};

Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 42687543ca18c106ffd562b40199bd31ab3a347a linux-next)
Signed-off-by: dann frazier <dann.frazier@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c

index fab70683bbf786ff54bb702490a4ad9ccbe281f4..59fb0eb755e7ddcc7206e9f20fe6b81327da5295 100644 (file)
@@ -190,7 +190,11 @@ static int hclge_cmd_csq_done(struct hclge_hw *hw)
 
 static bool hclge_is_special_opcode(u16 opcode)
 {
-       u16 spec_opcode[3] = {0x0030, 0x0031, 0x0032};
+       /* these commands have several descriptors,
+        * and use the first one to save opcode and return value
+        */
+       u16 spec_opcode[3] = {HCLGE_OPC_STATS_64_BIT,
+               HCLGE_OPC_STATS_32_BIT, HCLGE_OPC_STATS_MAC};
        int i;
 
        for (i = 0; i < ARRAY_SIZE(spec_opcode); i++) {