linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: tom.leiming@gmail.com
To: Sujith.Manoharan@atheros.com, lrodriguez@atheros.com
Cc: linux-wireless@vger.kernel.org, linville@tuxdriver.com,
	Ming Lei <tom.leiming@gmail.com>
Subject: [PATCH] ath9k-htc: speedup disconnect handling
Date: Mon, 19 Apr 2010 23:44:43 +0800	[thread overview]
Message-ID: <1271691883-13133-1-git-send-email-tom.leiming@gmail.com> (raw)

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


             reply	other threads:[~2010-04-19 15:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-19 15:44 tom.leiming [this message]
2010-04-20  4:31 ` [PATCH] ath9k-htc: speedup disconnect handling Sujith
2010-04-20  5:59   ` Ming Lei
2010-04-20  6:41     ` Sujith
2010-04-20  7:46       ` Ming Lei

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1271691883-13133-1-git-send-email-tom.leiming@gmail.com \
    --to=tom.leiming@gmail.com \
    --cc=Sujith.Manoharan@atheros.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=lrodriguez@atheros.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).