diff options
Diffstat (limited to 'drivers/net/wireless/mwifiex/util.c')
-rw-r--r-- | drivers/net/wireless/mwifiex/util.c | 51 |
1 files changed, 15 insertions, 36 deletions
diff --git a/drivers/net/wireless/mwifiex/util.c b/drivers/net/wireless/mwifiex/util.c index 205022aa52f5..9f65587622fd 100644 --- a/drivers/net/wireless/mwifiex/util.c +++ b/drivers/net/wireless/mwifiex/util.c | |||
@@ -55,17 +55,12 @@ int mwifiex_shutdown_fw_complete(struct mwifiex_adapter *adapter) | |||
55 | } | 55 | } |
56 | 56 | ||
57 | /* | 57 | /* |
58 | * IOCTL request handler to send function init/shutdown command | 58 | * This function sends init/shutdown command |
59 | * to firmware. | 59 | * to firmware. |
60 | * | ||
61 | * This function prepares the correct firmware command and | ||
62 | * issues it. | ||
63 | */ | 60 | */ |
64 | int mwifiex_misc_ioctl_init_shutdown(struct mwifiex_adapter *adapter, | 61 | int mwifiex_init_shutdown_fw(struct mwifiex_private *priv, |
65 | struct mwifiex_wait_queue *wait, | 62 | u32 func_init_shutdown) |
66 | u32 func_init_shutdown) | ||
67 | { | 63 | { |
68 | struct mwifiex_private *priv = adapter->priv[wait->bss_index]; | ||
69 | int ret; | 64 | int ret; |
70 | u16 cmd; | 65 | u16 cmd; |
71 | 66 | ||
@@ -74,19 +69,16 @@ int mwifiex_misc_ioctl_init_shutdown(struct mwifiex_adapter *adapter, | |||
74 | } else if (func_init_shutdown == MWIFIEX_FUNC_SHUTDOWN) { | 69 | } else if (func_init_shutdown == MWIFIEX_FUNC_SHUTDOWN) { |
75 | cmd = HostCmd_CMD_FUNC_SHUTDOWN; | 70 | cmd = HostCmd_CMD_FUNC_SHUTDOWN; |
76 | } else { | 71 | } else { |
77 | dev_err(adapter->dev, "unsupported parameter\n"); | 72 | dev_err(priv->adapter->dev, "unsupported parameter\n"); |
78 | return -1; | 73 | return -1; |
79 | } | 74 | } |
80 | 75 | ||
81 | /* Send command to firmware */ | 76 | /* Send command to firmware */ |
82 | ret = mwifiex_prepare_cmd(priv, cmd, HostCmd_ACT_GEN_SET, | 77 | ret = mwifiex_send_cmd_sync(priv, cmd, HostCmd_ACT_GEN_SET, 0, NULL); |
83 | 0, wait, NULL); | ||
84 | |||
85 | if (!ret) | ||
86 | ret = -EINPROGRESS; | ||
87 | 78 | ||
88 | return ret; | 79 | return ret; |
89 | } | 80 | } |
81 | EXPORT_SYMBOL_GPL(mwifiex_init_shutdown_fw); | ||
90 | 82 | ||
91 | /* | 83 | /* |
92 | * IOCTL request handler to set/get debug information. | 84 | * IOCTL request handler to set/get debug information. |
@@ -222,31 +214,18 @@ int mwifiex_recv_complete(struct mwifiex_adapter *adapter, | |||
222 | * corresponding waiting function. Otherwise, it processes the | 214 | * corresponding waiting function. Otherwise, it processes the |
223 | * IOCTL response and frees the response buffer. | 215 | * IOCTL response and frees the response buffer. |
224 | */ | 216 | */ |
225 | int mwifiex_ioctl_complete(struct mwifiex_adapter *adapter, | 217 | int mwifiex_complete_cmd(struct mwifiex_adapter *adapter) |
226 | struct mwifiex_wait_queue *wait_queue, | ||
227 | int status) | ||
228 | { | 218 | { |
229 | enum mwifiex_error_code status_code = | 219 | atomic_dec(&adapter->cmd_pending); |
230 | (enum mwifiex_error_code) wait_queue->status; | 220 | dev_dbg(adapter->dev, "cmd completed: status=%d\n", |
231 | 221 | adapter->cmd_wait_q.status); | |
232 | atomic_dec(&adapter->ioctl_pending); | ||
233 | 222 | ||
234 | dev_dbg(adapter->dev, "cmd: IOCTL completed: status=%d," | 223 | adapter->cmd_wait_q.condition = true; |
235 | " status_code=%#x\n", status, status_code); | ||
236 | 224 | ||
237 | if (wait_queue->enabled) { | 225 | if (adapter->cmd_wait_q.status == -ETIMEDOUT) |
238 | *wait_queue->condition = true; | 226 | dev_err(adapter->dev, "cmd timeout\n"); |
239 | wait_queue->status = status; | 227 | else |
240 | if (status && (status_code == MWIFIEX_ERROR_CMD_TIMEOUT)) | 228 | wake_up_interruptible(&adapter->cmd_wait_q.wait); |
241 | dev_err(adapter->dev, "cmd timeout\n"); | ||
242 | else | ||
243 | wake_up_interruptible(wait_queue->wait); | ||
244 | } else { | ||
245 | if (status) | ||
246 | dev_err(adapter->dev, "cmd failed: status_code=%#x\n", | ||
247 | status_code); | ||
248 | kfree(wait_queue); | ||
249 | } | ||
250 | 229 | ||
251 | return 0; | 230 | return 0; |
252 | } | 231 | } |