提交 f0e94b47 编写于 作者: R Rafael J. Wysocki 提交者: John W. Linville

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: NRafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 191d6a11
...@@ -247,34 +247,25 @@ static void ath_pci_remove(struct pci_dev *pdev) ...@@ -247,34 +247,25 @@ static void ath_pci_remove(struct pci_dev *pdev)
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int ath_pci_suspend(struct pci_dev *pdev, pm_message_t state) static int ath_pci_suspend(struct device *device)
{ {
struct pci_dev *pdev = to_pci_dev(device);
struct ieee80211_hw *hw = pci_get_drvdata(pdev); struct ieee80211_hw *hw = pci_get_drvdata(pdev);
struct ath_wiphy *aphy = hw->priv; struct ath_wiphy *aphy = hw->priv;
struct ath_softc *sc = aphy->sc; struct ath_softc *sc = aphy->sc;
ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, 1); ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, 1);
pci_save_state(pdev);
pci_disable_device(pdev);
pci_set_power_state(pdev, PCI_D3hot);
return 0; return 0;
} }
static int ath_pci_resume(struct pci_dev *pdev) static int ath_pci_resume(struct device *device)
{ {
struct pci_dev *pdev = to_pci_dev(device);
struct ieee80211_hw *hw = pci_get_drvdata(pdev); struct ieee80211_hw *hw = pci_get_drvdata(pdev);
struct ath_wiphy *aphy = hw->priv; struct ath_wiphy *aphy = hw->priv;
struct ath_softc *sc = aphy->sc; struct ath_softc *sc = aphy->sc;
u32 val; u32 val;
int err;
pci_restore_state(pdev);
err = pci_enable_device(pdev);
if (err)
return err;
/* /*
* Suspend/Resume resets the PCI configuration space, so we have to * 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,7 +284,23 @@ static int ath_pci_resume(struct pci_dev *pdev)
return 0; return 0;
} }
#endif /* CONFIG_PM */ static const struct dev_pm_ops ath9k_pm_ops = {
.suspend = ath_pci_suspend,
.resume = ath_pci_resume,
.freeze = ath_pci_suspend,
.thaw = ath_pci_resume,
.poweroff = ath_pci_suspend,
.restore = ath_pci_resume,
};
#define ATH9K_PM_OPS (&ath9k_pm_ops)
#else /* !CONFIG_PM */
#define ATH9K_PM_OPS NULL
#endif /* !CONFIG_PM */
MODULE_DEVICE_TABLE(pci, ath_pci_id_table); MODULE_DEVICE_TABLE(pci, ath_pci_id_table);
...@@ -302,10 +309,7 @@ static struct pci_driver ath_pci_driver = { ...@@ -302,10 +309,7 @@ static struct pci_driver ath_pci_driver = {
.id_table = ath_pci_id_table, .id_table = ath_pci_id_table,
.probe = ath_pci_probe, .probe = ath_pci_probe,
.remove = ath_pci_remove, .remove = ath_pci_remove,
#ifdef CONFIG_PM .driver.pm = ATH9K_PM_OPS,
.suspend = ath_pci_suspend,
.resume = ath_pci_resume,
#endif /* CONFIG_PM */
}; };
int ath_pci_init(void) int ath_pci_init(void)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册