Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1043953imu; Fri, 7 Dec 2018 13:10:51 -0800 (PST) X-Google-Smtp-Source: AFSGD/WrsQkEBgSrNcz1jHOB9gWoIe34z2PVVpuzhlH0FrK/qd4Wmsh9gaS410QoWfxJomumfIkK X-Received: by 2002:a17:902:bb05:: with SMTP id l5mr3691088pls.230.1544217051635; Fri, 07 Dec 2018 13:10:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544217051; cv=none; d=google.com; s=arc-20160816; b=LmGwHQ6gnD2pG0//XxK3mblstEQKbrXRIBtQtw5x0uKRvgzcHnw5iF691tvGQeJlZM pZQx8EZ0/HI3eSiw8h3UaGzfPikvliZivsK6hIhLNaWdqWhkyUapBOBLGFP/gaUhin9x 3TNtJMXRdEzNdhm+5CyJnQQMrKLp1CcSCfekyFsH8UjEvTFVm5e7AUt36aS4TrnWONEB cinjqSZJb6qHifsL1w+XvraxbxBkoq8EP4HLAn1xQpPYHwH/lZz8oc74nnwBhfrbQuA+ heX3FBZE8tDmKCR6/5nCj46vmyIA/X07UlfSrF6A20vkD0JnhWahlqRTEc2hf1GGOzuJ szkA== 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=q01LF1Vu5YVT5g6Th/6ZVqfZeF9Z6SoIVDKUnzDz6LeDfqyv5+EW7a4cyR03Tzl63I rZKVBnYiCNyCPgQ1Vd9+qoCBnCM3eo/EXpx+34M08A5l6+hcX+HxcJoKhrW1dUADl5Oa UXuCIUY4J/j00XeqP+nxQdA+3R2Lq6jVwuTqxY2j8BRbA9UlYRfj0jbpIRRzstLVYfJ4 eAnSAxMBvJBA6TGbb95kxvgkzJBDBbLhgZpVUstuMFW9nkMc3j64D+hf/jQz/y35cJE5 p1rrPL9meg2iNcg23n7Nwi5KAySdPVjLDdR64YP8v/dJ5vtIxI+a9wfCgebxXLHgI3U4 rhEA== 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 b12si3776741pls.32.2018.12.07.13.10.36; Fri, 07 Dec 2018 13:10:51 -0800 (PST) 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 S1726315AbeLGVJm (ORCPT + 99 others); Fri, 7 Dec 2018 16:09:42 -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 Content-Type: text/plain X-Originating-IP: [10.202.226.54] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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(-) 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; -- 2.7.4