aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@infradead.org>2007-12-15 00:09:25 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:07:29 -0500
commitd9896ee14768e3dd6ce2f57a0d518b5b18a924a1 (patch)
tree6832e8d1fa1857d4cbba0791208498479336ff29 /drivers/net
parent8e5b6b2d32304f4d6a096a6dfae23d12dc6f9287 (diff)
libertas: rename and clean up DownloadcommandToStation
Call it lbs_submit_command(), remove a bunch of things which can be (or, in the case of zeroing ->cmdwaitqwoken, already are) done elsewhere. Signed-off-by: David Woodhouse <dwmw2@infradead.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/libertas/cmd.c36
1 files changed, 9 insertions, 27 deletions
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c
index 5ceb331147f2..4dc6bbe5f110 100644
--- a/drivers/net/wireless/libertas/cmd.c
+++ b/drivers/net/wireless/libertas/cmd.c
@@ -1170,6 +1170,10 @@ void lbs_queue_cmd(struct lbs_private *priv,
1170 lbs_deb_host("QUEUE_CMD: cmdnode or cmdbuf is NULL\n"); 1170 lbs_deb_host("QUEUE_CMD: cmdnode or cmdbuf is NULL\n");
1171 goto done; 1171 goto done;
1172 } 1172 }
1173 if (!cmdnode->cmdbuf->size) {
1174 lbs_deb_host("DNLD_CMD: cmd size is zero\n");
1175 goto done;
1176 }
1173 1177
1174 /* Exit_PS command needs to be queued in the header always. */ 1178 /* Exit_PS command needs to be queued in the header always. */
1175 if (le16_to_cpu(cmdnode->cmdbuf->command) == CMD_802_11_PS_MODE) { 1179 if (le16_to_cpu(cmdnode->cmdbuf->command) == CMD_802_11_PS_MODE) {
@@ -1197,15 +1201,8 @@ done:
1197 lbs_deb_leave(LBS_DEB_HOST); 1201 lbs_deb_leave(LBS_DEB_HOST);
1198} 1202}
1199 1203
1200/* 1204static int lbs_submit_command(struct lbs_private *priv,
1201 * TODO: Fix the issue when DownloadcommandToStation is being called the 1205 struct cmd_ctrl_node *cmdnode)
1202 * second time when the command times out. All the cmdptr->xxx are in little
1203 * endian and therefore all the comparissions will fail.
1204 * For now - we are not performing the endian conversion the second time - but
1205 * for PS and DEEP_SLEEP we need to worry
1206 */
1207static int DownloadcommandToStation(struct lbs_private *priv,
1208 struct cmd_ctrl_node *cmdnode)
1209{ 1206{
1210 unsigned long flags; 1207 unsigned long flags;
1211 struct cmd_header *cmd; 1208 struct cmd_header *cmd;
@@ -1215,21 +1212,9 @@ static int DownloadcommandToStation(struct lbs_private *priv,
1215 1212
1216 lbs_deb_enter(LBS_DEB_HOST); 1213 lbs_deb_enter(LBS_DEB_HOST);
1217 1214
1218 if (!priv || !cmdnode) {
1219 lbs_deb_host("DNLD_CMD: priv or cmdmode is NULL\n");
1220 goto done;
1221 }
1222
1223 cmd = cmdnode->cmdbuf; 1215 cmd = cmdnode->cmdbuf;
1224 1216
1225 spin_lock_irqsave(&priv->driver_lock, flags); 1217 spin_lock_irqsave(&priv->driver_lock, flags);
1226 if (!cmd || !cmd->size) {
1227 lbs_deb_host("DNLD_CMD: cmdptr is NULL or zero\n");
1228 __lbs_cleanup_and_insert_cmd(priv, cmdnode);
1229 spin_unlock_irqrestore(&priv->driver_lock, flags);
1230 goto done;
1231 }
1232
1233 priv->cur_cmd = cmdnode; 1218 priv->cur_cmd = cmdnode;
1234 priv->cur_cmd_retcode = 0; 1219 priv->cur_cmd_retcode = 0;
1235 spin_unlock_irqrestore(&priv->driver_lock, flags); 1220 spin_unlock_irqrestore(&priv->driver_lock, flags);
@@ -1241,12 +1226,9 @@ static int DownloadcommandToStation(struct lbs_private *priv,
1241 command, le16_to_cpu(cmd->seqnum), cmdsize, jiffies); 1226 command, le16_to_cpu(cmd->seqnum), cmdsize, jiffies);
1242 lbs_deb_hex(LBS_DEB_HOST, "DNLD_CMD", (void *) cmdnode->cmdbuf, cmdsize); 1227 lbs_deb_hex(LBS_DEB_HOST, "DNLD_CMD", (void *) cmdnode->cmdbuf, cmdsize);
1243 1228
1244 cmdnode->cmdwaitqwoken = 0;
1245
1246 ret = priv->hw_host_to_card(priv, MVMS_CMD, (u8 *) cmd, cmdsize); 1229 ret = priv->hw_host_to_card(priv, MVMS_CMD, (u8 *) cmd, cmdsize);
1247 1230 if (ret) {
1248 if (ret != 0) { 1231 lbs_pr_info("DNLD_CMD: hw_host_to_card failed: %d\n", ret);
1249 lbs_deb_host("DNLD_CMD: hw_host_to_card failed\n");
1250 spin_lock_irqsave(&priv->driver_lock, flags); 1232 spin_lock_irqsave(&priv->driver_lock, flags);
1251 priv->cur_cmd_retcode = ret; 1233 priv->cur_cmd_retcode = ret;
1252 __lbs_cleanup_and_insert_cmd(priv, priv->cur_cmd); 1234 __lbs_cleanup_and_insert_cmd(priv, priv->cur_cmd);
@@ -1952,7 +1934,7 @@ int lbs_execute_next_command(struct lbs_private *priv)
1952 list_del(&cmdnode->list); 1934 list_del(&cmdnode->list);
1953 lbs_deb_host("EXEC_NEXT_CMD: sending command 0x%04x\n", 1935 lbs_deb_host("EXEC_NEXT_CMD: sending command 0x%04x\n",
1954 le16_to_cpu(cmd->command)); 1936 le16_to_cpu(cmd->command));
1955 DownloadcommandToStation(priv, cmdnode); 1937 lbs_submit_command(priv, cmdnode);
1956 } else { 1938 } else {
1957 /* 1939 /*
1958 * check if in power save mode, if yes, put the device back 1940 * check if in power save mode, if yes, put the device back