aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Roskin <proski@gnu.org>2007-06-20 23:56:20 -0400
committerGuido Guenther <agx@sigxcpu.org>2007-06-26 09:53:13 -0400
commit99fb0183fe404486674f73a3aa5b37b5e9e817d9 (patch)
tree5abac649db2e23766d2af33ffb58a66a2ebbfe6a
parentc02cd537c8eb070640a552f0d0d242a9eef05667 (diff)
[PATCH] Implement 5 second timeout in at76_wait_completion()
Signed-off-by: Pavel Roskin <proski@gnu.org>
-rw-r--r--at76_usb.c8
-rw-r--r--at76_usb.h2
2 files changed, 9 insertions, 1 deletions
diff --git a/at76_usb.c b/at76_usb.c
index 8ca14d2..3b1a1a4 100644
--- a/at76_usb.c
+++ b/at76_usb.c
@@ -786,8 +786,8 @@ static int at76_wait_completion(struct at76_priv *priv, int cmd)
{
struct net_device *netdev = priv->netdev;
int status = 0;
+ unsigned long timeout = jiffies + CMD_COMPLETION_TIMEOUT;
- /* TODO: should timeout */
do {
status = at76_get_cmd_status(priv->udev, cmd);
if (status < 0) {
@@ -806,6 +806,12 @@ static int at76_wait_completion(struct at76_priv *priv, int cmd)
schedule_timeout_interruptible(HZ / 10); /* 100 ms */
} else
break;
+ if (time_after(jiffies, timeout)) {
+ err("%s: timeout waiting for cmd %d completion",
+ netdev->name, cmd);
+ status = -ETIMEDOUT;
+ break;
+ }
} while (1);
return status;
diff --git a/at76_usb.h b/at76_usb.h
index 67ab610..691b837 100644
--- a/at76_usb.h
+++ b/at76_usb.h
@@ -621,6 +621,8 @@ struct at76_rx_radiotap {
#define BEACON_TIMEOUT 10
/* the interval in ticks we poll if scan is completed */
#define SCAN_POLL_INTERVAL (HZ/4)
+/* the interval in ticks to wait for a command to be completed */
+#define CMD_COMPLETION_TIMEOUT (5 * HZ)
#define DEF_RTS_THRESHOLD 1536
#define DEF_FRAG_THRESHOLD 1536