Linux wireless drivers development
 help / color / mirror / Atom feed
From: Luca Coelho <luca@coelho.fi>
To: kvalo@codeaurora.org
Cc: linux-wireless@vger.kernel.org, Luca Coelho <luciano.coelho@intel.com>
Subject: [PATCH 5/9] iwlwifi: mvm: move umac_error_event_table validity check to where it's set
Date: Fri, 13 Oct 2017 16:24:58 +0300	[thread overview]
Message-ID: <20171013132502.10473-6-luca@coelho.fi> (raw)
In-Reply-To: <20171013132502.10473-1-luca@coelho.fi>

From: Luca Coelho <luciano.coelho@intel.com>

There's no point in checking the validity of the
umac_error_event_table pointer every time we generate a dump.  It's
cleaner to do so when we read the value, namely when we receive the
alive data.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
---
 drivers/net/wireless/intel/iwlwifi/mvm/fw.c    | 13 +++++++++++--
 drivers/net/wireless/intel/iwlwifi/mvm/utils.c | 18 ++++--------------
 2 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
index f476882291ae..70d0505a176e 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
@@ -200,10 +200,19 @@ static bool iwl_alive_fn(struct iwl_notif_wait_data *notif_wait,
 
 	mvm->umac_error_event_table = le32_to_cpu(umac->error_info_addr);
 
+	if (mvm->umac_error_event_table <
+	    (mvm->trans->cfg->device_family == IWL_DEVICE_FAMILY_A000 ?
+	     0x400000 : 0x800000))
+		IWL_ERR(mvm,
+			"Not valid error log pointer 0x%08X for %s uCode\n",
+			mvm->umac_error_event_table,
+			(mvm->fwrt.cur_fw_img == IWL_UCODE_INIT) ?
+			"Init" : "RT");
+	else
+		mvm->support_umac_log = true;
+
 	alive_data->scd_base_addr = le32_to_cpu(lmac1->scd_base_ptr);
 	alive_data->valid = status == IWL_ALIVE_STATUS_OK;
-	if (mvm->umac_error_event_table)
-		mvm->support_umac_log = true;
 
 	IWL_DEBUG_FW(mvm,
 		     "Alive ucode status 0x%04x revision 0x%01X 0x%01X\n",
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/utils.c b/drivers/net/wireless/intel/iwlwifi/mvm/utils.c
index 4ade688db63b..d46115e2d69e 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/utils.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/utils.c
@@ -455,21 +455,12 @@ static void iwl_mvm_dump_umac_error_log(struct iwl_mvm *mvm)
 {
 	struct iwl_trans *trans = mvm->trans;
 	struct iwl_umac_error_event_table table;
-	u32 base;
 
-	base = mvm->umac_error_event_table;
-
-	if (base < (mvm->trans->cfg->device_family == IWL_DEVICE_FAMILY_A000 ?
-		    0x400000 : 0x800000)) {
-		IWL_ERR(mvm,
-			"Not valid error log pointer 0x%08X for %s uCode\n",
-			base,
-			(mvm->fwrt.cur_fw_img == IWL_UCODE_INIT)
-			? "Init" : "RT");
+	if (!mvm->support_umac_log)
 		return;
-	}
 
-	iwl_trans_read_mem_bytes(trans, base, &table, sizeof(table));
+	iwl_trans_read_mem_bytes(trans, mvm->umac_error_event_table, &table,
+				 sizeof(table));
 
 	if (ERROR_START_OFFSET <= table.valid * ERROR_ELEM_SIZE) {
 		IWL_ERR(trans, "Start IWL Error Log Dump:\n");
@@ -609,8 +600,7 @@ void iwl_mvm_dump_nic_error_log(struct iwl_mvm *mvm)
 	if (mvm->error_event_table[1])
 		iwl_mvm_dump_lmac_error_log(mvm, mvm->error_event_table[1]);
 
-	if (mvm->support_umac_log)
-		iwl_mvm_dump_umac_error_log(mvm);
+	iwl_mvm_dump_umac_error_log(mvm);
 }
 
 int iwl_mvm_find_free_queue(struct iwl_mvm *mvm, u8 sta_id, u8 minq, u8 maxq)
-- 
2.14.2

  parent reply	other threads:[~2017-10-13 13:25 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-13 13:24 [PATCH 0/9] ] iwlwifi: updates intended for v4.15 2017-10-13 Luca Coelho
2017-10-13 13:24 ` [PATCH 1/9] iwlwifi: mvm: allocate reorder buffer according to need Luca Coelho
2017-10-13 13:24 ` [PATCH 2/9] iwlwifi: mvm: remove duplicated fields in mvm reorder buffer Luca Coelho
2017-10-13 13:24 ` [PATCH 3/9] iwlwifi: mvm: pass baid_data to iwl_mvm_release_frames() Luca Coelho
2017-10-13 13:24 ` [PATCH 4/9] iwlwifi: mvm: allow reading UMAC error data from SMEM in A000 devices Luca Coelho
2017-10-13 13:24 ` Luca Coelho [this message]
2017-10-13 13:24 ` [PATCH 6/9] iwlwifi: define minimum valid address for umac_error_event_table in cfg Luca Coelho
2017-10-13 13:25 ` [PATCH 7/9] iwlwifi: mvm: add missing lq_color Luca Coelho
2017-10-18  6:31   ` [PATCH v2 " Luca Coelho
2017-10-13 13:25 ` [PATCH 8/9] iwlwifi: pcie: sort IDs for the 9000 series for easier comparisons Luca Coelho
2017-10-13 13:25 ` [PATCH 9/9] iwlwifi: pcie: remove set but not used variable tcph Luca Coelho

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171013132502.10473-6-luca@coelho.fi \
    --to=luca@coelho.fi \
    --cc=kvalo@codeaurora.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=luciano.coelho@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox