]> git.baikalelectronics.ru Git - kernel.git/commitdiff
iwlwifi: dbg: make trigger functions type agnostic
authorSara Sharon <sara.sharon@intel.com>
Thu, 21 Jun 2018 11:44:28 +0000 (14:44 +0300)
committerLuca Coelho <luciano.coelho@intel.com>
Sat, 6 Oct 2018 07:25:55 +0000 (10:25 +0300)
As preparation for new trigger type, make iwl_fw_dbg_collect_desc
agnostic to the trigger structure.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/fw/dbg.c
drivers/net/wireless/intel/iwlwifi/fw/dbg.h
drivers/net/wireless/intel/iwlwifi/mvm/ops.c

index 1ae04577aed322278b88dd76054a246c21d12762..f44c716b113015a16911af216d203676e305a08e 100644 (file)
@@ -998,14 +998,9 @@ void iwl_fw_alive_error_dump(struct iwl_fw_runtime *fwrt)
 IWL_EXPORT_SYMBOL(iwl_fw_alive_error_dump);
 
 int iwl_fw_dbg_collect_desc(struct iwl_fw_runtime *fwrt,
-                           const struct iwl_fw_dump_desc *desc,
-                           const struct iwl_fw_dbg_trigger_tlv *trigger)
+                           const struct iwl_fw_dump_desc *desc, void *trigger,
+                           unsigned int delay)
 {
-       unsigned int delay = 0;
-
-       if (trigger)
-               delay = msecs_to_jiffies(le32_to_cpu(trigger->stop_delay));
-
        /*
         * If the loading of the FW completed successfully, the next step is to
         * get the SMEM config data. Thus, if fwrt->smem_cfg.num_lmacs is non
@@ -1047,31 +1042,35 @@ int iwl_fw_dbg_collect(struct iwl_fw_runtime *fwrt,
                       struct iwl_fw_dbg_trigger_tlv *trigger)
 {
        struct iwl_fw_dump_desc *desc;
+       unsigned int delay = 0;
 
-       if (trigger && !le16_to_cpu(trigger->occurrences))
-               return 0;
+       if (trigger) {
+               u16 occurrences = le16_to_cpu(trigger->occurrences) - 1;
 
-       if (trigger && trigger->flags & IWL_FW_DBG_FORCE_RESTART) {
-               IWL_WARN(fwrt, "Force restart: trigger %d fired.\n", trig);
-               iwl_force_nmi(fwrt->trans);
-               return 0;
+               if (!le16_to_cpu(trigger->occurrences))
+                       return 0;
+
+               if (trigger->flags & IWL_FW_DBG_FORCE_RESTART) {
+                       IWL_WARN(fwrt, "Force restart: trigger %d fired.\n",
+                                trig);
+                       iwl_force_nmi(fwrt->trans);
+                       return 0;
+               }
+
+               trigger->occurrences = cpu_to_le16(occurrences);
+               delay = le16_to_cpu(trigger->trig_dis_ms);
        }
 
        desc = kzalloc(sizeof(*desc) + len, GFP_ATOMIC);
        if (!desc)
                return -ENOMEM;
 
-       if (trigger) {
-               u16 occurrences = le16_to_cpu(trigger->occurrences) - 1;
-
-               trigger->occurrences = cpu_to_le16(occurrences);
-       }
 
        desc->len = len;
        desc->trig_desc.type = cpu_to_le32(trig);
        memcpy(desc->trig_desc.data, str, len);
 
-       return iwl_fw_dbg_collect_desc(fwrt, desc, trigger);
+       return iwl_fw_dbg_collect_desc(fwrt, desc, trigger, delay);
 }
 IWL_EXPORT_SYMBOL(iwl_fw_dbg_collect);
 
index 701bac1aba4d3dbcbf0bc21d83542f8166250660..d9578dcec24c98cde0c0982154ddc6c6667b8aae 100644 (file)
@@ -107,7 +107,7 @@ static inline void iwl_fw_free_dump_desc(struct iwl_fw_runtime *fwrt)
 void iwl_fw_error_dump(struct iwl_fw_runtime *fwrt);
 int iwl_fw_dbg_collect_desc(struct iwl_fw_runtime *fwrt,
                            const struct iwl_fw_dump_desc *desc,
-                           const struct iwl_fw_dbg_trigger_tlv *trigger);
+                           void *trigger, unsigned int delay);
 int iwl_fw_dbg_collect(struct iwl_fw_runtime *fwrt,
                       enum iwl_fw_dbg_trigger trig,
                       const char *str, size_t len,
index 3acf512bad47436da0e04ce00102669edc0d8003..0e2092526fae1d81623c08005bbf2f08ee8d7077 100644 (file)
@@ -1240,7 +1240,7 @@ void iwl_mvm_nic_restart(struct iwl_mvm *mvm, bool fw_error)
         */
        if (!mvm->fw_restart && fw_error) {
                iwl_fw_dbg_collect_desc(&mvm->fwrt, &iwl_dump_desc_assert,
-                                       NULL);
+                                       NULL, 0);
        } else if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) {
                struct iwl_mvm_reprobe *reprobe;