linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ath9k-htc: speedup disconnect handling
@ 2010-04-19 15:44 tom.leiming
  2010-04-20  4:31 ` Sujith
  0 siblings, 1 reply; 5+ messages in thread
From: tom.leiming @ 2010-04-19 15:44 UTC (permalink / raw)
  To: Sujith.Manoharan, lrodriguez; +Cc: linux-wireless, linville, Ming Lei

From: Ming Lei <tom.leiming@gmail.com>

This patch detects the disconnect in wmi register write path,
then speedup the disconnect handling.
---
 drivers/net/wireless/ath/ath9k/hw.c  |    2 ++
 drivers/net/wireless/ath/ath9k/hw.h  |    1 +
 drivers/net/wireless/ath/ath9k/wmi.c |    8 ++++++++
 3 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index 9aa40df..bcc48ff 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -111,6 +111,8 @@ bool ath9k_hw_wait(struct ath_hw *ah, u32 reg, u32 mask, u32 val, u32 timeout)
 	BUG_ON(timeout < AH_TIME_QUANTUM);
 
 	for (i = 0; i < (timeout / AH_TIME_QUANTUM); i++) {
+		if (AR_SREV_9271(ah) && ah->htc_disconnected)
+			break;
 		if ((REG_READ(ah, reg) & mask) == val)
 			return true;
 
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h
index 8158e8e..6b22158 100644
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
@@ -635,6 +635,7 @@ struct ath_hw {
 	u32 ah_flags;
 
 	bool htc_reset_init;
+	bool htc_disconnected;
 
 	enum nl80211_iftype opmode;
 	enum ath9k_power_mode power_mode;
diff --git a/drivers/net/wireless/ath/ath9k/wmi.c b/drivers/net/wireless/ath/ath9k/wmi.c
index dc6c6fc..fbd44c7 100644
--- a/drivers/net/wireless/ath/ath9k/wmi.c
+++ b/drivers/net/wireless/ath/ath9k/wmi.c
@@ -279,6 +279,9 @@ int ath9k_wmi_cmd(struct wmi *wmi, enum wmi_cmd_id cmd_id,
 	if (!wmi)
 		return -EINVAL;
 
+	if (ah->htc_disconnected)
+		return -ENODEV;
+
 	skb = alloc_skb(headroom + cmd_len, GFP_ATOMIC);
 	if (!skb)
 		return -ENOMEM;
@@ -324,6 +327,11 @@ int ath9k_wmi_cmd(struct wmi *wmi, enum wmi_cmd_id cmd_id,
 	return 0;
 
 out:
+	if (ret == -ENODEV) {
+		ah->htc_disconnected = 1;
+		ath_print(common, ATH_DBG_WMI,"HTC disconnected!\n");
+	}
+
 	ath_print(common, ATH_DBG_WMI,
 		  "WMI failure for: %s\n", wmi_cmd_to_name(cmd_id));
 	mutex_unlock(&wmi->op_mutex);
-- 
1.6.2.5


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-04-20  7:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-19 15:44 [PATCH] ath9k-htc: speedup disconnect handling tom.leiming
2010-04-20  4:31 ` Sujith
2010-04-20  5:59   ` Ming Lei
2010-04-20  6:41     ` Sujith
2010-04-20  7:46       ` Ming Lei

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).