Commit baee1f3c authored by Rafael J. Wysocki's avatar Rafael J. Wysocki Committed by John W. Linville

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: default avatarRafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent fe348cb6
...@@ -195,12 +195,13 @@ static int __devinit ath5k_pci_probe(struct pci_dev *pdev, ...@@ -195,12 +195,13 @@ static int __devinit ath5k_pci_probe(struct pci_dev *pdev,
const struct pci_device_id *id); const struct pci_device_id *id);
static void __devexit ath5k_pci_remove(struct pci_dev *pdev); static void __devexit ath5k_pci_remove(struct pci_dev *pdev);
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int ath5k_pci_suspend(struct pci_dev *pdev, static int ath5k_pci_suspend(struct device *dev);
pm_message_t state); static int ath5k_pci_resume(struct device *dev);
static int ath5k_pci_resume(struct pci_dev *pdev);
SIMPLE_DEV_PM_OPS(ath5k_pm_ops, ath5k_pci_suspend, ath5k_pci_resume);
#define ATH5K_PM_OPS (&ath5k_pm_ops)
#else #else
#define ath5k_pci_suspend NULL #define ATH5K_PM_OPS NULL
#define ath5k_pci_resume NULL
#endif /* CONFIG_PM */ #endif /* CONFIG_PM */
static struct pci_driver ath5k_pci_driver = { static struct pci_driver ath5k_pci_driver = {
...@@ -208,8 +209,7 @@ static struct pci_driver ath5k_pci_driver = { ...@@ -208,8 +209,7 @@ static struct pci_driver ath5k_pci_driver = {
.id_table = ath5k_pci_id_table, .id_table = ath5k_pci_id_table,
.probe = ath5k_pci_probe, .probe = ath5k_pci_probe,
.remove = __devexit_p(ath5k_pci_remove), .remove = __devexit_p(ath5k_pci_remove),
.suspend = ath5k_pci_suspend, .driver.pm = ATH5K_PM_OPS,
.resume = ath5k_pci_resume,
}; };
...@@ -703,33 +703,20 @@ ath5k_pci_remove(struct pci_dev *pdev) ...@@ -703,33 +703,20 @@ ath5k_pci_remove(struct pci_dev *pdev)
} }
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int static int ath5k_pci_suspend(struct device *dev)
ath5k_pci_suspend(struct pci_dev *pdev, pm_message_t state)
{ {
struct ieee80211_hw *hw = pci_get_drvdata(pdev); struct ieee80211_hw *hw = pci_get_drvdata(to_pci_dev(dev));
struct ath5k_softc *sc = hw->priv; struct ath5k_softc *sc = hw->priv;
ath5k_led_off(sc); ath5k_led_off(sc);
pci_save_state(pdev);
pci_disable_device(pdev);
pci_set_power_state(pdev, PCI_D3hot);
return 0; return 0;
} }
static int static int ath5k_pci_resume(struct device *dev)
ath5k_pci_resume(struct pci_dev *pdev)
{ {
struct pci_dev *pdev = to_pci_dev(dev);
struct ieee80211_hw *hw = pci_get_drvdata(pdev); struct ieee80211_hw *hw = pci_get_drvdata(pdev);
struct ath5k_softc *sc = hw->priv; struct ath5k_softc *sc = hw->priv;
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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment