From patchwork Mon Sep 3 10:21:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 145775 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp2313245ljw; Mon, 3 Sep 2018 03:23:15 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbSzfcXtu01LVEqQEL5502cyCEm6tAlxotVkbcVNyw4kMzLJynosTNfql4UNTDBTAvePu2t X-Received: by 2002:a17:902:9302:: with SMTP id bc2-v6mr28165441plb.280.1535970195424; Mon, 03 Sep 2018 03:23:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535970195; cv=none; d=google.com; s=arc-20160816; b=utUS5co7iAMBxdYtoyU4+WI8hz8xRfa26m4YOVT5W6XxUX7TkEYBzXIXyty08ZlfN0 1MVPW70NHbk4W56enrSnGrT3uEvtUxFeRCI3by7KH/F/gjHMPhgyXdKF02kVzlOT+3V4 LdyP3qqpx09qvU/W/Yk0IHzZOdk4SmsuA01j/iWzfItcihVWnRZaV8jNCqwBii/EnAHR WQ3gsmVy3jvGy9cztl7qKYqlwPOpC0aFYVy1OsYfiOyXpJHJaKOiU4pxJ9Lp7nLinPf6 5WjJ8RJ/sLGLvE/ZEE5HHD+7EbaAzCjdqgRsNzTI0F6rYbQf8QGhf27Uud4LQvId/q1m E2/g== 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=gTyCvuocfaK/YpeNYTmQhxrfnavVUY0AtD9av/1pXJ4=; b=hy526ofsFrIjT+/Jz2UHc2mTGXupEfhU5LXJOZio2h9uV/uPvT4OoICSKGe325bxIu 2TdZE+dLOM9G8QCiKsTz9H0fkTyDtrogf09PuOTk8nmK+pxSnMcyI4TgVHicLNCriPxL O/qzax508nsh8Q/KtyvypN8CQIb7kFfzQ8u3RW8YWowTCChmnKl/vb0PM0DuUOdh/+He Q/yegWPKSFhiFxzqCmsAfB/pVqHRRfNxmx7pelCsv5lf5KKyATZ4XJOYHApOFRjy8bDX YV65CNbwAUaS8hhWqU43GQoMvcALdCb5lN80meYJD/D+PW9YLhO7G1Zm/JDsa9nBMWiZ 5zqQ== 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 d36-v6si17165097pgl.148.2018.09.03.03.23.15; Mon, 03 Sep 2018 03:23:15 -0700 (PDT) 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 S1727284AbeICOmn (ORCPT + 10 others); Mon, 3 Sep 2018 10:42:43 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:51554 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726039AbeICOmn (ORCPT ); Mon, 3 Sep 2018 10:42:43 -0400 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id BF822107FDD95; Mon, 3 Sep 2018 18:23:09 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.202.226.54) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.399.0; Mon, 3 Sep 2018 18:23:00 +0800 From: Salil Mehta To: CC: , , , , , , , Yunsheng Lin Subject: [PATCH net-next 04/11] net: hns3: Implement shutdown ops in hns3 pci driver Date: Mon, 3 Sep 2018 11:21:49 +0100 Message-ID: <20180903102156.18676-5-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20180903102156.18676-1-salil.mehta@huawei.com> References: <20180903102156.18676-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: Yunsheng Lin This patch implements shutdown ops in hns3 pci driver, which unloads the hns3 driver and set the power state to D3hot. Signed-off-by: Yunsheng Lin Signed-off-by: Peng Li Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) -- 2.7.4 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index 955c4ab..75e8ee9 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -1662,11 +1662,24 @@ static int hns3_pci_sriov_configure(struct pci_dev *pdev, int num_vfs) return 0; } +static void hns3_shutdown(struct pci_dev *pdev) +{ + struct hnae3_ae_dev *ae_dev = pci_get_drvdata(pdev); + + hnae3_unregister_ae_dev(ae_dev); + devm_kfree(&pdev->dev, ae_dev); + pci_set_drvdata(pdev, NULL); + + if (system_state == SYSTEM_POWER_OFF) + pci_set_power_state(pdev, PCI_D3hot); +} + static struct pci_driver hns3_driver = { .name = hns3_driver_name, .id_table = hns3_pci_tbl, .probe = hns3_probe, .remove = hns3_remove, + .shutdown = hns3_shutdown, .sriov_configure = hns3_pci_sriov_configure, };