Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp943519imm; Tue, 15 May 2018 11:25:11 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqBTkNWT8iKqsW7vTRej72vtkEjccGvtHc6hPKW7tGUC5AE8SXoTyyCgbOGEyuSONbILWuo X-Received: by 2002:a65:65d5:: with SMTP id y21-v6mr2075420pgv.277.1526408711583; Tue, 15 May 2018 11:25:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526408711; cv=none; d=google.com; s=arc-20160816; b=brppRijwzLfZRlRxqgJys8Ty1xfOLhjKMMJljURBtQS8AqjZNdayixDon2Kdxv0SY/ OBxuop8Aln6QZqmYp/2WSi8Fk6kDg0aGDNP1brQVIeLCUegFLMk2nn0luURIewRWhzgw LT8TdfTuiSfBJpZsPPYID6pA9XI3KWRaHsIKlA9A9+Vva8E16fZjfv8iNlJ7Oe2HTYvD 6tZQXB8t651YDgODJNCE+V8ABeRPdu5VdLXLjQpoo8BpqEja7Z7REAXgmA40Vm5AIi9x f9f2ZPTs62g+zloNhwz7HK8xZOugVtAn+dVpLO22nPtkzqalTgu8Px9jwi9sNkFX6WIA 7WnQ== 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=l2zNqHEe4cMXGDkIqDZQSJvHW+I9vdywi+t2181dG1k=; b=ti5ZYGZ5DfBuHONaGzxzw0VlN48I6v7JM5/WwH96sxmT9N/VB8bMBsD0URAVKqyABc fGjByx8MBfxT9MXBQ2QebCN/T81D++N51/r97qeVWOaZFbuj1Rjm7+hLOHNMq3SjEVBs eo6hTP7bjVwy47dJcIBBpeCZWeLHmWjeiPSvhBY7G40fzMZrpRM83AT7J832T/6iyh9z 8w2I5MAwSt3QVhfB5+5VSLLVbU4x1tkP1Vw8Uy8N49bjBm7R7Js8oyoQ9OdeMYObInzm 7HHCXO0hRgT6b7FAgCOST67nSa6nZdRXzdtZx1llJRjGX8a4hXqOv7vDhOFkTqPG9scv 4n/g== 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 y23-v6si539034pff.177.2018.05.15.11.24.57; Tue, 15 May 2018 11:25:11 -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 S1753751AbeEOSYI (ORCPT + 99 others); Tue, 15 May 2018 14:24:08 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:59458 "EHLO huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1753118AbeEOSVQ (ORCPT ); Tue, 15 May 2018 14:21:16 -0400 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id ACDF9F2EFD3C1; Wed, 16 May 2018 02:21:11 +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; Wed, 16 May 2018 02:21:07 +0800 From: Salil Mehta To: CC: , , , , , , , Fuyun Liang Subject: [PATCH net-next 04/10] net: hns3: Change return type of hnae3_register_ae_dev Date: Tue, 15 May 2018 19:20:08 +0100 Message-ID: <20180515182014.42196-5-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20180515182014.42196-1-salil.mehta@huawei.com> References: <20180515182014.42196-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: Fuyun Liang If hclge.ko has not been inserted, the value of ret always is zero in hnae3_register_ae_dev. If hclge.ko has been inserted, the value of ret is zero or non zero. Different execution ways have different results. It is confusing. The ae_dev which is initialized failed can be reinitialized when we remove hclge.ko and insert it again. For the case initializing client instance, it is just like the case initializing ae_dev. The main function of hnae3_register_ae_dev is adding the ae_dev to ad_dev list. Because adding ae_dev is always ok, we does not need to return any in this function. This patch changes the return type of hnae3_register_ae_dev from int to void. Signed-off-by: Fuyun Liang Signed-off-by: Peng Li Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hnae3.c | 5 +---- drivers/net/ethernet/hisilicon/hns3/hnae3.h | 2 +- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 4 +--- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hnae3.c b/drivers/net/ethernet/hisilicon/hns3/hnae3.c index 21cb0c5..cb93295 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hnae3.c +++ b/drivers/net/ethernet/hisilicon/hns3/hnae3.c @@ -203,7 +203,7 @@ EXPORT_SYMBOL(hnae3_unregister_ae_algo); * @ae_dev: the AE device * NOTE: the duplicated name will not be checked */ -int hnae3_register_ae_dev(struct hnae3_ae_dev *ae_dev) +void hnae3_register_ae_dev(struct hnae3_ae_dev *ae_dev) { const struct pci_device_id *id; struct hnae3_ae_algo *ae_algo; @@ -224,7 +224,6 @@ int hnae3_register_ae_dev(struct hnae3_ae_dev *ae_dev) if (!ae_dev->ops) { dev_err(&ae_dev->pdev->dev, "ae_dev ops are null\n"); - ret = -EOPNOTSUPP; goto out_err; } @@ -251,8 +250,6 @@ int hnae3_register_ae_dev(struct hnae3_ae_dev *ae_dev) out_err: mutex_unlock(&hnae3_common_lock); - - return ret; } EXPORT_SYMBOL(hnae3_register_ae_dev); diff --git a/drivers/net/ethernet/hisilicon/hns3/hnae3.h b/drivers/net/ethernet/hisilicon/hns3/hnae3.h index ffec231..ea6e6ea 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hnae3.h +++ b/drivers/net/ethernet/hisilicon/hns3/hnae3.h @@ -515,7 +515,7 @@ struct hnae3_handle { #define hnae_get_bit(origin, shift) \ hnae_get_field((origin), (0x1 << (shift)), (shift)) -int hnae3_register_ae_dev(struct hnae3_ae_dev *ae_dev); +void hnae3_register_ae_dev(struct hnae3_ae_dev *ae_dev); void hnae3_unregister_ae_dev(struct hnae3_ae_dev *ae_dev); void hnae3_unregister_ae_algo(struct hnae3_ae_algo *ae_algo); diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index af9e90f..ac75b5d 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -1576,9 +1576,7 @@ static int hns3_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ae_dev->dev_type = HNAE3_DEV_KNIC; pci_set_drvdata(pdev, ae_dev); - ret = hnae3_register_ae_dev(ae_dev); - if (ret) - return ret; + hnae3_register_ae_dev(ae_dev); if (hns3_is_phys_func(pdev) && IS_ENABLED(CONFIG_PCI_IOV)) hns3_enable_sriov(pdev); -- 2.7.4