* [PATCH] orinoco: correct timeout logic in __orinoco_hw_set_tkip_key()
@ 2009-04-10 1:41 Pavel Roskin
0 siblings, 0 replies; only message in thread
From: Pavel Roskin @ 2009-04-10 1:41 UTC (permalink / raw)
To: John W Linville, linux-wireless
If the value read from HERMES_RID_TXQUEUEEMPTY becomes 0 after exactly
100 readings, we wrongly consider it a timeout. Rewrite the clever
while loop as a for loop that does the right thing and looks simpler.
Reported by Juha Leppanen <juha_motorsportcom@luukku.com>
Signed-off-by: Pavel Roskin <proski@gnu.org>
---
drivers/net/wireless/orinoco/hw.c | 8 +++-----
1 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/net/wireless/orinoco/hw.c b/drivers/net/wireless/orinoco/hw.c
index 081428d..632fac8 100644
--- a/drivers/net/wireless/orinoco/hw.c
+++ b/drivers/net/wireless/orinoco/hw.c
@@ -372,15 +372,13 @@ int __orinoco_hw_set_tkip_key(hermes_t *hw, int key_idx, int set_tx,
}
/* Wait upto 100ms for tx queue to empty */
- k = 100;
- do {
- k--;
+ for (k = 100; k > 0; k--) {
udelay(1000);
ret = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_TXQUEUEEMPTY,
&xmitting);
- if (ret)
+ if (ret || !xmitting)
break;
- } while ((k > 0) && xmitting);
+ }
if (k == 0)
ret = -ETIMEDOUT;
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2009-04-10 1:41 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-10 1:41 [PATCH] orinoco: correct timeout logic in __orinoco_hw_set_tkip_key() Pavel Roskin
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).