Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ath9k: Fix wow init/deinit

Registering the card as a wakeup source needs to
be done once, during initialization. When the WOW
configuration changes, the card's status as wakeup
source needs to be changed too and this is done
via the set_wakeup() callback. Also, make sure
the device is removed properly using ath9k_deinit_wow().

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>

authored by

Sujith Manoharan and committed by
Kalle Valo
661d2581 1331f5a7

+23 -4
+4
drivers/net/wireless/ath/ath9k/ath9k.h
··· 838 838 839 839 #ifdef CONFIG_ATH9K_WOW 840 840 void ath9k_init_wow(struct ieee80211_hw *hw); 841 + void ath9k_deinit_wow(struct ieee80211_hw *hw); 841 842 int ath9k_suspend(struct ieee80211_hw *hw, 842 843 struct cfg80211_wowlan *wowlan); 843 844 int ath9k_resume(struct ieee80211_hw *hw); 844 845 void ath9k_set_wakeup(struct ieee80211_hw *hw, bool enabled); 845 846 #else 846 847 static inline void ath9k_init_wow(struct ieee80211_hw *hw) 848 + { 849 + } 850 + static inline void ath9k_deinit_wow(struct ieee80211_hw *hw) 847 851 { 848 852 } 849 853 static inline int ath9k_suspend(struct ieee80211_hw *hw,
+1
drivers/net/wireless/ath/ath9k/init.c
··· 996 996 ath9k_ps_restore(sc); 997 997 998 998 ath9k_deinit_debug(sc); 999 + ath9k_deinit_wow(hw); 999 1000 ieee80211_unregister_hw(hw); 1000 1001 ath_rx_cleanup(sc); 1001 1002 ath9k_deinit_softc(sc);
+18 -4
drivers/net/wireless/ath/ath9k/wow.c
··· 336 336 void ath9k_set_wakeup(struct ieee80211_hw *hw, bool enabled) 337 337 { 338 338 struct ath_softc *sc = hw->priv; 339 + struct ath_common *common = ath9k_hw_common(sc->sc_ah); 339 340 340 341 mutex_lock(&sc->mutex); 341 - device_init_wakeup(sc->dev, 1); 342 342 device_set_wakeup_enable(sc->dev, enabled); 343 343 mutex_unlock(&sc->mutex); 344 + 345 + ath_dbg(common, WOW, "WoW wakeup source is %s\n", 346 + (enabled) ? "enabled" : "disabled"); 344 347 } 345 348 346 349 void ath9k_init_wow(struct ieee80211_hw *hw) 347 350 { 348 351 struct ath_softc *sc = hw->priv; 349 352 350 - if ((sc->driver_data & ATH9K_PCI_WOW) && device_can_wakeup(sc->dev)) 353 + if (sc->driver_data & ATH9K_PCI_WOW) { 351 354 hw->wiphy->wowlan = &ath9k_wowlan_support; 352 355 353 - atomic_set(&sc->wow_sleep_proc_intr, -1); 354 - atomic_set(&sc->wow_got_bmiss_intr, -1); 356 + atomic_set(&sc->wow_sleep_proc_intr, -1); 357 + atomic_set(&sc->wow_got_bmiss_intr, -1); 358 + 359 + device_init_wakeup(sc->dev, 1); 360 + } 361 + } 362 + 363 + void ath9k_deinit_wow(struct ieee80211_hw *hw) 364 + { 365 + struct ath_softc *sc = hw->priv; 366 + 367 + if (sc->driver_data & ATH9K_PCI_WOW) 368 + device_init_wakeup(sc->dev, 0); 355 369 }