mirror of
https://github.com/torvalds/linux.git
synced 2024-12-04 18:13:04 +00:00
[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>
This commit is contained in:
parent
0547993820
commit
d4fbeabbc9
@ -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,
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user