ath10k: move fw_features to struct ath10k_fw_file
[cascardo/linux.git] / drivers / net / wireless / ath / ath10k / wow.c
index a68d8fd..77100d4 100644 (file)
@@ -233,7 +233,7 @@ int ath10k_wow_op_suspend(struct ieee80211_hw *hw,
        mutex_lock(&ar->conf_mutex);
 
        if (WARN_ON(!test_bit(ATH10K_FW_FEATURE_WOWLAN_SUPPORT,
-                             ar->fw_features))) {
+                             ar->running_fw->fw_file.fw_features))) {
                ret = 1;
                goto exit;
        }
@@ -285,7 +285,7 @@ int ath10k_wow_op_resume(struct ieee80211_hw *hw)
        mutex_lock(&ar->conf_mutex);
 
        if (WARN_ON(!test_bit(ATH10K_FW_FEATURE_WOWLAN_SUPPORT,
-                             ar->fw_features))) {
+                             ar->running_fw->fw_file.fw_features))) {
                ret = 1;
                goto exit;
        }
@@ -301,13 +301,32 @@ int ath10k_wow_op_resume(struct ieee80211_hw *hw)
                ath10k_warn(ar, "failed to wakeup from wow: %d\n", ret);
 
 exit:
+       if (ret) {
+               switch (ar->state) {
+               case ATH10K_STATE_ON:
+                       ar->state = ATH10K_STATE_RESTARTING;
+                       ret = 1;
+                       break;
+               case ATH10K_STATE_OFF:
+               case ATH10K_STATE_RESTARTING:
+               case ATH10K_STATE_RESTARTED:
+               case ATH10K_STATE_UTF:
+               case ATH10K_STATE_WEDGED:
+                       ath10k_warn(ar, "encountered unexpected device state %d on resume, cannot recover\n",
+                                   ar->state);
+                       ret = -EIO;
+                       break;
+               }
+       }
+
        mutex_unlock(&ar->conf_mutex);
-       return ret ? 1 : 0;
+       return ret;
 }
 
 int ath10k_wow_init(struct ath10k *ar)
 {
-       if (!test_bit(ATH10K_FW_FEATURE_WOWLAN_SUPPORT, ar->fw_features))
+       if (!test_bit(ATH10K_FW_FEATURE_WOWLAN_SUPPORT,
+                     ar->running_fw->fw_file.fw_features))
                return 0;
 
        if (WARN_ON(!test_bit(WMI_SERVICE_WOW, ar->wmi.svc_map)))