aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath9k/pci.c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2010-10-15 18:36:17 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-11-09 16:13:25 -0500
commitf0e94b479c987abef17eb18e5c8e0ed178d00cd4 (patch)
treeda48d17cb3b24e99df879a2816b2cb71f82cec12 /drivers/net/wireless/ath/ath9k/pci.c
parent191d6a1186f65bc86c24b9d6d9d91acc155285ba (diff)
ath9k: Convert to new PCI PM framework
The ath9k driver uses the legacy PCI power management (suspend and resume) callbacks that apparently cause intermittent problems to happen (the adapter sometimes doesn't resume correctly on my Acer Ferrari One). Make it use the new PCI PM and let the PCI core code handle the PCI-specific details of power transitions. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/pci.c')
-rw-r--r--drivers/net/wireless/ath/ath9k/pci.c40
1 files changed, 22 insertions, 18 deletions
diff --git a/drivers/net/wireless/ath/ath9k/pci.c b/drivers/net/wireless/ath/ath9k/pci.c
index b5b651413e7..6605bc2c203 100644
--- a/drivers/net/wireless/ath/ath9k/pci.c
+++ b/drivers/net/wireless/ath/ath9k/pci.c
@@ -247,34 +247,25 @@ static void ath_pci_remove(struct pci_dev *pdev)
247 247
248#ifdef CONFIG_PM 248#ifdef CONFIG_PM
249 249
250static int ath_pci_suspend(struct pci_dev *pdev, pm_message_t state) 250static int ath_pci_suspend(struct device *device)
251{ 251{
252 struct pci_dev *pdev = to_pci_dev(device);
252 struct ieee80211_hw *hw = pci_get_drvdata(pdev); 253 struct ieee80211_hw *hw = pci_get_drvdata(pdev);
253 struct ath_wiphy *aphy = hw->priv; 254 struct ath_wiphy *aphy = hw->priv;
254 struct ath_softc *sc = aphy->sc; 255 struct ath_softc *sc = aphy->sc;
255 256
256 ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, 1); 257 ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, 1);
257 258
258 pci_save_state(pdev);
259 pci_disable_device(pdev);
260 pci_set_power_state(pdev, PCI_D3hot);
261
262 return 0; 259 return 0;
263} 260}
264 261
265static int ath_pci_resume(struct pci_dev *pdev) 262static int ath_pci_resume(struct device *device)
266{ 263{
264 struct pci_dev *pdev = to_pci_dev(device);
267 struct ieee80211_hw *hw = pci_get_drvdata(pdev); 265 struct ieee80211_hw *hw = pci_get_drvdata(pdev);
268 struct ath_wiphy *aphy = hw->priv; 266 struct ath_wiphy *aphy = hw->priv;
269 struct ath_softc *sc = aphy->sc; 267 struct ath_softc *sc = aphy->sc;
270 u32 val; 268 u32 val;
271 int err;
272
273 pci_restore_state(pdev);
274
275 err = pci_enable_device(pdev);
276 if (err)
277 return err;
278 269
279 /* 270 /*
280 * Suspend/Resume resets the PCI configuration space, so we have to 271 * Suspend/Resume resets the PCI configuration space, so we have to
@@ -293,7 +284,23 @@ static int ath_pci_resume(struct pci_dev *pdev)
293 return 0; 284 return 0;
294} 285}
295 286
296#endif /* CONFIG_PM */ 287static const struct dev_pm_ops ath9k_pm_ops = {
288 .suspend = ath_pci_suspend,
289 .resume = ath_pci_resume,
290 .freeze = ath_pci_suspend,
291 .thaw = ath_pci_resume,
292 .poweroff = ath_pci_suspend,
293 .restore = ath_pci_resume,
294};
295
296#define ATH9K_PM_OPS (&ath9k_pm_ops)
297
298#else /* !CONFIG_PM */
299
300#define ATH9K_PM_OPS NULL
301
302#endif /* !CONFIG_PM */
303
297 304
298MODULE_DEVICE_TABLE(pci, ath_pci_id_table); 305MODULE_DEVICE_TABLE(pci, ath_pci_id_table);
299 306
@@ -302,10 +309,7 @@ static struct pci_driver ath_pci_driver = {
302 .id_table = ath_pci_id_table, 309 .id_table = ath_pci_id_table,
303 .probe = ath_pci_probe, 310 .probe = ath_pci_probe,
304 .remove = ath_pci_remove, 311 .remove = ath_pci_remove,
305#ifdef CONFIG_PM 312 .driver.pm = ATH9K_PM_OPS,
306 .suspend = ath_pci_suspend,
307 .resume = ath_pci_resume,
308#endif /* CONFIG_PM */
309}; 313};
310 314
311int ath_pci_init(void) 315int ath_pci_init(void)