]> git.baikalelectronics.ru Git - kernel.git/commitdiff
iwlwifi: dbg: decrement occurrences for all triggers
authorSara Sharon <sara.sharon@intel.com>
Thu, 21 Jun 2018 11:24:45 +0000 (14:24 +0300)
committerLuca Coelho <luciano.coelho@intel.com>
Sat, 6 Oct 2018 07:25:54 +0000 (10:25 +0300)
iwl_fw_dbg_collect can be called by any function that already
has the error string ready. iwl_fw_dbg_collect_trig, on the
other hand, does string formatting. The occurrences decrement
is at iwl_fw_dbg_collect_trig, instead of iwl_fw_dbg_collect,
which causes it to sometimes be skipped. Move it to the right
location.

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

index a049367ac08a5e74ff44b1cf27f573a0f2b375b8..1ae04577aed322278b88dd76054a246c21d12762 100644 (file)
@@ -1044,10 +1044,13 @@ IWL_EXPORT_SYMBOL(iwl_fw_dbg_collect_desc);
 int iwl_fw_dbg_collect(struct iwl_fw_runtime *fwrt,
                       enum iwl_fw_dbg_trigger trig,
                       const char *str, size_t len,
-                      const struct iwl_fw_dbg_trigger_tlv *trigger)
+                      struct iwl_fw_dbg_trigger_tlv *trigger)
 {
        struct iwl_fw_dump_desc *desc;
 
+       if (trigger && !le16_to_cpu(trigger->occurrences))
+               return 0;
+
        if (trigger && trigger->flags & IWL_FW_DBG_FORCE_RESTART) {
                IWL_WARN(fwrt, "Force restart: trigger %d fired.\n", trig);
                iwl_force_nmi(fwrt->trans);
@@ -1058,6 +1061,12 @@ int iwl_fw_dbg_collect(struct iwl_fw_runtime *fwrt,
        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);
@@ -1070,13 +1079,9 @@ int iwl_fw_dbg_collect_trig(struct iwl_fw_runtime *fwrt,
                            struct iwl_fw_dbg_trigger_tlv *trigger,
                            const char *fmt, ...)
 {
-       u16 occurrences = le16_to_cpu(trigger->occurrences);
        int ret, len = 0;
        char buf[64];
 
-       if (!occurrences)
-               return 0;
-
        if (fmt) {
                va_list ap;
 
@@ -1099,7 +1104,6 @@ int iwl_fw_dbg_collect_trig(struct iwl_fw_runtime *fwrt,
        if (ret)
                return ret;
 
-       trigger->occurrences = cpu_to_le16(occurrences - 1);
        return 0;
 }
 IWL_EXPORT_SYMBOL(iwl_fw_dbg_collect_trig);
index bee7a938a72195684645b794fc5914427b37586e..701bac1aba4d3dbcbf0bc21d83542f8166250660 100644 (file)
@@ -111,7 +111,7 @@ int iwl_fw_dbg_collect_desc(struct iwl_fw_runtime *fwrt,
 int iwl_fw_dbg_collect(struct iwl_fw_runtime *fwrt,
                       enum iwl_fw_dbg_trigger trig,
                       const char *str, size_t len,
-                      const struct iwl_fw_dbg_trigger_tlv *trigger);
+                      struct iwl_fw_dbg_trigger_tlv *trigger);
 int iwl_fw_dbg_collect_trig(struct iwl_fw_runtime *fwrt,
                            struct iwl_fw_dbg_trigger_tlv *trigger,
                            const char *fmt, ...) __printf(3, 4);