Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp5754031imm; Sat, 19 May 2018 08:56:12 -0700 (PDT) X-Google-Smtp-Source: AB8JxZp1xvvEMdEOw1PJ+uDDFwUpieHqWVUMYA6Hb9cnvKP49drOap8KpBkmqcf7HTjJzCNBgYPo X-Received: by 2002:a65:52c8:: with SMTP id z8-v6mr10972672pgp.46.1526745372182; Sat, 19 May 2018 08:56:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526745372; cv=none; d=google.com; s=arc-20160816; b=fRSHWNmJsKQpY6c23qhSJRShG09/BjxjN8s+akzRGlAgH8NDEh7smbykJP4nSDvo3N IlT7MEmMoY/BEU4EpdtJ95xYYcigKwaYi6E/4NRWmPDODhlW2uU8ROZIhfeChzXc3eZA Yn/xOuwima+bl8zn7pmT1AOmuOuKYd6Db6SuL9l+jHal80RbO5CW9NPgdttk2HG9YAJj TcnIZJxNUYGRwxVLjBXHQocqNKZXLwUiD/bIHPWr5c3NY1fP+CAAmGRuoqV2jhVaUguq FgIxmKrfhCtzPQyoRbWVMDMnGZUFCyg9vISlTakBAIEJVFMe2dKoCdeRSuhzgmCTLMVg ty8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=4IXAskoDb9LShS6f89w9gJ96PZf5B94tm/6jkpIZCkk=; b=dupSf4/5XeRPfbX/uUl7fPZqVkwZqqp57s0sQ00YZuFtJg32RH3V3xJdh4nr1vguf3 PZwkKy/oVAmBElASnLzyVrjVHRCVCFplc8K72RZNwc8cRzWtjDKCFk4nK4VWVqMGXemc kG9mjspuF9F+HFRoJEarrikRvujVg9fqI7TmzaO9FHzm0nGhP6ioqdgusH/NGwkketJc uS4weYAJb3mW9lRt5sCqKGDiQi0iUxDp0XNglrNgLj3sbb2IAI4KRyj6uY2qbdigNPMS AbYO/9PIjRXaRoSx2TAIeeSPAb99B5H863bLMjtGxHPmSPRCUJSdB6x8EH9ogZhIiFme J1eg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q12-v6si7446019pgn.377.2018.05.19.08.55.57; Sat, 19 May 2018 08:56:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752647AbeESPzA (ORCPT + 99 others); Sat, 19 May 2018 11:55:00 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:7708 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752586AbeESPy4 (ORCPT ); Sat, 19 May 2018 11:54:56 -0400 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id A3147C8C1983A; Sat, 19 May 2018 23:54:37 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.202.227.234) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.382.0; Sat, 19 May 2018 23:54:32 +0800 From: Salil Mehta To: CC: , , , , , , , Huazhong Tan Subject: [PATCH net-next 6/9] net: hns3: Use enums instead of magic number in hclge_is_special_opcode Date: Sat, 19 May 2018 16:53:20 +0100 Message-ID: <20180519155323.68960-7-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20180519155323.68960-1-salil.mehta@huawei.com> References: <20180519155323.68960-1-salil.mehta@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.202.227.234] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Huazhong Tan 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{ HCLGE_OPC_STATS_64_BIT = 0x0030, HCLGE_OPC_STATS_32_BIT = 0x0031, HCLGE_OPC_STATS_MAC = 0x0032, }; Signed-off-by: Huazhong Tan Signed-off-by: Peng Li Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c index fab7068..59fb0eb 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c @@ -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++) { -- 2.7.4