OSDN Git Service

iwlwifi: mvm: remove the read_nvm from iwl_run_init_mvm_ucode
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Wed, 9 Dec 2020 21:16:13 +0000 (23:16 +0200)
committerLuca Coelho <luciano.coelho@intel.com>
Wed, 9 Dec 2020 22:11:19 +0000 (00:11 +0200)
If we already read the NVM, we don't need to read it again.
Make sure that this is the case with a WARNING.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20201209231352.8e0ffce7f873.Ie526042c4d4b93d9116c90f53180cbadef0b32cb@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/mvm/fw.c
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
drivers/net/wireless/intel/iwlwifi/mvm/ops.c

index 6385b96..a31a77f 100644 (file)
@@ -647,7 +647,7 @@ static int iwl_send_phy_cfg_cmd(struct iwl_mvm *mvm)
                                    cmd_size, &phy_cfg_cmd);
 }
 
-int iwl_run_init_mvm_ucode(struct iwl_mvm *mvm, bool read_nvm)
+int iwl_run_init_mvm_ucode(struct iwl_mvm *mvm)
 {
        struct iwl_notification_wait calib_wait;
        static const u16 init_complete[] = {
@@ -684,7 +684,7 @@ int iwl_run_init_mvm_ucode(struct iwl_mvm *mvm, bool read_nvm)
        }
 
        /* Read the NVM only at driver load time, no need to do this twice */
-       if (read_nvm) {
+       if (!mvm->nvm_data) {
                ret = iwl_nvm_init(mvm);
                if (ret) {
                        IWL_ERR(mvm, "Failed to read NVM: %d\n", ret);
@@ -1332,7 +1332,8 @@ static int iwl_mvm_load_rt_fw(struct iwl_mvm *mvm)
        if (iwl_mvm_has_unified_ucode(mvm))
                return iwl_run_unified_mvm_ucode(mvm, false);
 
-       ret = iwl_run_init_mvm_ucode(mvm, false);
+       WARN_ON(!mvm->nvm_data);
+       ret = iwl_run_init_mvm_ucode(mvm);
 
        if (ret) {
                IWL_ERR(mvm, "Failed to run INIT ucode: %d\n", ret);
index 7159d1d..a27ac30 100644 (file)
@@ -1481,7 +1481,7 @@ int __iwl_mvm_mac_start(struct iwl_mvm *mvm);
  * MVM Methods
  ******************/
 /* uCode */
-int iwl_run_init_mvm_ucode(struct iwl_mvm *mvm, bool read_nvm);
+int iwl_run_init_mvm_ucode(struct iwl_mvm *mvm);
 
 /* Utils */
 int iwl_mvm_legacy_rate_to_mac80211_idx(u32 rate_n_flags,
index f1c5b3a..da55133 100644 (file)
@@ -822,7 +822,7 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg,
                goto out_free;
 
        mutex_lock(&mvm->mutex);
-       err = iwl_run_init_mvm_ucode(mvm, true);
+       err = iwl_run_init_mvm_ucode(mvm);
        if (err && err != -ERFKILL)
                iwl_fw_dbg_error_collect(&mvm->fwrt, FW_DBG_TRIGGER_DRIVER);
        if (!iwlmvm_mod_params.init_dbg || !err)