diff options
Diffstat (limited to 'drivers/net/sundance.c')
-rw-r--r-- | drivers/net/sundance.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/drivers/net/sundance.c b/drivers/net/sundance.c index 3fa949789b42..7dfdbee878e8 100644 --- a/drivers/net/sundance.c +++ b/drivers/net/sundance.c | |||
@@ -1757,11 +1757,59 @@ static void __devexit sundance_remove1 (struct pci_dev *pdev) | |||
1757 | } | 1757 | } |
1758 | } | 1758 | } |
1759 | 1759 | ||
1760 | #ifdef CONFIG_PM | ||
1761 | |||
1762 | static int sundance_suspend(struct pci_dev *pci_dev, pm_message_t state) | ||
1763 | { | ||
1764 | struct net_device *dev = pci_get_drvdata(pci_dev); | ||
1765 | |||
1766 | if (!netif_running(dev)) | ||
1767 | return 0; | ||
1768 | |||
1769 | netdev_close(dev); | ||
1770 | netif_device_detach(dev); | ||
1771 | |||
1772 | pci_save_state(pci_dev); | ||
1773 | pci_set_power_state(pci_dev, pci_choose_state(pci_dev, state)); | ||
1774 | |||
1775 | return 0; | ||
1776 | } | ||
1777 | |||
1778 | static int sundance_resume(struct pci_dev *pci_dev) | ||
1779 | { | ||
1780 | struct net_device *dev = pci_get_drvdata(pci_dev); | ||
1781 | int err = 0; | ||
1782 | |||
1783 | if (!netif_running(dev)) | ||
1784 | return 0; | ||
1785 | |||
1786 | pci_set_power_state(pci_dev, PCI_D0); | ||
1787 | pci_restore_state(pci_dev); | ||
1788 | |||
1789 | err = netdev_open(dev); | ||
1790 | if (err) { | ||
1791 | printk(KERN_ERR "%s: Can't resume interface!\n", | ||
1792 | dev->name); | ||
1793 | goto out; | ||
1794 | } | ||
1795 | |||
1796 | netif_device_attach(dev); | ||
1797 | |||
1798 | out: | ||
1799 | return err; | ||
1800 | } | ||
1801 | |||
1802 | #endif /* CONFIG_PM */ | ||
1803 | |||
1760 | static struct pci_driver sundance_driver = { | 1804 | static struct pci_driver sundance_driver = { |
1761 | .name = DRV_NAME, | 1805 | .name = DRV_NAME, |
1762 | .id_table = sundance_pci_tbl, | 1806 | .id_table = sundance_pci_tbl, |
1763 | .probe = sundance_probe1, | 1807 | .probe = sundance_probe1, |
1764 | .remove = __devexit_p(sundance_remove1), | 1808 | .remove = __devexit_p(sundance_remove1), |
1809 | #ifdef CONFIG_PM | ||
1810 | .suspend = sundance_suspend, | ||
1811 | .resume = sundance_resume, | ||
1812 | #endif /* CONFIG_PM */ | ||
1765 | }; | 1813 | }; |
1766 | 1814 | ||
1767 | static int __init sundance_init(void) | 1815 | static int __init sundance_init(void) |