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

libertas: store command result in cmdnode instead of priv->cur_cmd_retcode

... at least for users of __lbs_cmd().
Signed-off-by: default avatarDavid Woodhouse <dwmw2@infradead.org>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 75567670
...@@ -1173,6 +1173,7 @@ void lbs_queue_cmd(struct lbs_private *priv, ...@@ -1173,6 +1173,7 @@ void lbs_queue_cmd(struct lbs_private *priv,
lbs_deb_host("DNLD_CMD: cmd size is zero\n"); lbs_deb_host("DNLD_CMD: cmd size is zero\n");
goto done; goto done;
} }
cmdnode->result = 0;
/* Exit_PS command needs to be queued in the header always. */ /* Exit_PS command needs to be queued in the header always. */
if (le16_to_cpu(cmdnode->cmdbuf->command) == CMD_802_11_PS_MODE) { if (le16_to_cpu(cmdnode->cmdbuf->command) == CMD_802_11_PS_MODE) {
...@@ -1306,6 +1307,7 @@ void lbs_complete_command(struct lbs_private *priv, struct cmd_ctrl_node *cmd, ...@@ -1306,6 +1307,7 @@ void lbs_complete_command(struct lbs_private *priv, struct cmd_ctrl_node *cmd,
if (cmd == priv->cur_cmd) if (cmd == priv->cur_cmd)
priv->cur_cmd_retcode = result; priv->cur_cmd_retcode = result;
cmd->result = result;
cmd->cmdwaitqwoken = 1; cmd->cmdwaitqwoken = 1;
wake_up_interruptible(&cmd->cmdwait_q); wake_up_interruptible(&cmd->cmdwait_q);
...@@ -2212,12 +2214,10 @@ int __lbs_cmd(struct lbs_private *priv, uint16_t command, ...@@ -2212,12 +2214,10 @@ int __lbs_cmd(struct lbs_private *priv, uint16_t command,
wait_event_interruptible(cmdnode->cmdwait_q, cmdnode->cmdwaitqwoken); wait_event_interruptible(cmdnode->cmdwait_q, cmdnode->cmdwaitqwoken);
spin_lock_irqsave(&priv->driver_lock, flags); spin_lock_irqsave(&priv->driver_lock, flags);
if (priv->cur_cmd_retcode) { ret = cmdnode->result;
lbs_deb_host("PREP_CMD: command failed with return code %d\n", if (ret)
priv->cur_cmd_retcode); lbs_pr_info("PREP_CMD: command 0x%04x failed: %d\n",
priv->cur_cmd_retcode = 0; command, ret);
ret = -1;
}
__lbs_cleanup_and_insert_cmd(priv, cmdnode); __lbs_cleanup_and_insert_cmd(priv, cmdnode);
spin_unlock_irqrestore(&priv->driver_lock, flags); spin_unlock_irqrestore(&priv->driver_lock, flags);
......
...@@ -74,6 +74,7 @@ struct cmd_header { ...@@ -74,6 +74,7 @@ struct cmd_header {
struct cmd_ctrl_node { struct cmd_ctrl_node {
struct list_head list; struct list_head list;
int result;
/* command response */ /* command response */
int (*callback)(struct lbs_private *, unsigned long, struct cmd_header *); int (*callback)(struct lbs_private *, unsigned long, struct cmd_header *);
unsigned long callback_arg; unsigned long callback_arg;
......
...@@ -1237,6 +1237,7 @@ int lbs_stop_card(struct lbs_private *priv) ...@@ -1237,6 +1237,7 @@ int lbs_stop_card(struct lbs_private *priv)
/* Flush pending command nodes */ /* Flush pending command nodes */
spin_lock_irqsave(&priv->driver_lock, flags); spin_lock_irqsave(&priv->driver_lock, flags);
list_for_each_entry(cmdnode, &priv->cmdpendingq, list) { list_for_each_entry(cmdnode, &priv->cmdpendingq, list) {
cmdnode->result = -ENOENT;
cmdnode->cmdwaitqwoken = 1; cmdnode->cmdwaitqwoken = 1;
wake_up_interruptible(&cmdnode->cmdwait_q); wake_up_interruptible(&cmdnode->cmdwait_q);
} }
......
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