diff options
author | Dan Williams <dcbw@redhat.com> | 2010-07-27 16:15:45 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-07-27 15:14:12 -0400 |
commit | 77ccdcf2e933d61176f67c4976f7ad4cbb9cb82a (patch) | |
tree | 584fe9683fa687ff56253c035f068809f51f6714 /drivers/net/wireless | |
parent | 53800f5dbf4a62126e34605be7db89702d76dec6 (diff) |
libertas: kill unused lbs_prepare_and_send_command()
Remove last bits of indirect command code.
Signed-off-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r-- | drivers/net/wireless/libertas/cmd.c | 146 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/cmd.h | 5 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/cmdresp.c | 3 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/dev.h | 1 |
4 files changed, 9 insertions, 146 deletions
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index f19a36fa57da..4946bce23263 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c | |||
@@ -77,30 +77,6 @@ static u8 is_command_allowed_in_ps(u16 cmd) | |||
77 | } | 77 | } |
78 | 78 | ||
79 | /** | 79 | /** |
80 | * @brief This function checks if the command is allowed. | ||
81 | * | ||
82 | * @param priv A pointer to lbs_private structure | ||
83 | * @return allowed or not allowed. | ||
84 | */ | ||
85 | |||
86 | static int lbs_is_cmd_allowed(struct lbs_private *priv) | ||
87 | { | ||
88 | int ret = 1; | ||
89 | |||
90 | lbs_deb_enter(LBS_DEB_CMD); | ||
91 | |||
92 | if (!priv->is_auto_deep_sleep_enabled) { | ||
93 | if (priv->is_deep_sleep) { | ||
94 | lbs_deb_cmd("command not allowed in deep sleep\n"); | ||
95 | ret = 0; | ||
96 | } | ||
97 | } | ||
98 | |||
99 | lbs_deb_leave(LBS_DEB_CMD); | ||
100 | return ret; | ||
101 | } | ||
102 | |||
103 | /** | ||
104 | * @brief Updates the hardware details like MAC address and regulatory region | 80 | * @brief Updates the hardware details like MAC address and regulatory region |
105 | * | 81 | * |
106 | * @param priv A pointer to struct lbs_private structure | 82 | * @param priv A pointer to struct lbs_private structure |
@@ -1000,7 +976,6 @@ static void lbs_submit_command(struct lbs_private *priv, | |||
1000 | 976 | ||
1001 | spin_lock_irqsave(&priv->driver_lock, flags); | 977 | spin_lock_irqsave(&priv->driver_lock, flags); |
1002 | priv->cur_cmd = cmdnode; | 978 | priv->cur_cmd = cmdnode; |
1003 | priv->cur_cmd_retcode = 0; | ||
1004 | spin_unlock_irqrestore(&priv->driver_lock, flags); | 979 | spin_unlock_irqrestore(&priv->driver_lock, flags); |
1005 | 980 | ||
1006 | cmdsize = le16_to_cpu(cmd->size); | 981 | cmdsize = le16_to_cpu(cmd->size); |
@@ -1073,9 +1048,6 @@ static void lbs_cleanup_and_insert_cmd(struct lbs_private *priv, | |||
1073 | void lbs_complete_command(struct lbs_private *priv, struct cmd_ctrl_node *cmd, | 1048 | void lbs_complete_command(struct lbs_private *priv, struct cmd_ctrl_node *cmd, |
1074 | int result) | 1049 | int result) |
1075 | { | 1050 | { |
1076 | if (cmd == priv->cur_cmd) | ||
1077 | priv->cur_cmd_retcode = result; | ||
1078 | |||
1079 | cmd->result = result; | 1051 | cmd->result = result; |
1080 | cmd->cmdwaitqwoken = 1; | 1052 | cmd->cmdwaitqwoken = 1; |
1081 | wake_up_interruptible(&cmd->cmdwait_q); | 1053 | wake_up_interruptible(&cmd->cmdwait_q); |
@@ -1143,112 +1115,6 @@ void lbs_set_mac_control(struct lbs_private *priv) | |||
1143 | } | 1115 | } |
1144 | 1116 | ||
1145 | /** | 1117 | /** |
1146 | * @brief This function prepare the command before send to firmware. | ||
1147 | * | ||
1148 | * @param priv A pointer to struct lbs_private structure | ||
1149 | * @param cmd_no command number | ||
1150 | * @param cmd_action command action: GET or SET | ||
1151 | * @param wait_option wait option: wait response or not | ||
1152 | * @param cmd_oid cmd oid: treated as sub command | ||
1153 | * @param pdata_buf A pointer to informaion buffer | ||
1154 | * @return 0 or -1 | ||
1155 | */ | ||
1156 | int lbs_prepare_and_send_command(struct lbs_private *priv, | ||
1157 | u16 cmd_no, | ||
1158 | u16 cmd_action, | ||
1159 | u16 wait_option, u32 cmd_oid, void *pdata_buf) | ||
1160 | { | ||
1161 | int ret = 0; | ||
1162 | struct cmd_ctrl_node *cmdnode; | ||
1163 | struct cmd_header *cmdptr; | ||
1164 | unsigned long flags; | ||
1165 | |||
1166 | lbs_deb_enter(LBS_DEB_HOST); | ||
1167 | |||
1168 | if (!priv) { | ||
1169 | lbs_deb_host("PREP_CMD: priv is NULL\n"); | ||
1170 | ret = -1; | ||
1171 | goto done; | ||
1172 | } | ||
1173 | |||
1174 | if (priv->surpriseremoved) { | ||
1175 | lbs_deb_host("PREP_CMD: card removed\n"); | ||
1176 | ret = -1; | ||
1177 | goto done; | ||
1178 | } | ||
1179 | |||
1180 | if (!lbs_is_cmd_allowed(priv)) { | ||
1181 | ret = -EBUSY; | ||
1182 | goto done; | ||
1183 | } | ||
1184 | |||
1185 | cmdnode = lbs_get_cmd_ctrl_node(priv); | ||
1186 | |||
1187 | if (cmdnode == NULL) { | ||
1188 | lbs_deb_host("PREP_CMD: cmdnode is NULL\n"); | ||
1189 | |||
1190 | /* Wake up main thread to execute next command */ | ||
1191 | wake_up_interruptible(&priv->waitq); | ||
1192 | ret = -1; | ||
1193 | goto done; | ||
1194 | } | ||
1195 | |||
1196 | cmdnode->callback = NULL; | ||
1197 | cmdnode->callback_arg = (unsigned long)pdata_buf; | ||
1198 | |||
1199 | cmdptr = (struct cmd_header *)cmdnode->cmdbuf; | ||
1200 | |||
1201 | lbs_deb_host("PREP_CMD: command 0x%04x\n", cmd_no); | ||
1202 | |||
1203 | /* Set sequence number, command and INT option */ | ||
1204 | priv->seqnum++; | ||
1205 | cmdptr->seqnum = cpu_to_le16(priv->seqnum); | ||
1206 | |||
1207 | cmdptr->command = cpu_to_le16(cmd_no); | ||
1208 | cmdptr->result = 0; | ||
1209 | |||
1210 | switch (cmd_no) { | ||
1211 | default: | ||
1212 | lbs_pr_err("PREP_CMD: unknown command 0x%04x\n", cmd_no); | ||
1213 | ret = -1; | ||
1214 | break; | ||
1215 | } | ||
1216 | |||
1217 | /* return error, since the command preparation failed */ | ||
1218 | if (ret != 0) { | ||
1219 | lbs_deb_host("PREP_CMD: command preparation failed\n"); | ||
1220 | lbs_cleanup_and_insert_cmd(priv, cmdnode); | ||
1221 | ret = -1; | ||
1222 | goto done; | ||
1223 | } | ||
1224 | |||
1225 | cmdnode->cmdwaitqwoken = 0; | ||
1226 | |||
1227 | lbs_queue_cmd(priv, cmdnode); | ||
1228 | wake_up_interruptible(&priv->waitq); | ||
1229 | |||
1230 | if (wait_option & CMD_OPTION_WAITFORRSP) { | ||
1231 | lbs_deb_host("PREP_CMD: wait for response\n"); | ||
1232 | might_sleep(); | ||
1233 | wait_event_interruptible(cmdnode->cmdwait_q, | ||
1234 | cmdnode->cmdwaitqwoken); | ||
1235 | } | ||
1236 | |||
1237 | spin_lock_irqsave(&priv->driver_lock, flags); | ||
1238 | if (priv->cur_cmd_retcode) { | ||
1239 | lbs_deb_host("PREP_CMD: command failed with return code %d\n", | ||
1240 | priv->cur_cmd_retcode); | ||
1241 | priv->cur_cmd_retcode = 0; | ||
1242 | ret = -1; | ||
1243 | } | ||
1244 | spin_unlock_irqrestore(&priv->driver_lock, flags); | ||
1245 | |||
1246 | done: | ||
1247 | lbs_deb_leave_args(LBS_DEB_HOST, "ret %d", ret); | ||
1248 | return ret; | ||
1249 | } | ||
1250 | |||
1251 | /** | ||
1252 | * @brief This function allocates the command buffer and link | 1118 | * @brief This function allocates the command buffer and link |
1253 | * it to command free queue. | 1119 | * it to command free queue. |
1254 | * | 1120 | * |
@@ -1701,9 +1567,15 @@ struct cmd_ctrl_node *__lbs_cmd_async(struct lbs_private *priv, | |||
1701 | goto done; | 1567 | goto done; |
1702 | } | 1568 | } |
1703 | 1569 | ||
1704 | if (!lbs_is_cmd_allowed(priv)) { | 1570 | /* No commands are allowed in Deep Sleep until we toggle the GPIO |
1705 | cmdnode = ERR_PTR(-EBUSY); | 1571 | * to wake up the card and it has signaled that it's ready. |
1706 | goto done; | 1572 | */ |
1573 | if (!priv->is_auto_deep_sleep_enabled) { | ||
1574 | if (priv->is_deep_sleep) { | ||
1575 | lbs_deb_cmd("command not allowed in deep sleep\n"); | ||
1576 | cmdnode = ERR_PTR(-EBUSY); | ||
1577 | goto done; | ||
1578 | } | ||
1707 | } | 1579 | } |
1708 | 1580 | ||
1709 | cmdnode = lbs_get_cmd_ctrl_node(priv); | 1581 | cmdnode = lbs_get_cmd_ctrl_node(priv); |
diff --git a/drivers/net/wireless/libertas/cmd.h b/drivers/net/wireless/libertas/cmd.h index 19b1f210a192..7109d6b717ea 100644 --- a/drivers/net/wireless/libertas/cmd.h +++ b/drivers/net/wireless/libertas/cmd.h | |||
@@ -39,11 +39,6 @@ struct cmd_ctrl_node { | |||
39 | #define lbs_cmd_with_response(priv, cmdnr, cmd) \ | 39 | #define lbs_cmd_with_response(priv, cmdnr, cmd) \ |
40 | lbs_cmd(priv, cmdnr, cmd, lbs_cmd_copyback, (unsigned long) (cmd)) | 40 | lbs_cmd(priv, cmdnr, cmd, lbs_cmd_copyback, (unsigned long) (cmd)) |
41 | 41 | ||
42 | int lbs_prepare_and_send_command(struct lbs_private *priv, | ||
43 | u16 cmd_no, | ||
44 | u16 cmd_action, | ||
45 | u16 wait_option, u32 cmd_oid, void *pdata_buf); | ||
46 | |||
47 | void lbs_cmd_async(struct lbs_private *priv, uint16_t command, | 42 | void lbs_cmd_async(struct lbs_private *priv, uint16_t command, |
48 | struct cmd_header *in_cmd, int in_cmd_size); | 43 | struct cmd_header *in_cmd, int in_cmd_size); |
49 | 44 | ||
diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c index 83283b8efd62..5e95da9dcc2e 100644 --- a/drivers/net/wireless/libertas/cmdresp.c +++ b/drivers/net/wireless/libertas/cmdresp.c | |||
@@ -112,9 +112,6 @@ int lbs_process_command_response(struct lbs_private *priv, u8 *data, u32 len) | |||
112 | del_timer(&priv->command_timer); | 112 | del_timer(&priv->command_timer); |
113 | priv->cmd_timed_out = 0; | 113 | priv->cmd_timed_out = 0; |
114 | 114 | ||
115 | /* Store the response code to cur_cmd_retcode. */ | ||
116 | priv->cur_cmd_retcode = result; | ||
117 | |||
118 | if (respcmd == CMD_RET(CMD_802_11_PS_MODE)) { | 115 | if (respcmd == CMD_RET(CMD_802_11_PS_MODE)) { |
119 | struct cmd_ds_802_11_ps_mode *psmode = (void *) &resp[1]; | 116 | struct cmd_ds_802_11_ps_mode *psmode = (void *) &resp[1]; |
120 | u16 action = le16_to_cpu(psmode->action); | 117 | u16 action = le16_to_cpu(psmode->action); |
diff --git a/drivers/net/wireless/libertas/dev.h b/drivers/net/wireless/libertas/dev.h index 556a9c33a4a6..85cdc9a0a637 100644 --- a/drivers/net/wireless/libertas/dev.h +++ b/drivers/net/wireless/libertas/dev.h | |||
@@ -116,7 +116,6 @@ struct lbs_private { | |||
116 | int cmd_timed_out; | 116 | int cmd_timed_out; |
117 | 117 | ||
118 | /* Command responses sent from the hardware to the driver */ | 118 | /* Command responses sent from the hardware to the driver */ |
119 | int cur_cmd_retcode; | ||
120 | u8 resp_idx; | 119 | u8 resp_idx; |
121 | u8 resp_buf[2][LBS_UPLD_SIZE]; | 120 | u8 resp_buf[2][LBS_UPLD_SIZE]; |
122 | u32 resp_len[2]; | 121 | u32 resp_len[2]; |