diff options
author | Wey-Yi Guy <wey-yi.w.guy@intel.com> | 2011-11-10 09:55:19 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-11-11 12:32:55 -0500 |
commit | 94b3c45c7be7a392764e5945d4ebb095a42e5ef0 (patch) | |
tree | 35cf57a781610d8401d45a7f7ce58336c8907fc0 | |
parent | 89db3b972c997d910b648497345fb0410ad04aec (diff) |
iwlwifi: check status before send command
Check the status before sending host command, if any of the condition
match, cancel the host command before queue
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c index 461e1ae38e5..09a31dc1476 100644 --- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c +++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c | |||
@@ -1001,6 +1001,20 @@ static int iwl_send_cmd_sync(struct iwl_trans *trans, struct iwl_host_cmd *cmd) | |||
1001 | IWL_DEBUG_INFO(trans, "Attempting to send sync command %s\n", | 1001 | IWL_DEBUG_INFO(trans, "Attempting to send sync command %s\n", |
1002 | get_cmd_string(cmd->id)); | 1002 | get_cmd_string(cmd->id)); |
1003 | 1003 | ||
1004 | if (test_bit(STATUS_EXIT_PENDING, &trans->shrd->status)) | ||
1005 | return -EBUSY; | ||
1006 | |||
1007 | |||
1008 | if (test_bit(STATUS_RF_KILL_HW, &trans->shrd->status)) { | ||
1009 | IWL_ERR(trans, "Command %s aborted: RF KILL Switch\n", | ||
1010 | get_cmd_string(cmd->id)); | ||
1011 | return -ECANCELED; | ||
1012 | } | ||
1013 | if (test_bit(STATUS_FW_ERROR, &trans->shrd->status)) { | ||
1014 | IWL_ERR(trans, "Command %s failed: FW Error\n", | ||
1015 | get_cmd_string(cmd->id)); | ||
1016 | return -EIO; | ||
1017 | } | ||
1004 | set_bit(STATUS_HCMD_ACTIVE, &trans->shrd->status); | 1018 | set_bit(STATUS_HCMD_ACTIVE, &trans->shrd->status); |
1005 | IWL_DEBUG_INFO(trans, "Setting HCMD_ACTIVE for command %s\n", | 1019 | IWL_DEBUG_INFO(trans, "Setting HCMD_ACTIVE for command %s\n", |
1006 | get_cmd_string(cmd->id)); | 1020 | get_cmd_string(cmd->id)); |
@@ -1041,18 +1055,6 @@ static int iwl_send_cmd_sync(struct iwl_trans *trans, struct iwl_host_cmd *cmd) | |||
1041 | } | 1055 | } |
1042 | } | 1056 | } |
1043 | 1057 | ||
1044 | if (test_bit(STATUS_RF_KILL_HW, &trans->shrd->status)) { | ||
1045 | IWL_ERR(trans, "Command %s aborted: RF KILL Switch\n", | ||
1046 | get_cmd_string(cmd->id)); | ||
1047 | ret = -ECANCELED; | ||
1048 | goto fail; | ||
1049 | } | ||
1050 | if (test_bit(STATUS_FW_ERROR, &trans->shrd->status)) { | ||
1051 | IWL_ERR(trans, "Command %s failed: FW Error\n", | ||
1052 | get_cmd_string(cmd->id)); | ||
1053 | ret = -EIO; | ||
1054 | goto fail; | ||
1055 | } | ||
1056 | if ((cmd->flags & CMD_WANT_SKB) && !cmd->reply_page) { | 1058 | if ((cmd->flags & CMD_WANT_SKB) && !cmd->reply_page) { |
1057 | IWL_ERR(trans, "Error: Response NULL in '%s'\n", | 1059 | IWL_ERR(trans, "Error: Response NULL in '%s'\n", |
1058 | get_cmd_string(cmd->id)); | 1060 | get_cmd_string(cmd->id)); |