diff options
Diffstat (limited to 'drivers/net/wireless/mwifiex/util.c')
-rw-r--r-- | drivers/net/wireless/mwifiex/util.c | 55 |
1 files changed, 15 insertions, 40 deletions
diff --git a/drivers/net/wireless/mwifiex/util.c b/drivers/net/wireless/mwifiex/util.c index 205022aa52f5..7ab4fb279f8a 100644 --- a/drivers/net/wireless/mwifiex/util.c +++ b/drivers/net/wireless/mwifiex/util.c | |||
@@ -55,18 +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; | ||
70 | u16 cmd; | 64 | u16 cmd; |
71 | 65 | ||
72 | if (func_init_shutdown == MWIFIEX_FUNC_INIT) { | 66 | if (func_init_shutdown == MWIFIEX_FUNC_INIT) { |
@@ -74,19 +68,13 @@ int mwifiex_misc_ioctl_init_shutdown(struct mwifiex_adapter *adapter, | |||
74 | } else if (func_init_shutdown == MWIFIEX_FUNC_SHUTDOWN) { | 68 | } else if (func_init_shutdown == MWIFIEX_FUNC_SHUTDOWN) { |
75 | cmd = HostCmd_CMD_FUNC_SHUTDOWN; | 69 | cmd = HostCmd_CMD_FUNC_SHUTDOWN; |
76 | } else { | 70 | } else { |
77 | dev_err(adapter->dev, "unsupported parameter\n"); | 71 | dev_err(priv->adapter->dev, "unsupported parameter\n"); |
78 | return -1; | 72 | return -1; |
79 | } | 73 | } |
80 | 74 | ||
81 | /* Send command to firmware */ | 75 | return mwifiex_send_cmd_sync(priv, cmd, HostCmd_ACT_GEN_SET, 0, NULL); |
82 | ret = mwifiex_prepare_cmd(priv, cmd, HostCmd_ACT_GEN_SET, | ||
83 | 0, wait, NULL); | ||
84 | |||
85 | if (!ret) | ||
86 | ret = -EINPROGRESS; | ||
87 | |||
88 | return ret; | ||
89 | } | 76 | } |
77 | EXPORT_SYMBOL_GPL(mwifiex_init_shutdown_fw); | ||
90 | 78 | ||
91 | /* | 79 | /* |
92 | * IOCTL request handler to set/get debug information. | 80 | * IOCTL request handler to set/get debug information. |
@@ -222,31 +210,18 @@ int mwifiex_recv_complete(struct mwifiex_adapter *adapter, | |||
222 | * corresponding waiting function. Otherwise, it processes the | 210 | * corresponding waiting function. Otherwise, it processes the |
223 | * IOCTL response and frees the response buffer. | 211 | * IOCTL response and frees the response buffer. |
224 | */ | 212 | */ |
225 | int mwifiex_ioctl_complete(struct mwifiex_adapter *adapter, | 213 | int mwifiex_complete_cmd(struct mwifiex_adapter *adapter) |
226 | struct mwifiex_wait_queue *wait_queue, | ||
227 | int status) | ||
228 | { | 214 | { |
229 | enum mwifiex_error_code status_code = | 215 | atomic_dec(&adapter->cmd_pending); |
230 | (enum mwifiex_error_code) wait_queue->status; | 216 | dev_dbg(adapter->dev, "cmd completed: status=%d\n", |
231 | 217 | adapter->cmd_wait_q.status); | |
232 | atomic_dec(&adapter->ioctl_pending); | ||
233 | 218 | ||
234 | dev_dbg(adapter->dev, "cmd: IOCTL completed: status=%d," | 219 | adapter->cmd_wait_q.condition = true; |
235 | " status_code=%#x\n", status, status_code); | ||
236 | 220 | ||
237 | if (wait_queue->enabled) { | 221 | if (adapter->cmd_wait_q.status == -ETIMEDOUT) |
238 | *wait_queue->condition = true; | 222 | dev_err(adapter->dev, "cmd timeout\n"); |
239 | wait_queue->status = status; | 223 | else |
240 | if (status && (status_code == MWIFIEX_ERROR_CMD_TIMEOUT)) | 224 | 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 | 225 | ||
251 | return 0; | 226 | return 0; |
252 | } | 227 | } |