aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2009-10-04 18:52:09 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-10-07 16:39:46 -0400
commitbaee1f3caa5a771880144358dd07d32e09ba4dcf (patch)
treea004b88ce54e4a9b842f83b820db092561306475
parentfe348cb628e6a78cc1e82fe64404c9a304ed9c12 (diff)
Wireless / ath5k: Simplify suspend and resume callbacks
Simplify the suspend and resume callbacks of ath5k by converting the driver to struct dev_pm_ops and allowing the PCI PM core to do the PCI-specific suspend/resume handling. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/ath/ath5k/base.c35
1 files changed, 11 insertions, 24 deletions
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
index 70831f1bcf04..5aaa9bd036db 100644
--- a/drivers/net/wireless/ath/ath5k/base.c
+++ b/drivers/net/wireless/ath/ath5k/base.c
@@ -195,12 +195,13 @@ static int __devinit ath5k_pci_probe(struct pci_dev *pdev,
195 const struct pci_device_id *id); 195 const struct pci_device_id *id);
196static void __devexit ath5k_pci_remove(struct pci_dev *pdev); 196static void __devexit ath5k_pci_remove(struct pci_dev *pdev);
197#ifdef CONFIG_PM 197#ifdef CONFIG_PM
198static int ath5k_pci_suspend(struct pci_dev *pdev, 198static int ath5k_pci_suspend(struct device *dev);
199 pm_message_t state); 199static int ath5k_pci_resume(struct device *dev);
200static int ath5k_pci_resume(struct pci_dev *pdev); 200
201SIMPLE_DEV_PM_OPS(ath5k_pm_ops, ath5k_pci_suspend, ath5k_pci_resume);
202#define ATH5K_PM_OPS (&ath5k_pm_ops)
201#else 203#else
202#define ath5k_pci_suspend NULL 204#define ATH5K_PM_OPS NULL
203#define ath5k_pci_resume NULL
204#endif /* CONFIG_PM */ 205#endif /* CONFIG_PM */
205 206
206static struct pci_driver ath5k_pci_driver = { 207static struct pci_driver ath5k_pci_driver = {
@@ -208,8 +209,7 @@ static struct pci_driver ath5k_pci_driver = {
208 .id_table = ath5k_pci_id_table, 209 .id_table = ath5k_pci_id_table,
209 .probe = ath5k_pci_probe, 210 .probe = ath5k_pci_probe,
210 .remove = __devexit_p(ath5k_pci_remove), 211 .remove = __devexit_p(ath5k_pci_remove),
211 .suspend = ath5k_pci_suspend, 212 .driver.pm = ATH5K_PM_OPS,
212 .resume = ath5k_pci_resume,
213}; 213};
214 214
215 215
@@ -703,33 +703,20 @@ ath5k_pci_remove(struct pci_dev *pdev)
703} 703}
704 704
705#ifdef CONFIG_PM 705#ifdef CONFIG_PM
706static int 706static int ath5k_pci_suspend(struct device *dev)
707ath5k_pci_suspend(struct pci_dev *pdev, pm_message_t state)
708{ 707{
709 struct ieee80211_hw *hw = pci_get_drvdata(pdev); 708 struct ieee80211_hw *hw = pci_get_drvdata(to_pci_dev(dev));
710 struct ath5k_softc *sc = hw->priv; 709 struct ath5k_softc *sc = hw->priv;
711 710
712 ath5k_led_off(sc); 711 ath5k_led_off(sc);
713
714 pci_save_state(pdev);
715 pci_disable_device(pdev);
716 pci_set_power_state(pdev, PCI_D3hot);
717
718 return 0; 712 return 0;
719} 713}
720 714
721static int 715static int ath5k_pci_resume(struct device *dev)
722ath5k_pci_resume(struct pci_dev *pdev)
723{ 716{
717 struct pci_dev *pdev = to_pci_dev(dev);
724 struct ieee80211_hw *hw = pci_get_drvdata(pdev); 718 struct ieee80211_hw *hw = pci_get_drvdata(pdev);
725 struct ath5k_softc *sc = hw->priv; 719 struct ath5k_softc *sc = hw->priv;
726 int err;
727
728 pci_restore_state(pdev);
729
730 err = pci_enable_device(pdev);
731 if (err)
732 return err;
733 720
734 /* 721 /*
735 * Suspend/Resume resets the PCI configuration space, so we have to 722 * Suspend/Resume resets the PCI configuration space, so we have to