Commit 3e4242b9 authored by Jiri Slaby's avatar Jiri Slaby Committed by John W. Linville

Ath5k: suspend/resume fixes

- free and re-request irq since it might have changed during suspend
- disable and enable msi
- don't set D0 state of the device, it's already done by the PCI layer
- do restore_state before enable_device, it's safer
- check ath5k_init return value
Signed-off-by: default avatarJiri Slaby <jirislaby@gmail.com>
Acked-by: default avatarNick Kossifidis <mickflemm@gmail.com>
Cc: Luis R. Rodriguez <mcgrof@gmail.com>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent e86600c7
...@@ -592,6 +592,9 @@ ath5k_pci_suspend(struct pci_dev *pdev, pm_message_t state) ...@@ -592,6 +592,9 @@ ath5k_pci_suspend(struct pci_dev *pdev, pm_message_t state)
ath5k_led_off(sc); ath5k_led_off(sc);
ath5k_stop_hw(sc); ath5k_stop_hw(sc);
free_irq(pdev->irq, sc);
pci_disable_msi(pdev);
pci_save_state(pdev); pci_save_state(pdev);
pci_disable_device(pdev); pci_disable_device(pdev);
pci_set_power_state(pdev, PCI_D3hot); pci_set_power_state(pdev, PCI_D3hot);
...@@ -607,15 +610,12 @@ ath5k_pci_resume(struct pci_dev *pdev) ...@@ -607,15 +610,12 @@ ath5k_pci_resume(struct pci_dev *pdev)
struct ath5k_hw *ah = sc->ah; struct ath5k_hw *ah = sc->ah;
int i, err; int i, err;
err = pci_set_power_state(pdev, PCI_D0); pci_restore_state(pdev);
if (err)
return err;
err = pci_enable_device(pdev); err = pci_enable_device(pdev);
if (err) if (err)
return err; return err;
pci_restore_state(pdev);
/* /*
* Suspend/Resume resets the PCI configuration space, so we have to * Suspend/Resume resets the PCI configuration space, so we have to
* re-disable the RETRY_TIMEOUT register (0x41) to keep * re-disable the RETRY_TIMEOUT register (0x41) to keep
...@@ -623,7 +623,17 @@ ath5k_pci_resume(struct pci_dev *pdev) ...@@ -623,7 +623,17 @@ ath5k_pci_resume(struct pci_dev *pdev)
*/ */
pci_write_config_byte(pdev, 0x41, 0); pci_write_config_byte(pdev, 0x41, 0);
ath5k_init(sc); pci_enable_msi(pdev);
err = request_irq(pdev->irq, ath5k_intr, IRQF_SHARED, "ath", sc);
if (err) {
ATH5K_ERR(sc, "request_irq failed\n");
goto err_msi;
}
err = ath5k_init(sc);
if (err)
goto err_irq;
ath5k_led_enable(sc); ath5k_led_enable(sc);
/* /*
...@@ -637,6 +647,12 @@ ath5k_pci_resume(struct pci_dev *pdev) ...@@ -637,6 +647,12 @@ ath5k_pci_resume(struct pci_dev *pdev)
ath5k_hw_reset_key(ah, i); ath5k_hw_reset_key(ah, i);
return 0; return 0;
err_irq:
free_irq(pdev->irq, sc);
err_msi:
pci_disable_msi(pdev);
pci_disable_device(pdev);
return err;
} }
#endif /* CONFIG_PM */ #endif /* CONFIG_PM */
......
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