diff options
author | David Woodhouse <dwmw2@infradead.org> | 2007-12-17 16:03:58 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 18:07:46 -0500 |
commit | 18c52e7c3e3d0e7fbddd0334b58030bb89554cb9 (patch) | |
tree | 32136eaa51bedb63013cb8eab4ad7fb98e2e2373 /drivers | |
parent | 8538823f7c692c98e8b7e19cb580faa56e25e89f (diff) |
libertas: make lbs_submit_command always 'succeed' and set command timer
Even if it fails, we want to wait a while and try again, with an
ultimate timeout if it the condition persists. So again, just use the
standard command timeout behaviour.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/libertas/cmd.c | 42 |
1 files changed, 20 insertions, 22 deletions
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index 10c60bab41f6..0ae98513ba88 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c | |||
@@ -1199,14 +1199,15 @@ done: | |||
1199 | lbs_deb_leave(LBS_DEB_HOST); | 1199 | lbs_deb_leave(LBS_DEB_HOST); |
1200 | } | 1200 | } |
1201 | 1201 | ||
1202 | static int lbs_submit_command(struct lbs_private *priv, | 1202 | static void lbs_submit_command(struct lbs_private *priv, |
1203 | struct cmd_ctrl_node *cmdnode) | 1203 | struct cmd_ctrl_node *cmdnode) |
1204 | { | 1204 | { |
1205 | unsigned long flags; | 1205 | unsigned long flags; |
1206 | struct cmd_header *cmd; | 1206 | struct cmd_header *cmd; |
1207 | int ret = -1; | 1207 | uint16_t cmdsize; |
1208 | u16 cmdsize; | 1208 | uint16_t command; |
1209 | u16 command; | 1209 | int timeo = 5 * HZ; |
1210 | int ret; | ||
1210 | 1211 | ||
1211 | lbs_deb_enter(LBS_DEB_HOST); | 1212 | lbs_deb_enter(LBS_DEB_HOST); |
1212 | 1213 | ||
@@ -1220,33 +1221,30 @@ static int lbs_submit_command(struct lbs_private *priv, | |||
1220 | cmdsize = le16_to_cpu(cmd->size); | 1221 | cmdsize = le16_to_cpu(cmd->size); |
1221 | command = le16_to_cpu(cmd->command); | 1222 | command = le16_to_cpu(cmd->command); |
1222 | 1223 | ||
1224 | /* These commands take longer */ | ||
1225 | if (command == CMD_802_11_SCAN || command == CMD_802_11_ASSOCIATE || | ||
1226 | command == CMD_802_11_AUTHENTICATE) | ||
1227 | timeo = 10 * HZ; | ||
1228 | |||
1223 | lbs_deb_host("DNLD_CMD: command 0x%04x, seq %d, size %d, jiffies %lu\n", | 1229 | lbs_deb_host("DNLD_CMD: command 0x%04x, seq %d, size %d, jiffies %lu\n", |
1224 | command, le16_to_cpu(cmd->seqnum), cmdsize, jiffies); | 1230 | command, le16_to_cpu(cmd->seqnum), cmdsize, jiffies); |
1225 | lbs_deb_hex(LBS_DEB_HOST, "DNLD_CMD", (void *) cmdnode->cmdbuf, cmdsize); | 1231 | lbs_deb_hex(LBS_DEB_HOST, "DNLD_CMD", (void *) cmdnode->cmdbuf, cmdsize); |
1226 | 1232 | ||
1227 | ret = priv->hw_host_to_card(priv, MVMS_CMD, (u8 *) cmd, cmdsize); | 1233 | ret = priv->hw_host_to_card(priv, MVMS_CMD, (u8 *) cmd, cmdsize); |
1234 | |||
1228 | if (ret) { | 1235 | if (ret) { |
1229 | lbs_pr_info("DNLD_CMD: hw_host_to_card failed: %d\n", ret); | 1236 | lbs_pr_info("DNLD_CMD: hw_host_to_card failed: %d\n", ret); |
1230 | spin_lock_irqsave(&priv->driver_lock, flags); | 1237 | /* Let the timer kick in and retry, and potentially reset |
1231 | lbs_complete_command(priv, priv->cur_cmd, ret); | 1238 | the whole thing if the condition persists */ |
1232 | spin_unlock_irqrestore(&priv->driver_lock, flags); | 1239 | timeo = HZ; |
1233 | goto done; | 1240 | } else |
1234 | } | 1241 | lbs_deb_cmd("DNLD_CMD: sent command 0x%04x, jiffies %lu\n", |
1235 | 1242 | command, jiffies); | |
1236 | lbs_deb_cmd("DNLD_CMD: sent command 0x%04x, jiffies %lu\n", command, jiffies); | ||
1237 | 1243 | ||
1238 | /* Setup the timer after transmit command */ | 1244 | /* Setup the timer after transmit command */ |
1239 | if (command == CMD_802_11_SCAN || command == CMD_802_11_AUTHENTICATE | 1245 | mod_timer(&priv->command_timer, jiffies + timeo); |
1240 | || command == CMD_802_11_ASSOCIATE) | ||
1241 | mod_timer(&priv->command_timer, jiffies + (10*HZ)); | ||
1242 | else | ||
1243 | mod_timer(&priv->command_timer, jiffies + (5*HZ)); | ||
1244 | |||
1245 | ret = 0; | ||
1246 | 1246 | ||
1247 | done: | 1247 | lbs_deb_leave(LBS_DEB_HOST); |
1248 | lbs_deb_leave_args(LBS_DEB_HOST, "ret %d", ret); | ||
1249 | return ret; | ||
1250 | } | 1248 | } |
1251 | 1249 | ||
1252 | static int lbs_cmd_mac_control(struct lbs_private *priv, | 1250 | static int lbs_cmd_mac_control(struct lbs_private *priv, |