Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp784145ybt; Wed, 1 Jul 2020 09:54:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQFPoRiyial6BE1U0Lb6buql/4pGGNbrfm/zqFOPcjrsbOWb6Tg1biA8KGpLbpZRwhqBMs X-Received: by 2002:a17:906:5418:: with SMTP id q24mr23442775ejo.266.1593622440715; Wed, 01 Jul 2020 09:54:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593622440; cv=none; d=google.com; s=arc-20160816; b=BVlPa2djs8N2/d51gWlw8TQGvYRtClQEkdH+bcUyz4EBXfvBUXiwSKlnFgWC50fk/Q 9+tLJNPfeCQdyyR3vxmnsUE5tzJBw+ts0iM9bazW7lgggGXHdu1Ts1kIQ6L/fOarpp0E RPy0KdEN9QzXWrCh61/92FbLZ7SSjgrGtNgLTUm06GbjYTo9efZO10rR2fVpVsPCTTuo OsY6TvLI06bRf1LFoA8RMpZb4D147ytE1cpX+oKbCK3wsRsBL90IZSyo2m+TnZ/wJwHd QLrbBb/UnjrNvuvL/JiSsE2TziXEznuNFXlr/OI9MvPj+6jD3YBguLVDZFqD5xGTyXsV l+Kw== 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=QuyL93xGAaaNSghhFPwjm3/FQ7kS7DpgB2p+k7g93Fg=; b=mYVYA0za6rylmhUPlO8dY12RtkF8gjacIFfWR1dxllLWEO56kbt8CRfOcqSgsD25Ej xcoeTQmJvgQGmdXwCBYhco3iCB8bHyM+yKWwmYJ2olTPSFtDuJywpBD/lC1m0qUdyv2i 6Xb6Wvc2O9XNfjAcaiM1ey6gl7ahGd6CXiXRQ6BLHP4eDEzqpvLRkG61pydowucFfbVT x1dQ0xm8K1hu5grJykeR0yzMRtpE//FwUr5fZQI19vgyG4q3mtkoEA4Jqh3PHdbElp6N DJHC6MDkigUJMM0FMV8FWICl7hSQkYcgZaDmoZSnBWgErESiiQWEv4cSvB0VhFxzd9AT 1jZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="U+q/ChJ3"; 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 dt4si4888115ejc.34.2020.07.01.09.53.37; Wed, 01 Jul 2020 09:54:00 -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="U+q/ChJ3"; 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 S1732651AbgGAQwz (ORCPT + 99 others); Wed, 1 Jul 2020 12:52:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732632AbgGAQwy (ORCPT ); Wed, 1 Jul 2020 12:52:54 -0400 Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C364DC08C5DB; Wed, 1 Jul 2020 09:52:54 -0700 (PDT) Received: by mail-pg1-x543.google.com with SMTP id o13so9034235pgf.0; Wed, 01 Jul 2020 09:52:54 -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=QuyL93xGAaaNSghhFPwjm3/FQ7kS7DpgB2p+k7g93Fg=; b=U+q/ChJ32SvosX5d+vZSvkbJyN6RbExhvMW0WqpXuca3Dk8sqCyku+OZTzx+xDBP0l MxXRpkUNg9iKpt6NFlNI2vq8gipOICMkOFe6Yw5PcOvlg7FoPkg0I1OgB8lp1Gdi9KxB PbALlHFmRw4q4H9IVleJSSwR7AfVgNlCw794ru1r7JGI8A9pErfQQmxeOfoBlEsSnL8I jxrjHieyS39m7ISSuSPfy2WKmSvEeGeueEn8LpjKCpavxy+7XWtFI007+Ht7Ei/Im6+d Q2rxrMZIV3N1AhcGBKL1b50zSglv0D16XzpDLA4H5g8HMWe+gdZdfC0BGuX23i3A0jNz JO+w== 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=QuyL93xGAaaNSghhFPwjm3/FQ7kS7DpgB2p+k7g93Fg=; b=GQmxVi+jUEGDBNylVTogz2vIx6GB0nG2gHPvjVfy5tE1zV6N3Lh1cgR6yxxkLM53uS TzZKRUK0dzVl80ygK+fwA8boxfebsN7zTWSL7mMdP6CFecbJQYEjmDRAWQKkHDQ2+5fz v67gLWVQhZ3LsFLPCmu0pt3VtKjc4Y2OWxczSWAAM6br6rfuiJ6GsYa+yVoscSj8GsxZ pQrOpVv5piazt7FQgb7Wfz5OVInpAMiTTZ6YcotyZtv5jVtq4r6Yl5CLiBjFU7JbY2DA Cn9Rc1oDycP95s2txptGaUUG7+7ha+2wACjUf2o3ofqZwqKDJr+RSdMcRuMzplysSTVX jvSw== X-Gm-Message-State: AOAM530lvElm2EGbR2YibOOV/N/N+aHscvxBc+UyG1cv6KQMWNGNT/GB vOmrWvLpkIMUJmDB8sjL3bM= X-Received: by 2002:a63:495c:: with SMTP id y28mr21000872pgk.30.1593622372580; Wed, 01 Jul 2020 09:52:52 -0700 (PDT) Received: from varodek.iballbatonwifi.com ([103.105.153.57]) by smtp.gmail.com with ESMTPSA id g140sm6297437pfb.48.2020.07.01.09.52.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jul 2020 09:52:52 -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 v2 03/11] starfire: use generic power management Date: Wed, 1 Jul 2020 22:20:49 +0530 Message-Id: <20200701165057.667799-4-vaibhavgupta40@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200701165057.667799-1-vaibhavgupta40@gmail.com> References: <20200701165057.667799-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. Thus, there is no need to call the PCI helper functions like pci_save/restore_sate() and pci_set_power_state(). Compile-tested only. Signed-off-by: Vaibhav Gupta --- drivers/net/ethernet/adaptec/starfire.c | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/drivers/net/ethernet/adaptec/starfire.c b/drivers/net/ethernet/adaptec/starfire.c index a64191fc2af9..ba0055bb1614 100644 --- a/drivers/net/ethernet/adaptec/starfire.c +++ b/drivers/net/ethernet/adaptec/starfire.c @@ -1984,28 +1984,21 @@ static int netdev_close(struct net_device *dev) return 0; } -#ifdef CONFIG_PM -static int starfire_suspend(struct pci_dev *pdev, pm_message_t state) +static int __maybe_unused starfire_suspend(struct device *dev_d) { - struct net_device *dev = pci_get_drvdata(pdev); + struct net_device *dev = dev_get_drvdata(dev_d); if (netif_running(dev)) { netif_device_detach(dev); netdev_close(dev); } - pci_save_state(pdev); - pci_set_power_state(pdev, pci_choose_state(pdev,state)); - return 0; } -static int starfire_resume(struct pci_dev *pdev) +static int __maybe_unused starfire_resume(struct device *dev_d) { - struct net_device *dev = pci_get_drvdata(pdev); - - pci_set_power_state(pdev, PCI_D0); - pci_restore_state(pdev); + struct net_device *dev = dev_get_drvdata(dev_d); if (netif_running(dev)) { netdev_open(dev); @@ -2014,8 +2007,6 @@ static int starfire_resume(struct pci_dev *pdev) return 0; } -#endif /* CONFIG_PM */ - static void starfire_remove_one(struct pci_dev *pdev) { @@ -2040,15 +2031,13 @@ static void starfire_remove_one(struct pci_dev *pdev) free_netdev(dev); /* Will also free np!! */ } +static SIMPLE_DEV_PM_OPS(starfire_pm_ops, starfire_suspend, starfire_resume); static struct pci_driver starfire_driver = { .name = DRV_NAME, .probe = starfire_init_one, .remove = starfire_remove_one, -#ifdef CONFIG_PM - .suspend = starfire_suspend, - .resume = starfire_resume, -#endif /* CONFIG_PM */ + .driver.pm = &starfire_pm_ops, .id_table = starfire_pci_tbl, }; -- 2.27.0