b817316
From 3efd689c41080b0d4a9cc263a51f2868e3d5a37b Mon Sep 17 00:00:00 2001
b817316
From: Stanislaw Gruszka <sgruszka@redhat.com>
b817316
Date: Wed, 9 Oct 2013 15:03:57 +0200
b817316
Subject: [PATCH] iwlwifi: don't WARN on bad firmware state
b817316
b817316
When we restart firmware is possible and hance firmware is marked as not
b817316
alive, we can still get calls from mac80211. Don't WARN on in this
b817316
situation as this triggers automatic bug reports with no valuable
b817316
information.
b817316
b817316
This extend change from:
b817316
b817316
commit 8ca95995e64f5d270889badb3e449dca91106a2b
b817316
Author: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
b817316
Date:   Sun Sep 15 11:37:17 2013 +0300
b817316
b817316
    iwlwifi: don't WARN on host commands sent when firmware is dead
b817316
b817316
which remove WARN_ONCE from one place, but those warnings are also
b817316
triggered from other functions.
b817316
b817316
Patch adds also unlikely() statement.
b817316
b817316
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
b817316
---
b817316
 drivers/net/wireless/iwlwifi/iwl-trans.h |   22 +++++++++++-----------
b817316
 1 files changed, 11 insertions(+), 11 deletions(-)
b817316
b817316
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans.h b/drivers/net/wireless/iwlwifi/iwl-trans.h
b817316
index 80b4750..c6bac7c 100644
b817316
--- a/drivers/net/wireless/iwlwifi/iwl-trans.h
b817316
+++ b/drivers/net/wireless/iwlwifi/iwl-trans.h
b817316
@@ -601,7 +601,7 @@ static inline int iwl_trans_send_cmd(struct iwl_trans *trans,
b817316
 {
b817316
 	int ret;
b817316
 
b817316
-	if (trans->state != IWL_TRANS_FW_ALIVE) {
b817316
+	if (unlikely(trans->state != IWL_TRANS_FW_ALIVE)) {
b817316
 		IWL_ERR(trans, "%s bad state = %d", __func__, trans->state);
b817316
 		return -EIO;
b817316
 	}
b817316
@@ -640,8 +640,8 @@ static inline void iwl_trans_free_tx_cmd(struct iwl_trans *trans,
b817316
 static inline int iwl_trans_tx(struct iwl_trans *trans, struct sk_buff *skb,
b817316
 			       struct iwl_device_cmd *dev_cmd, int queue)
b817316
 {
b817316
-	WARN_ONCE(trans->state != IWL_TRANS_FW_ALIVE,
b817316
-		  "%s bad state = %d", __func__, trans->state);
b817316
+	if (unlikely(trans->state != IWL_TRANS_FW_ALIVE))
b817316
+		IWL_ERR(trans, "%s bad state = %d", __func__, trans->state);
b817316
 
b817316
 	return trans->ops->tx(trans, skb, dev_cmd, queue);
b817316
 }
b817316
@@ -649,16 +649,16 @@ static inline int iwl_trans_tx(struct iwl_trans *trans, struct sk_buff *skb,
b817316
 static inline void iwl_trans_reclaim(struct iwl_trans *trans, int queue,
b817316
 				     int ssn, struct sk_buff_head *skbs)
b817316
 {
b817316
-	WARN_ONCE(trans->state != IWL_TRANS_FW_ALIVE,
b817316
-		  "%s bad state = %d", __func__, trans->state);
b817316
+	if (unlikely(trans->state != IWL_TRANS_FW_ALIVE))
b817316
+		IWL_ERR(trans, "%s bad state = %d", __func__, trans->state);
b817316
 
b817316
 	trans->ops->reclaim(trans, queue, ssn, skbs);
b817316
 }
b817316
 
b817316
 static inline void iwl_trans_txq_disable(struct iwl_trans *trans, int queue)
b817316
 {
b817316
-	WARN_ONCE(trans->state != IWL_TRANS_FW_ALIVE,
b817316
-		  "%s bad state = %d", __func__, trans->state);
b817316
+	if (unlikely(trans->state != IWL_TRANS_FW_ALIVE))
b817316
+		IWL_ERR(trans, "%s bad state = %d", __func__, trans->state);
b817316
 
b817316
 	trans->ops->txq_disable(trans, queue);
b817316
 }
b817316
@@ -669,8 +669,8 @@ static inline void iwl_trans_txq_enable(struct iwl_trans *trans, int queue,
b817316
 {
b817316
 	might_sleep();
b817316
 
b817316
-	WARN_ONCE(trans->state != IWL_TRANS_FW_ALIVE,
b817316
-		  "%s bad state = %d", __func__, trans->state);
b817316
+	if (unlikely((trans->state != IWL_TRANS_FW_ALIVE)))
b817316
+		IWL_ERR(trans, "%s bad state = %d", __func__, trans->state);
b817316
 
b817316
 	trans->ops->txq_enable(trans, queue, fifo, sta_id, tid,
b817316
 				 frame_limit, ssn);
b817316
@@ -685,8 +685,8 @@ static inline void iwl_trans_ac_txq_enable(struct iwl_trans *trans, int queue,
b817316
 
b817316
 static inline int iwl_trans_wait_tx_queue_empty(struct iwl_trans *trans)
b817316
 {
b817316
-	WARN_ONCE(trans->state != IWL_TRANS_FW_ALIVE,
b817316
-		  "%s bad state = %d", __func__, trans->state);
b817316
+	if (unlikely(trans->state != IWL_TRANS_FW_ALIVE))
b817316
+		IWL_ERR(trans, "%s bad state = %d", __func__, trans->state);
b817316
 
b817316
 	return trans->ops->wait_tx_queue_empty(trans);
b817316
 }
b817316
-- 
b817316
1.7.1
b817316