aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/libertas
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@infradead.org>2007-12-15 01:52:54 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:07:31 -0500
commit183aeac1c49869ba9a14c7ead86ce268da397a0e (patch)
treeed78bb49daf3570b5b99a1d93408261b9680478e /drivers/net/wireless/libertas
parentc4ab41272b55a08741d2e68966aae700e2e6d597 (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')
-rw-r--r--drivers/net/wireless/libertas/cmd.c25
-rw-r--r--drivers/net/wireless/libertas/cmdresp.c10
-rw-r--r--drivers/net/wireless/libertas/decl.h5
3 files changed, 23 insertions, 17 deletions
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c
index 4ffb84a403b3..9c73902ca86f 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,
1230 if (ret) { 1230 if (ret) {
1231 lbs_pr_info("DNLD_CMD: hw_host_to_card failed: %d\n", ret); 1231 lbs_pr_info("DNLD_CMD: hw_host_to_card failed: %d\n", ret);
1232 spin_lock_irqsave(&priv->driver_lock, flags); 1232 spin_lock_irqsave(&priv->driver_lock, flags);
1233 priv->cur_cmd_retcode = ret; 1233 lbs_complete_command(priv, priv->cur_cmd, ret);
1234 __lbs_cleanup_and_insert_cmd(priv, priv->cur_cmd);
1235 priv->cur_cmd = NULL;
1236 spin_unlock_irqrestore(&priv->driver_lock, flags); 1234 spin_unlock_irqrestore(&priv->driver_lock, flags);
1237 goto done; 1235 goto done;
1238 } 1236 }
@@ -1275,8 +1273,8 @@ static int lbs_cmd_mac_control(struct lbs_private *priv,
1275 * This function inserts command node to cmdfreeq 1273 * This function inserts command node to cmdfreeq
1276 * after cleans it. Requires priv->driver_lock held. 1274 * after cleans it. Requires priv->driver_lock held.
1277 */ 1275 */
1278void __lbs_cleanup_and_insert_cmd(struct lbs_private *priv, 1276static void __lbs_cleanup_and_insert_cmd(struct lbs_private *priv,
1279 struct cmd_ctrl_node *ptempcmd) 1277 struct cmd_ctrl_node *ptempcmd)
1280{ 1278{
1281 1279
1282 if (!ptempcmd) 1280 if (!ptempcmd)
@@ -1296,6 +1294,15 @@ static void lbs_cleanup_and_insert_cmd(struct lbs_private *priv,
1296 spin_unlock_irqrestore(&priv->driver_lock, flags); 1294 spin_unlock_irqrestore(&priv->driver_lock, flags);
1297} 1295}
1298 1296
1297void lbs_complete_command(struct lbs_private *priv, struct cmd_ctrl_node *cmd,
1298 int result)
1299{
1300 if (cmd == priv->cur_cmd)
1301 priv->cur_cmd_retcode = result;
1302 __lbs_cleanup_and_insert_cmd(priv, cmd);
1303 priv->cur_cmd = NULL;
1304}
1305
1299int lbs_set_radio_control(struct lbs_private *priv) 1306int lbs_set_radio_control(struct lbs_private *priv)
1300{ 1307{
1301 int ret = 0; 1308 int ret = 0;
@@ -1901,7 +1908,9 @@ int lbs_execute_next_command(struct lbs_private *priv)
1901 lbs_deb_host( 1908 lbs_deb_host(
1902 "EXEC_NEXT_CMD: ignore ENTER_PS cmd\n"); 1909 "EXEC_NEXT_CMD: ignore ENTER_PS cmd\n");
1903 list_del(&cmdnode->list); 1910 list_del(&cmdnode->list);
1904 lbs_cleanup_and_insert_cmd(priv, cmdnode); 1911 spin_lock_irqsave(&priv->driver_lock, flags);
1912 lbs_complete_command(priv, cmdnode, 0);
1913 spin_unlock_irqrestore(&priv->driver_lock, flags);
1905 1914
1906 ret = 0; 1915 ret = 0;
1907 goto done; 1916 goto done;
@@ -1912,7 +1921,9 @@ int lbs_execute_next_command(struct lbs_private *priv)
1912 lbs_deb_host( 1921 lbs_deb_host(
1913 "EXEC_NEXT_CMD: ignore EXIT_PS cmd in sleep\n"); 1922 "EXEC_NEXT_CMD: ignore EXIT_PS cmd in sleep\n");
1914 list_del(&cmdnode->list); 1923 list_del(&cmdnode->list);
1915 lbs_cleanup_and_insert_cmd(priv, cmdnode); 1924 spin_lock_irqsave(&priv->driver_lock, flags);
1925 lbs_complete_command(priv, cmdnode, 0);
1926 spin_unlock_irqrestore(&priv->driver_lock, flags);
1916 priv->needtowakeup = 1; 1927 priv->needtowakeup = 1;
1917 1928
1918 ret = 0; 1929 ret = 0;
diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c
index a809f8f9997b..89f83165e04f 100644
--- a/drivers/net/wireless/libertas/cmdresp.c
+++ b/drivers/net/wireless/libertas/cmdresp.c
@@ -717,8 +717,7 @@ int lbs_process_rx_command(struct lbs_private *priv)
717 lbs_deb_host("CMD_RESP: PS action 0x%X\n", action); 717 lbs_deb_host("CMD_RESP: PS action 0x%X\n", action);
718 } 718 }
719 719
720 __lbs_cleanup_and_insert_cmd(priv, priv->cur_cmd); 720 lbs_complete_command(priv, priv->cur_cmd, result);
721 priv->cur_cmd = NULL;
722 spin_unlock_irqrestore(&priv->driver_lock, flags); 721 spin_unlock_irqrestore(&priv->driver_lock, flags);
723 722
724 ret = 0; 723 ret = 0;
@@ -739,9 +738,7 @@ int lbs_process_rx_command(struct lbs_private *priv)
739 break; 738 break;
740 739
741 } 740 }
742 741 lbs_complete_command(priv, priv->cur_cmd, result);
743 __lbs_cleanup_and_insert_cmd(priv, priv->cur_cmd);
744 priv->cur_cmd = NULL;
745 spin_unlock_irqrestore(&priv->driver_lock, flags); 742 spin_unlock_irqrestore(&priv->driver_lock, flags);
746 743
747 ret = -1; 744 ret = -1;
@@ -760,8 +757,7 @@ int lbs_process_rx_command(struct lbs_private *priv)
760 757
761 if (priv->cur_cmd) { 758 if (priv->cur_cmd) {
762 /* Clean up and Put current command back to cmdfreeq */ 759 /* Clean up and Put current command back to cmdfreeq */
763 __lbs_cleanup_and_insert_cmd(priv, priv->cur_cmd); 760 lbs_complete_command(priv, priv->cur_cmd, result);
764 priv->cur_cmd = NULL;
765 } 761 }
766 spin_unlock_irqrestore(&priv->driver_lock, flags); 762 spin_unlock_irqrestore(&priv->driver_lock, flags);
767 763
diff --git a/drivers/net/wireless/libertas/decl.h b/drivers/net/wireless/libertas/decl.h
index 45f081b68706..5dd5c9e09282 100644
--- a/drivers/net/wireless/libertas/decl.h
+++ b/drivers/net/wireless/libertas/decl.h
@@ -45,9 +45,8 @@ void lbs_get_fwversion(struct lbs_private *priv,
45 45
46/** The proc fs interface */ 46/** The proc fs interface */
47int lbs_process_rx_command(struct lbs_private *priv); 47int lbs_process_rx_command(struct lbs_private *priv);
48void __lbs_cleanup_and_insert_cmd(struct lbs_private *priv, 48void lbs_complete_command(struct lbs_private *priv, struct cmd_ctrl_node *cmd,
49 struct cmd_ctrl_node *ptempcmd); 49 int result);
50
51int lbs_hard_start_xmit(struct sk_buff *skb, struct net_device *dev); 50int lbs_hard_start_xmit(struct sk_buff *skb, struct net_device *dev);
52int lbs_set_regiontable(struct lbs_private *priv, u8 region, u8 band); 51int lbs_set_regiontable(struct lbs_private *priv, u8 region, u8 band);
53 52