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