Wireless / ath5k: Simplify suspend and resume callbacks
Subsystems (3)
PATCH 1/1 Wireless / ath5k: Simplify suspend and resume callbacks
From: Rafael J. Wysocki <[email protected]>
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.
--- drivers/net/wireless/ath/ath5k/base.c | 35 ++++++++++------------------------ 1 file changed, 11 insertions(+), 24 deletions(-)
drivers/net/wireless/ath/ath5k/base.c +11 -24
@@ -195,12 +195,13 @@ static int __devinit ath5k_pci_probe(str const struct pci_device_id *id); static void __devexit ath5k_pci_remove(struct pci_dev *pdev);#ifdef CONFIG_PM -static int ath5k_pci_suspend (struct pci_dev *pdev, -pm_message_t state); -static int ath5k_pci_resume (struct pci_dev *pdev); +static int ath5k_pci_suspend (struct device *dev); +static int ath5k_pci_resume (struct device *dev); + +SIMPLE_DEV_PM_OPS (ath5k_pm_ops, ath5k_pci_suspend, ath5k_pci_resume); +#define ATH5K_PM_OPS (&ath5k_pm_ops)#else -#define ath5k_pci_suspend NULL -#define ath5k_pci_resume NULL +#define ATH5K_PM_OPS NULL#endif /* CONFIG_PM */ static struct pci_driver ath5k_pci_driver = {
@@ -208,8 +209,7 @@ static struct pci_driver ath5k_pci_drive .id_table = ath5k_pci_id_table, .probe = ath5k_pci_probe, .remove = __devexit_p(ath5k_pci_remove), - .suspend = ath5k_pci_suspend, - .resume = ath5k_pci_resume, + .driver.pm = ATH5K_PM_OPS, };
@@ -669,33 +669,20 @@ ath5k_pci_remove(struct pci_dev *pdev) }#ifdef CONFIG_PM -static int -ath5k_pci_suspend (struct pci_dev *pdev,pm_message_t state) +static int ath5k_pci_suspend (struct device *dev) { -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;ath5k_led_off (sc); - -pci_save_state (pdev); -pci_disable_device (pdev); -pci_set_power_state (pdev, PCI_D3hot); -return 0 ; } -static int -ath5k_pci_resume (struct pci_dev *pdev) +static int ath5k_pci_resume (struct device *dev) { +struct pci_dev *pdev =to_pci_dev (dev);struct ieee80211_hw *hw =pci_get_drvdata (pdev);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
Quoted 7 lines · Rafael J. Wysocki
From: Rafael J. Wysocki <[email protected]>
Simplify the suspend and resume callbacks of ath5k by converting the driver to struct
dev_pm_opsand allowing the PCI PM core to do the PCI-specific suspend/resume handling.Signed-off-by Rafael J. Wysocki <[email protected]>
Do you happen to know if the new dev_pm_ops thing handle WOL / WoW [1]?
[1] http://wireless.kernel.org/en/users/Documentation/WoW
Quoted 9 lines
#ifdef
CONFIG_PMdrivers/net/wireless/ath/ath5k/base.c +1
-2-static int -ath5k_pci_suspend (struct pci_dev *pdev,pm_message_t state) +static int ath5k_pci_suspend (struct device *dev){
- structieee80211_hw*hw =pci_get_drvdata(pdev);
+ structieee80211_hw*hw = pci_get_drvdata(to_pci_dev(dev)); structath5k_softc*sc =hw->priv;
Quoted 4 lines
ath5k_led_off(sc);
-
-pci_save_state(pdev);
-pci_disable_device(pdev);
For WoW right here we'd do
pci_prepare_to_sleep(pdev) and bail out.
Quoted 1 line
-
pci_set_power_state(pdev, PCI_D3hot);
And here we'd call something like this:
pci_wake_from_d3(pdev, !!sc->wow_triggers_enabled);
Quoted 3 lines
-
return 0;
}
Are all drivers being converted?
It'll be a while before we get WoW enabled on ath5k but it is technically possible, the work was tested for ath9k back in July [2] but I never submitted this to be merged due to some inconsistent issues I was noticing with the hardware.
[2] http://kernel.org/pub/linux/kernel/people/mcgrof/patches/wow-07-21.patch
Luis
_______________________________________________
ath5k-devel mailing list
[email protected]
https://lists.ath5k.org/mailman/listinfo/ath5k-devel
Quoted 7 lines · Rafael J. Wysocki
From: Rafael J. Wysocki <[email protected]>
Simplify the suspend and resume callbacks of ath5k by converting the driver to struct
dev_pm_opsand allowing the PCI PM core to do the PCI-specific suspend/resume handling.Signed-off-by Rafael J. Wysocki <[email protected]>
Do you happen to know if the new dev_pm_ops thing handle WOL / WoW [1]?
[1] http://wireless.kernel.org/en/users/Documentation/WoW
Quoted 9 lines
#ifdef
CONFIG_PMdrivers/net/wireless/ath/ath5k/base.c +1
-2-static int -ath5k_pci_suspend (struct pci_dev *pdev,pm_message_t state) +static int ath5k_pci_suspend (struct device *dev){
- structieee80211_hw*hw =pci_get_drvdata(pdev);
+ structieee80211_hw*hw = pci_get_drvdata(to_pci_dev(dev)); structath5k_softc*sc =hw->priv;
Quoted 4 lines
ath5k_led_off(sc);
-
-pci_save_state(pdev);
-pci_disable_device(pdev);
For WoW right here we'd do
pci_prepare_to_sleep(pdev) and bail out.
Quoted 1 line
-
pci_set_power_state(pdev, PCI_D3hot);
And here we'd call something like this:
pci_wake_from_d3(pdev, !!sc->wow_triggers_enabled);
Quoted 3 lines
-
return 0;
}
Are all drivers being converted?
It'll be a while before we get WoW enabled on ath5k but it is technically possible, the work was tested for ath9k back in July [2] but I never submitted this to be merged due to some inconsistent issues I was noticing with the hardware.
[2] http://kernel.org/pub/linux/kernel/people/mcgrof/patches/wow-07-21.patch
Luis
_______________________________________________
linux-pm mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/linux-pm
Quoted 7 lines · Luis R. Rodriguez
Quoted 6 lines · Rafael J. Wysocki
From: Rafael J. Wysocki <[email protected]>
Simplify the suspend and resume callbacks of ath5k by converting the driver to struct
dev_pm_opsand allowing the PCI PM core to do the PCI-specific suspend/resume handling.
Quoted 5 lines
Quoted 1 line
Signed-off-by Rafael J. Wysocki <[email protected]>Do you happen to know if the new
dev_pm_opsthing handle WOL / WoW [1]?
It does enable wake-up at the PCI level if so configured, so in principle it should handle it. However, for WoL to work there are some things that the drivers is reponsible for, so I guess it will be analogous for WoW.
Anyway, the PCI-specific mechanics is there.
Quoted 16 lines
drivers/net/wireless/ath/ath5k/base.c ath5k_pci_remove(struct pci_dev *pdev) · line 681
Quoted 13 lines
#ifdef
CONFIG_PMdrivers/net/wireless/ath/ath5k/base.c +2
-6-static int -ath5k_pci_suspend (struct pci_dev *pdev,pm_message_t state) +static int ath5k_pci_suspend (struct device *dev) { -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;ath5k_led_off (sc); - -pci_save_state (pdev); -pci_disable_device (pdev);For WoW right here we'd do
Quoted 7 lines
pci_prepare_to_sleep(pdev)and bail out.Quoted 1 line
-
pci_set_power_state(pdev, PCI_D3hot);And here we'd call something like this:
pci_wake_from_d3(pdev, !!sc->wow_triggers_enabled);
All of this is unnecessary, the PCI PM core should take care of this just fine. In case it doesn't, it has to be fixed.
Quoted 5 lines
Quoted 3 lines
-
return 0;}
Are all drivers being converted?
Generally, yes, but that's not a priority work for me. I've just happened to have the patch ready, so here it goes.
They should be converted, though, to be able to support PCI run-time PM.
Quoted 6 lines
It'll be a while before we get WoW enabled on ath5k but it is technically possible, the work was tested for ath9k back in July [2] but I never submitted this to be merged due to some inconsistent issues I was noticing with the hardware.
[2] http://kernel.org/pub/linux/kernel/people/mcgrof/patches/wow-07-21.patch
Thanks,
Rafael
Quoted 7 lines · Luis R. Rodriguez
Quoted 6 lines · Rafael J. Wysocki
From: Rafael J. Wysocki <[email protected]>
Simplify the suspend and resume callbacks of ath5k by converting the driver to struct
dev_pm_opsand allowing the PCI PM core to do the PCI-specific suspend/resume handling.
Quoted 5 lines
Quoted 1 line
Signed-off-by Rafael J. Wysocki <[email protected]>Do you happen to know if the new
dev_pm_opsthing handle WOL / WoW [1]?
It does enable wake-up at the PCI level if so configured, so in principle it should handle it. However, for WoL to work there are some things that the drivers is reponsible for, so I guess it will be analogous for WoW.
Anyway, the PCI-specific mechanics is there.
Quoted 16 lines
drivers/net/wireless/ath/ath5k/base.c ath5k_pci_remove(struct pci_dev *pdev) · line 681
Quoted 13 lines
#ifdef
CONFIG_PMdrivers/net/wireless/ath/ath5k/base.c +2
-6-static int -ath5k_pci_suspend (struct pci_dev *pdev,pm_message_t state) +static int ath5k_pci_suspend (struct device *dev) { -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;ath5k_led_off (sc); - -pci_save_state (pdev); -pci_disable_device (pdev);For WoW right here we'd do
Quoted 7 lines
pci_prepare_to_sleep(pdev)and bail out.Quoted 1 line
-
pci_set_power_state(pdev, PCI_D3hot);And here we'd call something like this:
pci_wake_from_d3(pdev, !!sc->wow_triggers_enabled);
All of this is unnecessary, the PCI PM core should take care of this just fine. In case it doesn't, it has to be fixed.
Quoted 5 lines
Quoted 3 lines
-
return 0;}
Are all drivers being converted?
Generally, yes, but that's not a priority work for me. I've just happened to have the patch ready, so here it goes.
They should be converted, though, to be able to support PCI run-time PM.
Quoted 6 lines
It'll be a while before we get WoW enabled on ath5k but it is technically possible, the work was tested for ath9k back in July [2] but I never submitted this to be merged due to some inconsistent issues I was noticing with the hardware.
[2] http://kernel.org/pub/linux/kernel/people/mcgrof/patches/wow-07-21.patch
Thanks,
Rafael