diff options
author | Reinette Chatre <reinette.chatre@intel.com> | 2010-02-19 01:03:04 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-02-19 15:52:49 -0500 |
commit | d2dfe6df755abb365aa3e2e67d88bda3cce5fd12 (patch) | |
tree | 5b24bd9cffb0ddfdd54554f2b5bace16c346ef99 /drivers/net/wireless/iwlwifi/iwl-hcmd.c | |
parent | 4a6547c748229ba0425713b4adeb0f2d4000da9e (diff) |
iwlwifi: enable serialization of synchronous commands
Until now it was only possible to have one synchronous command running at
any time. If a synchronous command is in progress when a second request
arrives then the second command will fail. Create a new mutex specific for
this purpose to only allow one synchronous command at a time, but enable
other commands to wait instead of fail if a synchronous command is in
progress.
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-hcmd.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-hcmd.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-hcmd.c b/drivers/net/wireless/iwlwifi/iwl-hcmd.c index 86783c27d97c..73681c4fefe7 100644 --- a/drivers/net/wireless/iwlwifi/iwl-hcmd.c +++ b/drivers/net/wireless/iwlwifi/iwl-hcmd.c | |||
@@ -164,15 +164,13 @@ int iwl_send_cmd_sync(struct iwl_priv *priv, struct iwl_host_cmd *cmd) | |||
164 | /* A synchronous command can not have a callback set. */ | 164 | /* A synchronous command can not have a callback set. */ |
165 | BUG_ON(cmd->callback); | 165 | BUG_ON(cmd->callback); |
166 | 166 | ||
167 | if (test_and_set_bit(STATUS_HCMD_SYNC_ACTIVE, &priv->status)) { | 167 | IWL_DEBUG_INFO(priv, "Attempting to send sync command %s\n", |
168 | IWL_ERR(priv, | ||
169 | "Error sending %s: Already sending a host command\n", | ||
170 | get_cmd_string(cmd->id)); | 168 | get_cmd_string(cmd->id)); |
171 | ret = -EBUSY; | 169 | mutex_lock(&priv->sync_cmd_mutex); |
172 | goto out; | ||
173 | } | ||
174 | 170 | ||
175 | set_bit(STATUS_HCMD_ACTIVE, &priv->status); | 171 | set_bit(STATUS_HCMD_ACTIVE, &priv->status); |
172 | IWL_DEBUG_INFO(priv, "Setting HCMD_ACTIVE for command %s \n", | ||
173 | get_cmd_string(cmd->id)); | ||
176 | 174 | ||
177 | cmd_idx = iwl_enqueue_hcmd(priv, cmd); | 175 | cmd_idx = iwl_enqueue_hcmd(priv, cmd); |
178 | if (cmd_idx < 0) { | 176 | if (cmd_idx < 0) { |
@@ -193,6 +191,8 @@ int iwl_send_cmd_sync(struct iwl_priv *priv, struct iwl_host_cmd *cmd) | |||
193 | jiffies_to_msecs(HOST_COMPLETE_TIMEOUT)); | 191 | jiffies_to_msecs(HOST_COMPLETE_TIMEOUT)); |
194 | 192 | ||
195 | clear_bit(STATUS_HCMD_ACTIVE, &priv->status); | 193 | clear_bit(STATUS_HCMD_ACTIVE, &priv->status); |
194 | IWL_DEBUG_INFO(priv, "Clearing HCMD_ACTIVE for command %s \n", | ||
195 | get_cmd_string(cmd->id)); | ||
196 | ret = -ETIMEDOUT; | 196 | ret = -ETIMEDOUT; |
197 | goto cancel; | 197 | goto cancel; |
198 | } | 198 | } |
@@ -237,7 +237,7 @@ fail: | |||
237 | cmd->reply_page = 0; | 237 | cmd->reply_page = 0; |
238 | } | 238 | } |
239 | out: | 239 | out: |
240 | clear_bit(STATUS_HCMD_SYNC_ACTIVE, &priv->status); | 240 | mutex_unlock(&priv->sync_cmd_mutex); |
241 | return ret; | 241 | return ret; |
242 | } | 242 | } |
243 | EXPORT_SYMBOL(iwl_send_cmd_sync); | 243 | EXPORT_SYMBOL(iwl_send_cmd_sync); |