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