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