summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVaibhav Gupta <vaibhavgupta40@gmail.com>2020-07-03 08:31:37 +0530
committerDavid S. Miller <davem@davemloft.net>2020-07-07 15:20:48 -0700
commit622594f2ad8be03d55a56f4f91c41ae5f3849703 (patch)
tree311061d15cf1192cddb89334b3bcf0ff41b4a7d0
parent4e48978cd28ce51945c08650e5c5502ca41e1fcc (diff)
epic100: use generic power management
Drivers should not use legacy power management as they have to manage power states and related operations, for the device, themselves. With generic PM, all essentials will be handled by the PCI core. Driver needs to do only device-specific operations. Compile-tested only. Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/smsc/epic100.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/drivers/net/ethernet/smsc/epic100.c b/drivers/net/ethernet/smsc/epic100.c
index 61ddee0c2a2e..d950b312c418 100644
--- a/drivers/net/ethernet/smsc/epic100.c
+++ b/drivers/net/ethernet/smsc/epic100.c
@@ -1512,12 +1512,9 @@ static void epic_remove_one(struct pci_dev *pdev)
/* pci_power_off(pdev, -1); */
}
-
-#ifdef CONFIG_PM
-
-static int epic_suspend (struct pci_dev *pdev, pm_message_t state)
+static int __maybe_unused epic_suspend(struct device *dev_d)
{
- struct net_device *dev = pci_get_drvdata(pdev);
+ struct net_device *dev = dev_get_drvdata(dev_d);
struct epic_private *ep = netdev_priv(dev);
void __iomem *ioaddr = ep->ioaddr;
@@ -1531,9 +1528,9 @@ static int epic_suspend (struct pci_dev *pdev, pm_message_t state)
}
-static int epic_resume (struct pci_dev *pdev)
+static int __maybe_unused epic_resume(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))
return 0;
@@ -1542,18 +1539,14 @@ static int epic_resume (struct pci_dev *pdev)
return 0;
}
-#endif /* CONFIG_PM */
-
+static SIMPLE_DEV_PM_OPS(epic_pm_ops, epic_suspend, epic_resume);
static struct pci_driver epic_driver = {
.name = DRV_NAME,
.id_table = epic_pci_tbl,
.probe = epic_init_one,
.remove = epic_remove_one,
-#ifdef CONFIG_PM
- .suspend = epic_suspend,
- .resume = epic_resume,
-#endif /* CONFIG_PM */
+ .driver.pm = &epic_pm_ops,
};