[PATCH 3/4][trusty] UBUNTU: SAUCE: iwlwifi: mvm: Only notify userspace of fw error dump when one is created

Seth Forshee seth.forshee at canonical.com
Thu Mar 20 15:02:58 UTC 2014


Signed-off-by: Seth Forshee <seth.forshee at canonical.com>
---
 drivers/net/wireless/iwlwifi/mvm/mac80211.c |  5 ++---
 drivers/net/wireless/iwlwifi/mvm/mvm.h      |  2 +-
 drivers/net/wireless/iwlwifi/mvm/ops.c      | 14 +++++++++++---
 3 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c
index c9db2c0..8814b1d 100644
--- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c
@@ -400,10 +400,9 @@ static void iwl_mvm_restart_cleanup(struct iwl_mvm *mvm)
 #ifdef CONFIG_IWLWIFI_DEBUGFS
 	static char *env[] = { "DRIVER=iwlwifi", "EVENT=error_dump", NULL };
 
-	iwl_mvm_fw_error_dump(mvm);
-
 	/* notify the userspace about the error we had */
-	kobject_uevent_env(&mvm->hw->wiphy->dev.kobj, KOBJ_CHANGE, env);
+	if (iwl_mvm_fw_error_dump(mvm))
+		kobject_uevent_env(&mvm->hw->wiphy->dev.kobj, KOBJ_CHANGE, env);
 #endif
 
 	iwl_trans_stop_device(mvm->trans);
diff --git a/drivers/net/wireless/iwlwifi/mvm/mvm.h b/drivers/net/wireless/iwlwifi/mvm/mvm.h
index 61ea7f9..ad0a631 100644
--- a/drivers/net/wireless/iwlwifi/mvm/mvm.h
+++ b/drivers/net/wireless/iwlwifi/mvm/mvm.h
@@ -604,7 +604,7 @@ void iwl_mvm_hwrate_to_tx_rate(u32 rate_n_flags,
 u8 iwl_mvm_mac80211_idx_to_hwrate(int rate_idx);
 void iwl_mvm_dump_nic_error_log(struct iwl_mvm *mvm);
 #ifdef CONFIG_IWLWIFI_DEBUGFS
-void iwl_mvm_fw_error_dump(struct iwl_mvm *mvm);
+bool iwl_mvm_fw_error_dump(struct iwl_mvm *mvm);
 void iwl_mvm_fw_error_sram_dump(struct iwl_mvm *mvm);
 #endif
 u8 first_antenna(u8 mask);
diff --git a/drivers/net/wireless/iwlwifi/mvm/ops.c b/drivers/net/wireless/iwlwifi/mvm/ops.c
index a390eaf..51459f5 100644
--- a/drivers/net/wireless/iwlwifi/mvm/ops.c
+++ b/drivers/net/wireless/iwlwifi/mvm/ops.c
@@ -757,7 +757,8 @@ static void iwl_mvm_nic_restart(struct iwl_mvm *mvm)
 }
 
 #ifdef CONFIG_IWLWIFI_DEBUGFS
-void iwl_mvm_fw_error_dump(struct iwl_mvm *mvm)
+/* Returns true if a dump was created */
+bool iwl_mvm_fw_error_dump(struct iwl_mvm *mvm)
 {
 	struct iwl_fw_error_dump_file *dump_file;
 	struct iwl_fw_error_dump_data *dump_data;
@@ -765,8 +766,13 @@ void iwl_mvm_fw_error_dump(struct iwl_mvm *mvm)
 
 	lockdep_assert_held(&mvm->mutex);
 
+	/*
+	 * Don't create an error dump if we'v already got one, but return
+	 * true to trigger a (re-?)notification to userspace that there's
+	 * something there to read.
+	 */
 	if (mvm->fw_error_dump)
-		return;
+		return true;
 
 	file_len = mvm->fw_error_sram_len +
 		   sizeof(*dump_file) +
@@ -774,7 +780,7 @@ void iwl_mvm_fw_error_dump(struct iwl_mvm *mvm)
 
 	dump_file = vmalloc(file_len);
 	if (!dump_file)
-		return;
+		return false;
 
 	mvm->fw_error_dump = dump_file;
 
@@ -793,6 +799,8 @@ void iwl_mvm_fw_error_dump(struct iwl_mvm *mvm)
 	kfree(mvm->fw_error_sram);
 	mvm->fw_error_sram = NULL;
 	mvm->fw_error_sram_len = 0;
+
+	return true;
 }
 #endif
 
-- 
1.9.0





More information about the kernel-team mailing list