diff options
author | Pavel Roskin <proski@gnu.org> | 2007-06-20 23:56:20 -0400 |
---|---|---|
committer | Guido Guenther <agx@sigxcpu.org> | 2007-06-26 09:53:13 -0400 |
commit | 99fb0183fe404486674f73a3aa5b37b5e9e817d9 (patch) | |
tree | 5abac649db2e23766d2af33ffb58a66a2ebbfe6a | |
parent | c02cd537c8eb070640a552f0d0d242a9eef05667 (diff) |
[PATCH] Implement 5 second timeout in at76_wait_completion()
Signed-off-by: Pavel Roskin <proski@gnu.org>
-rw-r--r-- | at76_usb.c | 8 | ||||
-rw-r--r-- | at76_usb.h | 2 |
2 files changed, 9 insertions, 1 deletions
@@ -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; @@ -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 |