Skip to content

Commit

Permalink
[PATCH] starfire: Implement suspend/resume
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Stefan Rompf authored and Jeff Garzik committed Jan 18, 2006
1 parent 0547993 commit d4fbeab
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions drivers/net/starfire.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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,
};

Expand Down

0 comments on commit d4fbeab

Please sign in to comment.