Commit 18c52e7c authored by David Woodhouse's avatar David Woodhouse Committed by David S. Miller

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: default avatarDavid Woodhouse <dwmw2@infradead.org>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 8538823f
...@@ -1199,14 +1199,15 @@ static void lbs_queue_cmd(struct lbs_private *priv, ...@@ -1199,14 +1199,15 @@ static void lbs_queue_cmd(struct lbs_private *priv,
lbs_deb_leave(LBS_DEB_HOST); lbs_deb_leave(LBS_DEB_HOST);
} }
static int lbs_submit_command(struct lbs_private *priv, static void lbs_submit_command(struct lbs_private *priv,
struct cmd_ctrl_node *cmdnode) struct cmd_ctrl_node *cmdnode)
{ {
unsigned long flags; unsigned long flags;
struct cmd_header *cmd; struct cmd_header *cmd;
int ret = -1; uint16_t cmdsize;
u16 cmdsize; uint16_t command;
u16 command; int timeo = 5 * HZ;
int ret;
lbs_deb_enter(LBS_DEB_HOST); lbs_deb_enter(LBS_DEB_HOST);
...@@ -1220,33 +1221,30 @@ static int lbs_submit_command(struct lbs_private *priv, ...@@ -1220,33 +1221,30 @@ static int lbs_submit_command(struct lbs_private *priv,
cmdsize = le16_to_cpu(cmd->size); cmdsize = le16_to_cpu(cmd->size);
command = le16_to_cpu(cmd->command); command = le16_to_cpu(cmd->command);
/* These commands take longer */
if (command == CMD_802_11_SCAN || command == CMD_802_11_ASSOCIATE ||
command == CMD_802_11_AUTHENTICATE)
timeo = 10 * HZ;
lbs_deb_host("DNLD_CMD: command 0x%04x, seq %d, size %d, jiffies %lu\n", lbs_deb_host("DNLD_CMD: command 0x%04x, seq %d, size %d, jiffies %lu\n",
command, le16_to_cpu(cmd->seqnum), cmdsize, jiffies); command, le16_to_cpu(cmd->seqnum), cmdsize, jiffies);
lbs_deb_hex(LBS_DEB_HOST, "DNLD_CMD", (void *) cmdnode->cmdbuf, cmdsize); lbs_deb_hex(LBS_DEB_HOST, "DNLD_CMD", (void *) cmdnode->cmdbuf, cmdsize);
ret = priv->hw_host_to_card(priv, MVMS_CMD, (u8 *) cmd, cmdsize); ret = priv->hw_host_to_card(priv, MVMS_CMD, (u8 *) cmd, cmdsize);
if (ret) { if (ret) {
lbs_pr_info("DNLD_CMD: hw_host_to_card failed: %d\n", ret); lbs_pr_info("DNLD_CMD: hw_host_to_card failed: %d\n", ret);
spin_lock_irqsave(&priv->driver_lock, flags); /* Let the timer kick in and retry, and potentially reset
lbs_complete_command(priv, priv->cur_cmd, ret); the whole thing if the condition persists */
spin_unlock_irqrestore(&priv->driver_lock, flags); timeo = HZ;
goto done; } else
} lbs_deb_cmd("DNLD_CMD: sent command 0x%04x, jiffies %lu\n",
command, jiffies);
lbs_deb_cmd("DNLD_CMD: sent command 0x%04x, jiffies %lu\n", command, jiffies);
/* Setup the timer after transmit command */ /* Setup the timer after transmit command */
if (command == CMD_802_11_SCAN || command == CMD_802_11_AUTHENTICATE mod_timer(&priv->command_timer, jiffies + timeo);
|| command == CMD_802_11_ASSOCIATE)
mod_timer(&priv->command_timer, jiffies + (10*HZ));
else
mod_timer(&priv->command_timer, jiffies + (5*HZ));
ret = 0;
done: lbs_deb_leave(LBS_DEB_HOST);
lbs_deb_leave_args(LBS_DEB_HOST, "ret %d", ret);
return ret;
} }
static int lbs_cmd_mac_control(struct lbs_private *priv, static int lbs_cmd_mac_control(struct lbs_private *priv,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment