diff options
author | Stefan Rompf <stefan@loplof.de> | 2006-01-17 22:52:51 +0100 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2006-01-17 19:19:12 -0500 |
commit | d4fbeabbc9e68c80738fe59135d201c3ed5fe40f (patch) | |
tree | dc7a965013ec01a54b3e4b265ade1637e8df4a53 /drivers/net/starfire.c | |
parent | 0547993820378ef8140b0470b604737bf1fa6c85 (diff) | |
download | linux-d4fbeabbc9e68c80738fe59135d201c3ed5fe40f.tar.bz2 |
[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.c | 36 |
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) return 0; } +#ifdef CONFIG_PM +static int starfire_suspend(struct pci_dev *pdev, pm_message_t state) +{ + struct net_device *dev = pci_get_drvdata(pdev); + + if (netif_running(dev)) { + netif_device_detach(dev); + netdev_close(dev); + } + + pci_save_state(pdev); + pci_set_power_state(pdev, pci_choose_state(pdev,state)); + + return 0; +} + +static int starfire_resume(struct pci_dev *pdev) +{ + struct net_device *dev = pci_get_drvdata(pdev); + + pci_set_power_state(pdev, PCI_D0); + pci_restore_state(pdev); + + if (netif_running(dev)) { + netdev_open(dev); + netif_device_attach(dev); + } + + return 0; +} +#endif /* CONFIG_PM */ + static void __devexit starfire_remove_one (struct pci_dev *pdev) { @@ -2115,6 +2147,10 @@ static struct pci_driver starfire_driver = { .name = DRV_NAME, .probe = starfire_init_one, .remove = __devexit_p(starfire_remove_one), +#ifdef CONFIG_PM + .suspend = starfire_suspend, + .resume = starfire_resume, +#endif /* CONFIG_PM */ .id_table = starfire_pci_tbl, }; |