diff options
author | David Woodhouse <dwmw2@infradead.org> | 2007-12-15 01:52:54 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 15:07:31 -0800 |
commit | 183aeac1c49869ba9a14c7ead86ce268da397a0e (patch) | |
tree | ed78bb49daf3570b5b99a1d93408261b9680478e /drivers/net/wireless/libertas/cmd.c | |
parent | c4ab41272b55a08741d2e68966aae700e2e6d597 (diff) |
libertas: introduce and use lbs_complete_command() for command completion
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/libertas/cmd.c')
-rw-r--r-- | drivers/net/wireless/libertas/cmd.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index 4ffb84a403b..9c73902ca86 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -1230,9 +1230,7 @@ static int lbs_submit_command(struct lbs_private *priv, if (ret) { lbs_pr_info("DNLD_CMD: hw_host_to_card failed: %d\n", ret); spin_lock_irqsave(&priv->driver_lock, flags); - priv->cur_cmd_retcode = ret; - __lbs_cleanup_and_insert_cmd(priv, priv->cur_cmd); - priv->cur_cmd = NULL; + lbs_complete_command(priv, priv->cur_cmd, ret); spin_unlock_irqrestore(&priv->driver_lock, flags); goto done; } @@ -1275,8 +1273,8 @@ static int lbs_cmd_mac_control(struct lbs_private *priv, * This function inserts command node to cmdfreeq * after cleans it. Requires priv->driver_lock held. */ -void __lbs_cleanup_and_insert_cmd(struct lbs_private *priv, - struct cmd_ctrl_node *ptempcmd) +static void __lbs_cleanup_and_insert_cmd(struct lbs_private *priv, + struct cmd_ctrl_node *ptempcmd) { if (!ptempcmd) @@ -1296,6 +1294,15 @@ static void lbs_cleanup_and_insert_cmd(struct lbs_private *priv, spin_unlock_irqrestore(&priv->driver_lock, flags); } +void lbs_complete_command(struct lbs_private *priv, struct cmd_ctrl_node *cmd, + int result) +{ + if (cmd == priv->cur_cmd) + priv->cur_cmd_retcode = result; + __lbs_cleanup_and_insert_cmd(priv, cmd); + priv->cur_cmd = NULL; +} + int lbs_set_radio_control(struct lbs_private *priv) { int ret = 0; @@ -1901,7 +1908,9 @@ int lbs_execute_next_command(struct lbs_private *priv) lbs_deb_host( "EXEC_NEXT_CMD: ignore ENTER_PS cmd\n"); list_del(&cmdnode->list); - lbs_cleanup_and_insert_cmd(priv, cmdnode); + spin_lock_irqsave(&priv->driver_lock, flags); + lbs_complete_command(priv, cmdnode, 0); + spin_unlock_irqrestore(&priv->driver_lock, flags); ret = 0; goto done; @@ -1912,7 +1921,9 @@ int lbs_execute_next_command(struct lbs_private *priv) lbs_deb_host( "EXEC_NEXT_CMD: ignore EXIT_PS cmd in sleep\n"); list_del(&cmdnode->list); - lbs_cleanup_and_insert_cmd(priv, cmdnode); + spin_lock_irqsave(&priv->driver_lock, flags); + lbs_complete_command(priv, cmdnode, 0); + spin_unlock_irqrestore(&priv->driver_lock, flags); priv->needtowakeup = 1; ret = 0; |