Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp601962ybt; Wed, 1 Jul 2020 06:03:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxWSzFiIwV25eV9+u6O1aK4ji4eSyz4NMObpZXDYJYDtKYFIx5xaHr7c9upMBgZGnqwwUJJ X-Received: by 2002:a17:906:456:: with SMTP id e22mr17469598eja.178.1593608635891; Wed, 01 Jul 2020 06:03:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593608635; cv=none; d=google.com; s=arc-20160816; b=Jq+JgUDC++51sLW1EelLbNaQz/Q9nD7fsRd/V/nNNC19B/sEiA6i0DyrQW5G3oyaKW Zv9Wxg18d9G3GkCCsz6KhRJcXrhRANQE3pkEMyZu/isdLbM4WudOn5I/uMIxz1ZbxAA1 UbeMWd69PSV3vDOwskpwWBNpFt9sMbvWxrQ1ptVfyDzp3c3BBP7UdEuPG2aoqhEfCB/y G31l/Vx8ong7UUQtKz8nt1/Y3PbCz+BnUnWFQqQ+aqUSn5Qr4vNn9I8nCqYxy19C9y/r Ssay60qncmzfn6WtGO4820b3dZGriAzpVkFGPaXy/bF4nCOD2Uf1o7tI/P8JcoVxLfNQ 9WkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=YSd7xHW0v3feamfrhjVTkN6nApBkwLgvxLmLLLtPadE=; b=hB2nlemHceBj/5ErZKkbOtaYySMIWprAirCqa+5a9mmuSuFyBzLGPtZPwroDA3nxTS lhPcjFClhqV/kpzS9t+VBEvW28Ddk4cWUkV6PE5bvlBTGX88DPnqv1RXYMQH6JMuQkS8 waILUDnF2kXyjgQ5xDGhhMNYLeW4Qp4bxFFRtiooaNcKdzFYxE5DDXDuFo9Ubb8HjGEb r6AnyTk+DstE9M4YG9CydKAmtLWkNY4k/On/kJC/UpBdZgplQb2JxnwazXr0zoIhJllc RXCpJx6egK+6CXzCMkOl8la1WBuPU84aN4tt4HEQs0awkQZW0ReBh80CrtKYs1BCxiii 7Saw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=nTrFLI6W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v13si3716982ejw.696.2020.07.01.06.03.31; Wed, 01 Jul 2020 06:03:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=nTrFLI6W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730896AbgGANCf (ORCPT + 99 others); Wed, 1 Jul 2020 09:02:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730744AbgGANCc (ORCPT ); Wed, 1 Jul 2020 09:02:32 -0400 Received: from mail-pj1-x1044.google.com (mail-pj1-x1044.google.com [IPv6:2607:f8b0:4864:20::1044]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6DDC5C03E97A; Wed, 1 Jul 2020 06:02:32 -0700 (PDT) Received: by mail-pj1-x1044.google.com with SMTP id k71so7451348pje.0; Wed, 01 Jul 2020 06:02:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=YSd7xHW0v3feamfrhjVTkN6nApBkwLgvxLmLLLtPadE=; b=nTrFLI6WYPLCwU+CrpdvrfX0LvHTn+t2U+SbMCIPRJo5YaVA+nZawFfgZKvHpRlOY3 RgnBWR1zPzroXhIhzFVBSdQa+nvUFuYTz8AVEcCx1FJ8aV5n+Xo7VXrTpX68uVnjJlcx zNmeFJTkwyw8PXrmXvP1i/yqs9gk6wj3OdWm3ZAmPkrQ7/dMYUiz8S73V5dXZuzKiz6X BjEc+1R7y6DpQeltscfbnMbFZu5TdjND1EdOUNSOTukPGGzQPI9/kMkH1AxlT2chzZ4z D2q/ZWBsu7xwEsaXuctpy61YwNnO7qJvhWtzuPmcbmGXtsxDSLv0gUObspK7oSPVt5zG 1zzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=YSd7xHW0v3feamfrhjVTkN6nApBkwLgvxLmLLLtPadE=; b=JHS2B7+8rvfUjMRA9SShypWX5JaWSU8jtlhUntiGK91N8D0CQxYSg2WAqBg3I7OfGQ yguItRhVaZe3FqkQM35XUxYZ6VA/qrm0ewHZfDN5oXcbVkea2LjUYeyV5hfMaR73e6xh YXUrTUb8Dgsfygy6w0Y5X7bCFrRjRMMFQ6ZgjcHXO24cewB7LlhqVDzwUVaBrAk4R1uR n+ViYBnpkr9INI3Ijjsuity5y3pVh9BtULOqFgYtgUX1TWpGO/jF/WYL/uZbWIODe9dW CuHR1ztWMaB7vPmPS5AjRN1+SiHsCClhH7OFpAgpn5mCJCtMBjwW2B0ywyLDv8vt8exx Ygvg== X-Gm-Message-State: AOAM533idjxbg2rCwcPTPxU30h+Ao7wypx95Cws3IZfYuhgvQ8l201se mcxUYjF+HmhLXn9laAfXMB8= X-Received: by 2002:a17:902:26f:: with SMTP id 102mr21561130plc.226.1593608551872; Wed, 01 Jul 2020 06:02:31 -0700 (PDT) Received: from varodek.iballbatonwifi.com ([103.105.153.57]) by smtp.gmail.com with ESMTPSA id d9sm6070908pgv.45.2020.07.01.06.02.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jul 2020 06:02:31 -0700 (PDT) From: Vaibhav Gupta To: Bjorn Helgaas , Bjorn Helgaas , bjorn@helgaas.com, Vaibhav Gupta , "David S. Miller" , Jakub Kicinski , David Dillow , Ion Badulescu , Netanel Belgazal , Arthur Kiyanovski , Guy Tzalik , Saeed Bishara , Zorik Machulsky , Derek Chickles , Satanand Burla , Felix Manlunas , Denis Kirjanov , Ajit Khaparde , Sriharsha Basavapatna , Somnath Kotur , Tariq Toukan , Jon Mason Cc: Vaibhav Gupta , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org, skhan@linuxfoundation.org Subject: [PATCH v1 04/11] ena_netdev: use generic power management Date: Wed, 1 Jul 2020 18:29:31 +0530 Message-Id: <20200701125938.639447-5-vaibhavgupta40@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200701125938.639447-1-vaibhavgupta40@gmail.com> References: <20200701125938.639447-1-vaibhavgupta40@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org With legacy PM, drivers themselves were responsible for managing the device's power states and takes care of register states. After upgrading to the generic structure, PCI core will take care of required tasks and drivers should do only device-specific operations. Compile-tested only. Signed-off-by: Vaibhav Gupta --- drivers/net/ethernet/amazon/ena/ena_netdev.c | 21 ++++++++------------ 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c index dda4b8fc9525..92e6d244550c 100644 --- a/drivers/net/ethernet/amazon/ena/ena_netdev.c +++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c @@ -4420,13 +4420,12 @@ static void ena_shutdown(struct pci_dev *pdev) __ena_shutoff(pdev, true); } -#ifdef CONFIG_PM /* ena_suspend - PM suspend callback - * @pdev: PCI device information struct - * @state:power state + * @dev_d: Device information struct */ -static int ena_suspend(struct pci_dev *pdev, pm_message_t state) +static int __maybe_unused ena_suspend(struct device *dev_d) { + struct pci_dev *pdev = to_pci_dev(dev_d); struct ena_adapter *adapter = pci_get_drvdata(pdev); u64_stats_update_begin(&adapter->syncp); @@ -4445,12 +4444,11 @@ static int ena_suspend(struct pci_dev *pdev, pm_message_t state) } /* ena_resume - PM resume callback - * @pdev: PCI device information struct - * + * @dev_d: Device information struct */ -static int ena_resume(struct pci_dev *pdev) +static int __maybe_unused ena_resume(struct device *dev_d) { - struct ena_adapter *adapter = pci_get_drvdata(pdev); + struct ena_adapter *adapter = dev_get_drvdata(dev_d); int rc; u64_stats_update_begin(&adapter->syncp); @@ -4462,7 +4460,8 @@ static int ena_resume(struct pci_dev *pdev) rtnl_unlock(); return rc; } -#endif + +static SIMPLE_DEV_PM_OPS(ena_pm_ops, ena_suspend, ena_resume); static struct pci_driver ena_pci_driver = { .name = DRV_MODULE_NAME, @@ -4470,10 +4469,6 @@ static struct pci_driver ena_pci_driver = { .probe = ena_probe, .remove = ena_remove, .shutdown = ena_shutdown, -#ifdef CONFIG_PM - .suspend = ena_suspend, - .resume = ena_resume, -#endif .sriov_configure = pci_sriov_configure_simple, }; -- 2.27.0