Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1548151imm; Mon, 3 Sep 2018 03:25:58 -0700 (PDT) X-Google-Smtp-Source: ANB0Vda8ZmQAnc1SxLTQGJ/ib5bPajLahI0AMezQ0YbfCcAA7IZDHZmtyTlBengBVe11ioTnYNDV X-Received: by 2002:a62:c805:: with SMTP id z5-v6mr29059280pff.44.1535970358783; Mon, 03 Sep 2018 03:25:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535970358; cv=none; d=google.com; s=arc-20160816; b=GzsiAz7m/n91RabppzRnK8UmNjg7F1o6dhbeWD1cAbI+71Rm8wAyUU0aP1vyICR+JQ VyX+n30+6DA7TMwjsUrclOFjMBQG46uT8i+GgnNlCfMnfy1yx6AxC58H7BZqXF31sXqZ XFS6PqA2d5Y6Q2wM6bXkyYS4R/9kqpGe4XZi98j551jAioHElIAGQMkkB9Qbo0+p6Ox6 nV11AzQ4kbkMYxrFTKf45vpPu+/hFISFarwkA5+z2H0T0i8lgsgJsxWDdrcwbnp4fq7g 7eJZQ9BC/uiS29Tf+rxonqiG+7ClassbZJ3LKlrnmVVwuzMVDkDDpE8CghF7VP0bMB+D XFSQ== 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=ZOOwGDuGfCVkU6K8+nCWimRTqZKvsRIGAbGK7RuefnY78Utd5ci9JIohLM7z9o1PnU Icq11CBLZYLvF8hEKavEiVZqqKkNUL3pd8uWn/DiR5dCdsBsDy1xpA+I8bmxwkbqy/u4 pUVv2rKEOxuWyy3ZgcrXpSoqrc/2+X9IkW1ZcIV1gIQPaAGe1Qb3FtToKkMdk0BVVzPD OWPfO9MrWqRH+Jwu7J/tC1W0Ysrlnj6fSQGX7GI85ySkPv0P4XpXhbVErtKX0jaXa6X2 Bwo379TSYsoLYhXkbdcXc/iewynHFpkDbJzl8ItbXB6op+F0Wi8F5tBTalHmJsaZJ48G t2xQ== 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 d24-v6si17659608pls.477.2018.09.03.03.25.44; Mon, 03 Sep 2018 03:25:58 -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 S1727852AbeICOmo (ORCPT + 99 others); Mon, 3 Sep 2018 10:42:44 -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 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: 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(+) 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, }; -- 2.7.4