aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/e1000e
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2010-03-18 02:12:24 -0400
committerDavid S. Miller <davem@davemloft.net>2010-03-18 02:12:24 -0400
commita034016287236f435dbb8f1f57aee906f22b4598 (patch)
treef6af0988a34effb8ec94b1a51e44c19d0f26ee23 /drivers/net/e1000e
parente50208a080a8abdfa6c85865362a1cf329e9fe31 (diff)
Net / e1000e: Fix build issue introduced by runtime PM patch
The recent PCI runtime PM patch broke build for CONFIG_PM_RUNTIME and CONFIG_PM_SLEEP undefined. Fix that by moving the PM callbacks under suitable #ifdefs. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/e1000e')
-rw-r--r--drivers/net/e1000e/netdev.c116
1 files changed, 57 insertions, 59 deletions
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index b96532a38322..06ba46ae2983 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -4664,58 +4664,12 @@ static void e1000e_disable_l1aspm(struct pci_dev *pdev)
4664 } 4664 }
4665} 4665}
4666 4666
4667#ifdef CONFIG_PM 4667#ifdef CONFIG_PM_OPS
4668static bool e1000e_pm_ready(struct e1000_adapter *adapter) 4668static bool e1000e_pm_ready(struct e1000_adapter *adapter)
4669{ 4669{
4670 return !!adapter->tx_ring->buffer_info; 4670 return !!adapter->tx_ring->buffer_info;
4671} 4671}
4672 4672
4673static int e1000_idle(struct device *dev)
4674{
4675 struct pci_dev *pdev = to_pci_dev(dev);
4676 struct net_device *netdev = pci_get_drvdata(pdev);
4677 struct e1000_adapter *adapter = netdev_priv(netdev);
4678
4679 if (!e1000e_pm_ready(adapter))
4680 return 0;
4681
4682 if (adapter->idle_check) {
4683 adapter->idle_check = false;
4684 if (!e1000e_has_link(adapter))
4685 pm_schedule_suspend(dev, MSEC_PER_SEC);
4686 }
4687
4688 return -EBUSY;
4689}
4690
4691static int e1000_suspend(struct device *dev)
4692{
4693 struct pci_dev *pdev = to_pci_dev(dev);
4694 int retval;
4695 bool wake;
4696
4697 retval = __e1000_shutdown(pdev, &wake, false);
4698 if (!retval)
4699 e1000_complete_shutdown(pdev, true, wake);
4700
4701 return retval;
4702}
4703
4704static int e1000_runtime_suspend(struct device *dev)
4705{
4706 struct pci_dev *pdev = to_pci_dev(dev);
4707 struct net_device *netdev = pci_get_drvdata(pdev);
4708 struct e1000_adapter *adapter = netdev_priv(netdev);
4709
4710 if (e1000e_pm_ready(adapter)) {
4711 bool wake;
4712
4713 __e1000_shutdown(pdev, &wake, true);
4714 }
4715
4716 return 0;
4717}
4718
4719static int __e1000_resume(struct pci_dev *pdev) 4673static int __e1000_resume(struct pci_dev *pdev)
4720{ 4674{
4721 struct net_device *netdev = pci_get_drvdata(pdev); 4675 struct net_device *netdev = pci_get_drvdata(pdev);
@@ -4783,6 +4737,20 @@ static int __e1000_resume(struct pci_dev *pdev)
4783 return 0; 4737 return 0;
4784} 4738}
4785 4739
4740#ifdef CONFIG_PM_SLEEP
4741static int e1000_suspend(struct device *dev)
4742{
4743 struct pci_dev *pdev = to_pci_dev(dev);
4744 int retval;
4745 bool wake;
4746
4747 retval = __e1000_shutdown(pdev, &wake, false);
4748 if (!retval)
4749 e1000_complete_shutdown(pdev, true, wake);
4750
4751 return retval;
4752}
4753
4786static int e1000_resume(struct device *dev) 4754static int e1000_resume(struct device *dev)
4787{ 4755{
4788 struct pci_dev *pdev = to_pci_dev(dev); 4756 struct pci_dev *pdev = to_pci_dev(dev);
@@ -4794,6 +4762,41 @@ static int e1000_resume(struct device *dev)
4794 4762
4795 return __e1000_resume(pdev); 4763 return __e1000_resume(pdev);
4796} 4764}
4765#endif /* CONFIG_PM_SLEEP */
4766
4767#ifdef CONFIG_PM_RUNTIME
4768static int e1000_runtime_suspend(struct device *dev)
4769{
4770 struct pci_dev *pdev = to_pci_dev(dev);
4771 struct net_device *netdev = pci_get_drvdata(pdev);
4772 struct e1000_adapter *adapter = netdev_priv(netdev);
4773
4774 if (e1000e_pm_ready(adapter)) {
4775 bool wake;
4776
4777 __e1000_shutdown(pdev, &wake, true);
4778 }
4779
4780 return 0;
4781}
4782
4783static int e1000_idle(struct device *dev)
4784{
4785 struct pci_dev *pdev = to_pci_dev(dev);
4786 struct net_device *netdev = pci_get_drvdata(pdev);
4787 struct e1000_adapter *adapter = netdev_priv(netdev);
4788
4789 if (!e1000e_pm_ready(adapter))
4790 return 0;
4791
4792 if (adapter->idle_check) {
4793 adapter->idle_check = false;
4794 if (!e1000e_has_link(adapter))
4795 pm_schedule_suspend(dev, MSEC_PER_SEC);
4796 }
4797
4798 return -EBUSY;
4799}
4797 4800
4798static int e1000_runtime_resume(struct device *dev) 4801static int e1000_runtime_resume(struct device *dev)
4799{ 4802{
@@ -4807,7 +4810,8 @@ static int e1000_runtime_resume(struct device *dev)
4807 adapter->idle_check = !dev->power.runtime_auto; 4810 adapter->idle_check = !dev->power.runtime_auto;
4808 return __e1000_resume(pdev); 4811 return __e1000_resume(pdev);
4809} 4812}
4810#endif 4813#endif /* CONFIG_PM_RUNTIME */
4814#endif /* CONFIG_PM_OPS */
4811 4815
4812static void e1000_shutdown(struct pci_dev *pdev) 4816static void e1000_shutdown(struct pci_dev *pdev)
4813{ 4817{
@@ -5475,17 +5479,11 @@ static DEFINE_PCI_DEVICE_TABLE(e1000_pci_tbl) = {
5475}; 5479};
5476MODULE_DEVICE_TABLE(pci, e1000_pci_tbl); 5480MODULE_DEVICE_TABLE(pci, e1000_pci_tbl);
5477 5481
5478#ifdef CONFIG_PM 5482#ifdef CONFIG_PM_OPS
5479static const struct dev_pm_ops e1000_pm_ops = { 5483static const struct dev_pm_ops e1000_pm_ops = {
5480 .suspend = e1000_suspend, 5484 SET_SYSTEM_SLEEP_PM_OPS(e1000_suspend, e1000_resume)
5481 .resume = e1000_resume, 5485 SET_RUNTIME_PM_OPS(e1000_runtime_suspend,
5482 .freeze = e1000_suspend, 5486 e1000_runtime_resume, e1000_idle)
5483 .thaw = e1000_resume,
5484 .poweroff = e1000_suspend,
5485 .restore = e1000_resume,
5486 .runtime_suspend = e1000_runtime_suspend,
5487 .runtime_resume = e1000_runtime_resume,
5488 .runtime_idle = e1000_idle,
5489}; 5487};
5490#endif 5488#endif
5491 5489
@@ -5495,7 +5493,7 @@ static struct pci_driver e1000_driver = {
5495 .id_table = e1000_pci_tbl, 5493 .id_table = e1000_pci_tbl,
5496 .probe = e1000_probe, 5494 .probe = e1000_probe,
5497 .remove = __devexit_p(e1000_remove), 5495 .remove = __devexit_p(e1000_remove),
5498#ifdef CONFIG_PM 5496#ifdef CONFIG_PM_OPS
5499 .driver.pm = &e1000_pm_ops, 5497 .driver.pm = &e1000_pm_ops,
5500#endif 5498#endif
5501 .shutdown = e1000_shutdown, 5499 .shutdown = e1000_shutdown,