提交 8cfa989a 编写于 作者: V Vaibhav Gupta 提交者: David S. Miller

tulip: de2104x: use generic power management

With the support of generic PM callbacks, drivers no longer need to use
legacy .suspend() and .resume() in which they had to maintain PCI states
changes and device's power state themselves.

Earlier, .suspend() and .resume() were invoking pci_disable_device()
and pci_enable_device() respectively to manage the device's power state.
With generic PM, it is no longer needed. The driver is expected to just
implement driver-specific operations and leave power transitions to PCI
core.

Compile-tested only.
Signed-off-by: NVaibhav Gupta <vaibhavgupta40@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 fc9aebfb
......@@ -2105,11 +2105,10 @@ static void de_remove_one(struct pci_dev *pdev)
free_netdev(dev);
}
#ifdef CONFIG_PM
static int de_suspend (struct pci_dev *pdev, pm_message_t state)
static int __maybe_unused de_suspend(struct device *dev_d)
{
struct net_device *dev = pci_get_drvdata (pdev);
struct pci_dev *pdev = to_pci_dev(dev_d);
struct net_device *dev = pci_get_drvdata(pdev);
struct de_private *de = netdev_priv(dev);
rtnl_lock();
......@@ -2136,7 +2135,6 @@ static int de_suspend (struct pci_dev *pdev, pm_message_t state)
de_clean_rings(de);
de_adapter_sleep(de);
pci_disable_device(pdev);
} else {
netif_device_detach(dev);
}
......@@ -2144,21 +2142,17 @@ static int de_suspend (struct pci_dev *pdev, pm_message_t state)
return 0;
}
static int de_resume (struct pci_dev *pdev)
static int __maybe_unused de_resume(struct device *dev_d)
{
struct net_device *dev = pci_get_drvdata (pdev);
struct pci_dev *pdev = to_pci_dev(dev_d);
struct net_device *dev = pci_get_drvdata(pdev);
struct de_private *de = netdev_priv(dev);
int retval = 0;
rtnl_lock();
if (netif_device_present(dev))
goto out;
if (!netif_running(dev))
goto out_attach;
if ((retval = pci_enable_device(pdev))) {
netdev_err(dev, "pci_enable_device failed in resume\n");
goto out;
}
pci_set_master(pdev);
de_init_rings(de);
de_init_hw(de);
......@@ -2169,17 +2163,14 @@ static int de_resume (struct pci_dev *pdev)
return 0;
}
#endif /* CONFIG_PM */
static SIMPLE_DEV_PM_OPS(de_pm_ops, de_suspend, de_resume);
static struct pci_driver de_driver = {
.name = DRV_NAME,
.id_table = de_pci_tbl,
.probe = de_init_one,
.remove = de_remove_one,
#ifdef CONFIG_PM
.suspend = de_suspend,
.resume = de_resume,
#endif
.driver.pm = &de_pm_ops,
};
static int __init de_init (void)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册