Net / e1000e: Fix build issue introduced by runtime PM patch
authorRafael J. Wysocki <rjw@sisk.pl>
Thu, 18 Mar 2010 06:12:24 +0000 (23:12 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 18 Mar 2010 06:12:24 +0000 (23:12 -0700)
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>
drivers/net/e1000e/netdev.c

index b96532a3832285bca406d53ac5fdc176eae6b444..06ba46ae2983dcc216709f4c7f73636ad3c3e8d9 100644 (file)
@@ -4664,58 +4664,12 @@ static void e1000e_disable_l1aspm(struct pci_dev *pdev)
        }
 }
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_OPS
 static bool e1000e_pm_ready(struct e1000_adapter *adapter)
 {
        return !!adapter->tx_ring->buffer_info;
 }
 
-static int e1000_idle(struct device *dev)
-{
-       struct pci_dev *pdev = to_pci_dev(dev);
-       struct net_device *netdev = pci_get_drvdata(pdev);
-       struct e1000_adapter *adapter = netdev_priv(netdev);
-
-       if (!e1000e_pm_ready(adapter))
-               return 0;
-
-       if (adapter->idle_check) {
-               adapter->idle_check = false;
-               if (!e1000e_has_link(adapter))
-                       pm_schedule_suspend(dev, MSEC_PER_SEC);
-       }
-
-       return -EBUSY;
-}
-
-static int e1000_suspend(struct device *dev)
-{
-       struct pci_dev *pdev = to_pci_dev(dev);
-       int retval;
-       bool wake;
-
-       retval = __e1000_shutdown(pdev, &wake, false);
-       if (!retval)
-               e1000_complete_shutdown(pdev, true, wake);
-
-       return retval;
-}
-
-static int e1000_runtime_suspend(struct device *dev)
-{
-       struct pci_dev *pdev = to_pci_dev(dev);
-       struct net_device *netdev = pci_get_drvdata(pdev);
-       struct e1000_adapter *adapter = netdev_priv(netdev);
-
-       if (e1000e_pm_ready(adapter)) {
-               bool wake;
-
-               __e1000_shutdown(pdev, &wake, true);
-       }
-
-       return 0;
-}
-
 static int __e1000_resume(struct pci_dev *pdev)
 {
        struct net_device *netdev = pci_get_drvdata(pdev);
@@ -4783,6 +4737,20 @@ static int __e1000_resume(struct pci_dev *pdev)
        return 0;
 }
 
+#ifdef CONFIG_PM_SLEEP
+static int e1000_suspend(struct device *dev)
+{
+       struct pci_dev *pdev = to_pci_dev(dev);
+       int retval;
+       bool wake;
+
+       retval = __e1000_shutdown(pdev, &wake, false);
+       if (!retval)
+               e1000_complete_shutdown(pdev, true, wake);
+
+       return retval;
+}
+
 static int e1000_resume(struct device *dev)
 {
        struct pci_dev *pdev = to_pci_dev(dev);
@@ -4794,6 +4762,41 @@ static int e1000_resume(struct device *dev)
 
        return __e1000_resume(pdev);
 }
+#endif /* CONFIG_PM_SLEEP */
+
+#ifdef CONFIG_PM_RUNTIME
+static int e1000_runtime_suspend(struct device *dev)
+{
+       struct pci_dev *pdev = to_pci_dev(dev);
+       struct net_device *netdev = pci_get_drvdata(pdev);
+       struct e1000_adapter *adapter = netdev_priv(netdev);
+
+       if (e1000e_pm_ready(adapter)) {
+               bool wake;
+
+               __e1000_shutdown(pdev, &wake, true);
+       }
+
+       return 0;
+}
+
+static int e1000_idle(struct device *dev)
+{
+       struct pci_dev *pdev = to_pci_dev(dev);
+       struct net_device *netdev = pci_get_drvdata(pdev);
+       struct e1000_adapter *adapter = netdev_priv(netdev);
+
+       if (!e1000e_pm_ready(adapter))
+               return 0;
+
+       if (adapter->idle_check) {
+               adapter->idle_check = false;
+               if (!e1000e_has_link(adapter))
+                       pm_schedule_suspend(dev, MSEC_PER_SEC);
+       }
+
+       return -EBUSY;
+}
 
 static int e1000_runtime_resume(struct device *dev)
 {
@@ -4807,7 +4810,8 @@ static int e1000_runtime_resume(struct device *dev)
        adapter->idle_check = !dev->power.runtime_auto;
        return __e1000_resume(pdev);
 }
-#endif
+#endif /* CONFIG_PM_RUNTIME */
+#endif /* CONFIG_PM_OPS */
 
 static void e1000_shutdown(struct pci_dev *pdev)
 {
@@ -5475,17 +5479,11 @@ static DEFINE_PCI_DEVICE_TABLE(e1000_pci_tbl) = {
 };
 MODULE_DEVICE_TABLE(pci, e1000_pci_tbl);
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_OPS
 static const struct dev_pm_ops e1000_pm_ops = {
-       .suspend  = e1000_suspend,
-       .resume   = e1000_resume,
-       .freeze = e1000_suspend,
-       .thaw = e1000_resume,
-       .poweroff = e1000_suspend,
-       .restore = e1000_resume,
-       .runtime_suspend = e1000_runtime_suspend,
-       .runtime_resume = e1000_runtime_resume,
-       .runtime_idle = e1000_idle,
+       SET_SYSTEM_SLEEP_PM_OPS(e1000_suspend, e1000_resume)
+       SET_RUNTIME_PM_OPS(e1000_runtime_suspend,
+                               e1000_runtime_resume, e1000_idle)
 };
 #endif
 
@@ -5495,7 +5493,7 @@ static struct pci_driver e1000_driver = {
        .id_table = e1000_pci_tbl,
        .probe    = e1000_probe,
        .remove   = __devexit_p(e1000_remove),
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_OPS
        .driver.pm = &e1000_pm_ops,
 #endif
        .shutdown = e1000_shutdown,