summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/orinoco/hw.c
diff options
context:
space:
mode:
authorPavel Roskin <proski@gnu.org>2009-04-09 21:41:05 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-04-16 10:39:17 -0400
commit91fe9ca74e8220f17e2fa71a92cda330857daac4 (patch)
tree314ba52fbd244015f0e8ce2864c1c2b7117e29c0 /drivers/net/wireless/orinoco/hw.c
parent23a99840d571a237845fd0906bce78e7c76be650 (diff)
downloadop-kernel-dev-91fe9ca74e8220f17e2fa71a92cda330857daac4.zip
op-kernel-dev-91fe9ca74e8220f17e2fa71a92cda330857daac4.tar.gz
orinoco: correct timeout logic in __orinoco_hw_set_tkip_key()
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> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/orinoco/hw.c')
-rw-r--r--drivers/net/wireless/orinoco/hw.c8
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;
OpenPOWER on IntegriCloud