diff options
author | Tomas Winkler <tomas.winkler@intel.com> | 2008-03-28 16:21:12 -0700 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-04-01 17:13:19 -0400 |
commit | e5472978ef16051337913f57b2f22982f3e9e4c2 (patch) | |
tree | 9ae5dd96bfe7bf2fbc989dd4429b08d879f294ef /drivers/net/wireless/iwlwifi/iwl-hcmd.c | |
parent | a571ea4eb34adbf33bbaf4bdc6db6037b1a93e0f (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.c | 8 |
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 51c9949633e..1f8c2999805 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) { int cmd_idx; int ret; - static atomic_t entry = ATOMIC_INIT(0); /* reentrance protection */ BUG_ON(cmd->meta.flags & CMD_ASYNC); /* A synchronous command can not have a callback set. */ BUG_ON(cmd->meta.u.callback != NULL); - if (atomic_xchg(&entry, 1)) { + if (test_and_set_bit(STATUS_HCMD_SYNC_ACTIVE, &priv->status)) { IWL_ERROR("Error sending %s: Already sending a host command\n", get_cmd_string(cmd->id)); - return -EBUSY; + ret = -EBUSY; + goto out; } set_bit(STATUS_HCMD_ACTIVE, &priv->status); @@ -231,7 +231,7 @@ fail: cmd->meta.u.skb = NULL; } out: - atomic_set(&entry, 0); + clear_bit(STATUS_HCMD_SYNC_ACTIVE, &priv->status); return ret; } EXPORT_SYMBOL(iwl_send_cmd_sync); |