From patchwork Fri Dec 7 21:08:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 153201 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp972955ljp; Fri, 7 Dec 2018 13:09:44 -0800 (PST) X-Google-Smtp-Source: AFSGD/Uz6/ydzRCMna6fW/HU/03jSIOdzh337V6jKoCVCTdYfhy3O1tVxEMteEh/avPv+tHbPtmz X-Received: by 2002:a63:4566:: with SMTP id u38mr3316559pgk.4.1544216984322; Fri, 07 Dec 2018 13:09:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544216984; cv=none; d=google.com; s=arc-20160816; b=Sq1KIXrpLbEI4hQcmacTSUq0owy5VQybViFn0wzJPEUVNHLL1oG/FdRGMBYPlU1iQb DJOML2ArYhjPnCTLRdzvkRYlBlcJDLUzriI6SabV0dwVGsuN1salXm/wDC2QDB3XSHeX GT8v/DW6C2TjS8Dd6SQTt6zdJf9cb3X9axdYy5rx1wPHlj6OiKNV9SmMNhqCA/IZ90mQ T3zARCsDZfiEfGkpRDrRvtg/4BTb8WClT8uBoCKr2lg7NNLt3VKAQVvCPZpSOqmLnohY AAJVRA5Rnsjig8EBIYdzZ82oZjwi9HMQQN9V0S/n5TJxKMYMnh4IHmwmX9rN8O4cfoJd BFig== 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; bh=ZvwW4FyoUKM7vAhEMkaV2F2LEkz3VJw0wi8h7Bs3xzc=; b=vEXh2SSdfvT6SAmvjSmKpcxYQCeoaxpO+5v0UdmCqZv/nFGiiUs5oe8nGoODw/2RDW CCyX4wBegQnWygqPAiEnldzYBLzZDaaZ0uvV4EwQoW2XIBI6Z6DU5ds5afbCwXPojbdO J5J65GiJzVVFwNvz1qE2VoJDj8tN4vTUh+HZATy9xeaSbsJ3UQd9Xury5ZEfy7ordy60 FHmOI9lHH+xOtRRISVYvc8m2FS3WcUvDPb2HIi7Y8PpUDueqrTlpSyvBwdPG5nIi0fVJ cYPU6MgrATdK24tV/AmnqKAYd/3YqcqugOZ2cNpXfH8urHMrPfY1ICsmqUtmSFPzH+mT u9kA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-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 a20si3971060pfh.163.2018.12.07.13.09.44; Fri, 07 Dec 2018 13:09:44 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of netdev-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 netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726308AbeLGVJl (ORCPT + 10 others); Fri, 7 Dec 2018 16:09:41 -0500 Received: from szxga07-in.huawei.com ([45.249.212.35]:59891 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726135AbeLGVJi (ORCPT ); Fri, 7 Dec 2018 16:09:38 -0500 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 44F367B14CDFF; Sat, 8 Dec 2018 05:09:35 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.202.226.54) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.408.0; Sat, 8 Dec 2018 05:09:27 +0800 From: Salil Mehta To: CC: , , , , , , , Shiju Jose Subject: [PATCH net-next 06/14] net: hns3: add optimization in the hclge_hw_error_set_state Date: Fri, 7 Dec 2018 21:08:03 +0000 Message-ID: <20181207210811.23844-7-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20181207210811.23844-1-salil.mehta@huawei.com> References: <20181207210811.23844-1-salil.mehta@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.202.226.54] X-CFilter-Loop: Reflected Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Shiju Jose 1. This patch adds minor loop optimization in the hclge_hw_error_set_state function. 2. Adds logging module's name if it fails to configure the error interrupts. Signed-off-by: Shiju Jose Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) -- 2.7.4 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c index 2d07be8..d1c9f7a 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c @@ -586,18 +586,16 @@ static const struct hclge_hw_blk hw_blk[] = { int hclge_hw_error_set_state(struct hclge_dev *hdev, bool state) { + const struct hclge_hw_blk *module = hw_blk; int ret = 0; - int i = 0; - while (hw_blk[i].name) { - if (!hw_blk[i].config_err_int) { - i++; - continue; + while (module->name) { + if (module->config_err_int) { + ret = module->config_err_int(hdev, state); + if (ret) + return ret; } - ret = hw_blk[i].config_err_int(hdev, state); - if (ret) - return ret; - i++; + module++; } return ret;