aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-hcmd.c
diff options
context:
space:
mode:
authorTomas Winkler <tomas.winkler@intel.com>2008-03-28 19:21:12 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-04-01 17:13:19 -0400
commite5472978ef16051337913f57b2f22982f3e9e4c2 (patch)
tree9ae5dd96bfe7bf2fbc989dd4429b08d879f294ef /drivers/net/wireless/iwlwifi/iwl-hcmd.c
parenta571ea4eb34adbf33bbaf4bdc6db6037b1a93e0f (diff)
iwlwifi: Fix synchronous host command
This patch replaces static variable from send_cmd_sync with flag in priv->status. It was used for reentrance protection but clearly made it impossible to stuck more cards into the same machine In addition it force check of return values of synchronous commands commands that doesn't requires return value async commands have to be used Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Yi Zhu <yi.zhu@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.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-hcmd.c b/drivers/net/wireless/iwlwifi/iwl-hcmd.c
index 51c9949633e3..1f8c2999805b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-hcmd.c
+++ b/drivers/net/wireless/iwlwifi/iwl-hcmd.c
@@ -151,17 +151,17 @@ int iwl_send_cmd_sync(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
151{ 151{
152 int cmd_idx; 152 int cmd_idx;
153 int ret; 153 int ret;
154 static atomic_t entry = ATOMIC_INIT(0); /* reentrance protection */
155 154
156 BUG_ON(cmd->meta.flags & CMD_ASYNC); 155 BUG_ON(cmd->meta.flags & CMD_ASYNC);
157 156
158 /* A synchronous command can not have a callback set. */ 157 /* A synchronous command can not have a callback set. */
159 BUG_ON(cmd->meta.u.callback != NULL); 158 BUG_ON(cmd->meta.u.callback != NULL);
160 159
161 if (atomic_xchg(&entry, 1)) { 160 if (test_and_set_bit(STATUS_HCMD_SYNC_ACTIVE, &priv->status)) {
162 IWL_ERROR("Error sending %s: Already sending a host command\n", 161 IWL_ERROR("Error sending %s: Already sending a host command\n",
163 get_cmd_string(cmd->id)); 162 get_cmd_string(cmd->id));
164 return -EBUSY; 163 ret = -EBUSY;
164 goto out;
165 } 165 }
166 166
167 set_bit(STATUS_HCMD_ACTIVE, &priv->status); 167 set_bit(STATUS_HCMD_ACTIVE, &priv->status);
@@ -231,7 +231,7 @@ fail:
231 cmd->meta.u.skb = NULL; 231 cmd->meta.u.skb = NULL;
232 } 232 }
233out: 233out:
234 atomic_set(&entry, 0); 234 clear_bit(STATUS_HCMD_SYNC_ACTIVE, &priv->status);
235 return ret; 235 return ret;
236} 236}
237EXPORT_SYMBOL(iwl_send_cmd_sync); 237EXPORT_SYMBOL(iwl_send_cmd_sync);