iwlwifi: improve the flow when a NIC is disconnected
[linux-2.6-block.git] / drivers / net / wireless / intel / iwlwifi / pcie / tx.c
index d5aba9ebd84aaf7d84face36ac69b2f7d26d785b..b89e976ecfcdccf397ee67d2e7d70b204ada80ca 100644 (file)
@@ -1189,8 +1189,8 @@ static int iwl_pcie_set_cmd_in_flight(struct iwl_trans *trans,
        lockdep_assert_held(&trans_pcie->reg_lock);
 
        /* Make sure the NIC is still alive in the bus */
-       if (trans_pcie->scheduled_for_removal)
-               return -EIO;
+       if (test_bit(STATUS_TRANS_DEAD, &trans->status))
+               return -ENODEV;
 
        if (!(cmd->flags & CMD_SEND_IN_IDLE) &&
            !trans_pcie->ref_cmd_in_flight) {
@@ -1961,11 +1961,9 @@ cancel:
 
 int iwl_trans_pcie_send_hcmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd)
 {
-       struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
-
        /* Make sure the NIC is still alive in the bus */
-       if (trans_pcie->scheduled_for_removal)
-               return -EIO;
+       if (test_bit(STATUS_TRANS_DEAD, &trans->status))
+               return -ENODEV;
 
        if (!(cmd->flags & CMD_SEND_IN_RFKILL) &&
            test_bit(STATUS_RFKILL_OPMODE, &trans->status)) {