summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/8390
diff options
context:
space:
mode:
authorVaibhav Gupta <vaibhavgupta40@gmail.com>2020-07-01 22:20:48 +0530
committerDavid S. Miller <davem@davemloft.net>2020-07-01 12:58:33 -0700
commit33b7a252c8dc66ad4abd01a50f23a0d59d95d06d (patch)
treea64df66116256b219e3f5ca09d7a9e5ff111195f /drivers/net/ethernet/8390
parent7b46681cf4b24cd686e24ca4a3d456fef20121eb (diff)
downloadlinux-stable-33b7a252c8dc66ad4abd01a50f23a0d59d95d06d.tar.gz
linux-stable-33b7a252c8dc66ad4abd01a50f23a0d59d95d06d.tar.bz2
linux-stable-33b7a252c8dc66ad4abd01a50f23a0d59d95d06d.zip
ne2k-pci: use generic power management
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_enable/disable_device(), pci_save/restore_sate() and pci_set_power_state(). Compile-tested only. Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/8390')
-rw-r--r--drivers/net/ethernet/8390/ne2k-pci.c29
1 files changed, 6 insertions, 23 deletions
diff --git a/drivers/net/ethernet/8390/ne2k-pci.c b/drivers/net/ethernet/8390/ne2k-pci.c
index 77d78b4c59c4..e500f0c05725 100644
--- a/drivers/net/ethernet/8390/ne2k-pci.c
+++ b/drivers/net/ethernet/8390/ne2k-pci.c
@@ -699,30 +699,18 @@ static void ne2k_pci_remove_one(struct pci_dev *pdev)
pci_disable_device(pdev);
}
-#ifdef CONFIG_PM
-static int ne2k_pci_suspend(struct pci_dev *pdev, pm_message_t state)
+static int __maybe_unused ne2k_pci_suspend(struct device *dev_d)
{
- struct net_device *dev = pci_get_drvdata(pdev);
+ struct net_device *dev = dev_get_drvdata(dev_d);
netif_device_detach(dev);
- pci_save_state(pdev);
- pci_disable_device(pdev);
- pci_set_power_state(pdev, pci_choose_state(pdev, state));
return 0;
}
-static int ne2k_pci_resume(struct pci_dev *pdev)
+static int __maybe_unused ne2k_pci_resume(struct device *dev_d)
{
- struct net_device *dev = pci_get_drvdata(pdev);
- int rc;
-
- pci_set_power_state(pdev, PCI_D0);
- pci_restore_state(pdev);
-
- rc = pci_enable_device(pdev);
- if (rc)
- return rc;
+ struct net_device *dev = dev_get_drvdata(dev_d);
NS8390_init(dev, 1);
netif_device_attach(dev);
@@ -730,19 +718,14 @@ static int ne2k_pci_resume(struct pci_dev *pdev)
return 0;
}
-#endif /* CONFIG_PM */
-
+static SIMPLE_DEV_PM_OPS(ne2k_pci_pm_ops, ne2k_pci_suspend, ne2k_pci_resume);
static struct pci_driver ne2k_driver = {
.name = DRV_NAME,
.probe = ne2k_pci_init_one,
.remove = ne2k_pci_remove_one,
.id_table = ne2k_pci_tbl,
-#ifdef CONFIG_PM
- .suspend = ne2k_pci_suspend,
- .resume = ne2k_pci_resume,
-#endif
-
+ .driver.pm = &ne2k_pci_pm_ops,
};