aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl3945-base.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/iwl3945-base.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/iwl3945-base.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 8c2036850c89..51480a4920e8 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -733,17 +733,17 @@ static int iwl3945_send_cmd_sync(struct iwl3945_priv *priv, struct iwl3945_host_
733{ 733{
734 int cmd_idx; 734 int cmd_idx;
735 int ret; 735 int ret;
736 static atomic_t entry = ATOMIC_INIT(0); /* reentrance protection */
737 736
738 BUG_ON(cmd->meta.flags & CMD_ASYNC); 737 BUG_ON(cmd->meta.flags & CMD_ASYNC);
739 738
740 /* A synchronous command can not have a callback set. */ 739 /* A synchronous command can not have a callback set. */
741 BUG_ON(cmd->meta.u.callback != NULL); 740 BUG_ON(cmd->meta.u.callback != NULL);
742 741
743 if (atomic_xchg(&entry, 1)) { 742 if (test_and_set_bit(STATUS_HCMD_SYNC_ACTIVE, &priv->status)) {
744 IWL_ERROR("Error sending %s: Already sending a host command\n", 743 IWL_ERROR("Error sending %s: Already sending a host command\n",
745 get_cmd_string(cmd->id)); 744 get_cmd_string(cmd->id));
746 return -EBUSY; 745 ret = -EBUSY;
746 goto out;
747 } 747 }
748 748
749 set_bit(STATUS_HCMD_ACTIVE, &priv->status); 749 set_bit(STATUS_HCMD_ACTIVE, &priv->status);
@@ -813,7 +813,7 @@ fail:
813 cmd->meta.u.skb = NULL; 813 cmd->meta.u.skb = NULL;
814 } 814 }
815out: 815out:
816 atomic_set(&entry, 0); 816 clear_bit(STATUS_HCMD_SYNC_ACTIVE, &priv->status);
817 return ret; 817 return ret;
818} 818}
819 819