aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/starfire.c
diff options
context:
space:
mode:
authorStefan Rompf <stefan@loplof.de>2006-01-17 16:52:51 -0500
committerJeff Garzik <jgarzik@pobox.com>2006-01-17 19:19:12 -0500
commitd4fbeabbc9e68c80738fe59135d201c3ed5fe40f (patch)
treedc7a965013ec01a54b3e4b265ade1637e8df4a53 /drivers/net/starfire.c
parent0547993820378ef8140b0470b604737bf1fa6c85 (diff)
[PATCH] starfire: Implement suspend/resume
This patch implements suspend and resume methods for the starfire driver. It allows me to put my desktop PC with a starfire dual board into S4. Signed-Off-By: Stefan Rompf <stefan@loplof.de> Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
Diffstat (limited to 'drivers/net/starfire.c')
-rw-r--r--drivers/net/starfire.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/drivers/net/starfire.c b/drivers/net/starfire.c
index d167deda9a53..ed5458c45446 100644
--- a/drivers/net/starfire.c
+++ b/drivers/net/starfire.c
@@ -2084,6 +2084,38 @@ static int netdev_close(struct net_device *dev)
2084 return 0; 2084 return 0;
2085} 2085}
2086 2086
2087#ifdef CONFIG_PM
2088static int starfire_suspend(struct pci_dev *pdev, pm_message_t state)
2089{
2090 struct net_device *dev = pci_get_drvdata(pdev);
2091
2092 if (netif_running(dev)) {
2093 netif_device_detach(dev);
2094 netdev_close(dev);
2095 }
2096
2097 pci_save_state(pdev);
2098 pci_set_power_state(pdev, pci_choose_state(pdev,state));
2099
2100 return 0;
2101}
2102
2103static int starfire_resume(struct pci_dev *pdev)
2104{
2105 struct net_device *dev = pci_get_drvdata(pdev);
2106
2107 pci_set_power_state(pdev, PCI_D0);
2108 pci_restore_state(pdev);
2109
2110 if (netif_running(dev)) {
2111 netdev_open(dev);
2112 netif_device_attach(dev);
2113 }
2114
2115 return 0;
2116}
2117#endif /* CONFIG_PM */
2118
2087 2119
2088static void __devexit starfire_remove_one (struct pci_dev *pdev) 2120static void __devexit starfire_remove_one (struct pci_dev *pdev)
2089{ 2121{
@@ -2115,6 +2147,10 @@ static struct pci_driver starfire_driver = {
2115 .name = DRV_NAME, 2147 .name = DRV_NAME,
2116 .probe = starfire_init_one, 2148 .probe = starfire_init_one,
2117 .remove = __devexit_p(starfire_remove_one), 2149 .remove = __devexit_p(starfire_remove_one),
2150#ifdef CONFIG_PM
2151 .suspend = starfire_suspend,
2152 .resume = starfire_resume,
2153#endif /* CONFIG_PM */
2118 .id_table = starfire_pci_tbl, 2154 .id_table = starfire_pci_tbl,
2119}; 2155};
2120 2156