From patchwork Sat May 19 15:53:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 136398 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp2545951lji; Sat, 19 May 2018 08:55:03 -0700 (PDT) X-Google-Smtp-Source: AB8JxZo9KWM8UT+NKuxzzqWCUamhjAkKc+RcziUOpFGJjA4geKa6cn5JusE4Wz8wDDFKspaf2+zz X-Received: by 2002:a63:b107:: with SMTP id r7-v6mr2895113pgf.167.1526745303718; Sat, 19 May 2018 08:55:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526745303; cv=none; d=google.com; s=arc-20160816; b=BMl2qLldHBfGzZeLFUZXLp0H3Nv7VNqOUK7YKGWYM7Xrq0dbabfSRlV5AsSNXnW8eQ jNb4E5PgG10b7VcBIi08ZfSmaD4E4QGLMzSYnrymJiaEsX685AMEnNh1/J70snQ+Obd9 oUYuSAwfwC1CtAYakaP9sRf25pfhc3Jw0dX9isYuhcCZqvzT2Db6e2Q2oBA3+joBzBSb 0ttyyixvVtambidEccXzDMXWGxNuKJ8Jkrn+8fIqs16+mSx/3qWn8XQ5xLDF+6CmjNSm 8XbX0AQGLofwTdPxXLN5oaECbvN2AacUs/mQAZ+izwC4sagLNBNeg18KnPdKjudgpVMg PGvA== 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 bd8-v6si9231723plb.559.2018.05.19.08.55.03; Sat, 19 May 2018 08:55:03 -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 S1752657AbeESPzA (ORCPT + 29 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 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(-) -- 2.7.4 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++) {