aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2012-03-06 16:30:41 -0500
committerJohn W. Linville <linville@tuxdriver.com>2012-03-07 13:51:49 -0500
commit2cc39c94c15ba1d5f6f71ab73f3369f9c17856ad (patch)
tree99bf63efa8fb8d8ef9943c64595ad55f7bfb1b3a /drivers
parent721c32f72d8007dc0148ee88c046a4ade794a7b7 (diff)
iwlwifi: move lockdep assertion into DVM
The fact that the mutex must be held is an implementation detail of DVM, but something has to ensure that no two synchronous cmds are submitted concurrently. Move the lockdep assertion into the DVM-specific code, but also make the transport abort if there are two concurrently commands. The assertion is much more useful though as the transport check can only catch it when it actually happens, while the assertion makes sure it can't possibly happen. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-lib.c8
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c11
2 files changed, 16 insertions, 3 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
index 11f24110d3fe..238f824c2f3e 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
@@ -1298,6 +1298,14 @@ int iwl_dvm_send_cmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
1298 return -EIO; 1298 return -EIO;
1299 } 1299 }
1300 1300
1301 /*
1302 * Synchronous commands from this op-mode must hold
1303 * the mutex, this ensures we don't try to send two
1304 * (or more) synchronous commands at a time.
1305 */
1306 if (cmd->flags & CMD_SYNC)
1307 lockdep_assert_held(&priv->shrd->mutex);
1308
1301 return iwl_trans_send_cmd(trans(priv), cmd); 1309 return iwl_trans_send_cmd(trans(priv), cmd);
1302} 1310}
1303 1311
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c
index c85975e63d75..ca4ceeacc989 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c
@@ -973,8 +973,6 @@ static int iwl_send_cmd_sync(struct iwl_trans *trans, struct iwl_host_cmd *cmd)
973 int cmd_idx; 973 int cmd_idx;
974 int ret; 974 int ret;
975 975
976 lockdep_assert_held(&trans->shrd->mutex);
977
978 IWL_DEBUG_INFO(trans, "Attempting to send sync command %s\n", 976 IWL_DEBUG_INFO(trans, "Attempting to send sync command %s\n",
979 get_cmd_string(cmd->id)); 977 get_cmd_string(cmd->id));
980 978
@@ -983,7 +981,14 @@ static int iwl_send_cmd_sync(struct iwl_trans *trans, struct iwl_host_cmd *cmd)
983 get_cmd_string(cmd->id)); 981 get_cmd_string(cmd->id));
984 return -EIO; 982 return -EIO;
985 } 983 }
986 set_bit(STATUS_HCMD_ACTIVE, &trans->shrd->status); 984
985 if (WARN_ON(test_and_set_bit(STATUS_HCMD_ACTIVE,
986 &trans->shrd->status))) {
987 IWL_ERR(trans, "Command %s: a command is already active!\n",
988 get_cmd_string(cmd->id));
989 return -EIO;
990 }
991
987 IWL_DEBUG_INFO(trans, "Setting HCMD_ACTIVE for command %s\n", 992 IWL_DEBUG_INFO(trans, "Setting HCMD_ACTIVE for command %s\n",
988 get_cmd_string(cmd->id)); 993 get_cmd_string(cmd->id));
989 994