iwlwifi: mvm: update ucode status before stopping device
authorChaya Rachel Ivgi <chaya.rachel.ivgi@intel.com>
Mon, 22 Feb 2016 08:21:41 +0000 (10:21 +0200)
committerEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Wed, 2 Mar 2016 06:56:58 +0000 (08:56 +0200)
Leaving ucode_loaded to true after stop_device() has been called
is a recipe for problems. Flows that are not sync'ed with the
driver life cycle (like debugfs hooks and thermal hooks) must
check that the firmware is loaded before they interact with it.
Therefore we need to keep this variable updated with the real
status of the firmware.

Signed-off-by: Chaya Rachel Ivgi <chaya.rachel.ivgi@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
drivers/net/wireless/intel/iwlwifi/mvm/d3.c
drivers/net/wireless/intel/iwlwifi/mvm/fw.c
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
drivers/net/wireless/intel/iwlwifi/mvm/ops.c

index cf5e6349301e7ca75bb2f847652fa264dbdf490d..c1a313149eed876fea73a764d0d519e0244c6e9d 100644 (file)
@@ -816,8 +816,7 @@ static int iwl_mvm_switch_to_d3(struct iwl_mvm *mvm)
 {
        iwl_mvm_scan_stop(mvm, IWL_MVM_SCAN_REGULAR, true);
 
-       iwl_trans_stop_device(mvm->trans);
-
+       iwl_mvm_stop_device(mvm);
        /*
         * Set the HW restart bit -- this is mostly true as we're
         * going to load new firmware and reprogram that, though
index f075c36a77c516312beb4aaa4a370869030d2849..efec6ec22f58f71f1a91288ad88a454c488a079b 100644 (file)
@@ -1009,7 +1009,7 @@ int iwl_mvm_up(struct iwl_mvm *mvm)
        IWL_DEBUG_INFO(mvm, "RT uCode started.\n");
        return 0;
  error:
-       iwl_trans_stop_device(mvm->trans);
+       iwl_mvm_stop_device(mvm);
        return ret;
 }
 
@@ -1053,7 +1053,7 @@ int iwl_mvm_load_d3_fw(struct iwl_mvm *mvm)
 
        return 0;
  error:
-       iwl_trans_stop_device(mvm->trans);
+       iwl_mvm_stop_device(mvm);
        return ret;
 }
 
index 927b0559d42d371d8bd6309ebb5b17060255fb8d..ec6b07282e7dd84c7df6b8c825c3c7e929ed832d 100644 (file)
@@ -972,7 +972,7 @@ static void iwl_mvm_restart_cleanup(struct iwl_mvm *mvm)
         */
        iwl_mvm_unref_all_except(mvm, IWL_MVM_REF_UCODE_DOWN);
 
-       iwl_trans_stop_device(mvm->trans);
+       iwl_mvm_stop_device(mvm);
 
        mvm->scan_status = 0;
        mvm->ps_disabled = false;
@@ -1141,7 +1141,7 @@ void __iwl_mvm_mac_stop(struct iwl_mvm *mvm)
         */
        flush_work(&mvm->roc_done_wk);
 
-       iwl_trans_stop_device(mvm->trans);
+       iwl_mvm_stop_device(mvm);
 
        iwl_mvm_async_handlers_purge(mvm);
        /* async_handlers_list is empty and will stay empty: HW is stopped */
@@ -1172,8 +1172,6 @@ void __iwl_mvm_mac_stop(struct iwl_mvm *mvm)
                                mvm->scan_uid_status[i] = 0;
                }
        }
-
-       mvm->ucode_loaded = false;
 }
 
 static void iwl_mvm_mac_stop(struct ieee80211_hw *hw)
index b461b909e7afaef60d40921978e15caba314c48f..6d4e4879357c8f35a83ce6ca10cbdbabbfe76f81 100644 (file)
@@ -1549,6 +1549,12 @@ void iwl_mvm_enable_ac_txq(struct iwl_mvm *mvm, int queue, int mac80211_queue,
        iwl_mvm_enable_txq(mvm, queue, mac80211_queue, ssn, &cfg, wdg_timeout);
 }
 
+static inline void iwl_mvm_stop_device(struct iwl_mvm *mvm)
+{
+       mvm->ucode_loaded = false;
+       iwl_trans_stop_device(mvm->trans);
+}
+
 /* Thermal management and CT-kill */
 void iwl_mvm_tt_tx_backoff(struct iwl_mvm *mvm, u32 backoff);
 void iwl_mvm_tt_temp_changed(struct iwl_mvm *mvm, u32 temp);
index 8bdaa7b27ab18ece925924b8c96215a7597f6e36..4716176cbfe0d5c83f8d88cbd430e564fa413dfe 100644 (file)
@@ -643,7 +643,7 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg,
                iwl_mvm_ref(mvm, IWL_MVM_REF_INIT_UCODE);
                err = iwl_run_init_mvm_ucode(mvm, true);
                if (!err || !iwlmvm_mod_params.init_dbg)
-                       iwl_trans_stop_device(trans);
+                       iwl_mvm_stop_device(mvm);
                iwl_mvm_unref(mvm, IWL_MVM_REF_INIT_UCODE);
                mutex_unlock(&mvm->mutex);
                /* returns 0 if successful, 1 if success but in rfkill */
This page took 0.052958 seconds and 5 git commands to generate.