iwlwifi: move FW_ERROR to priv
authorDon Fry <donald.h.fry@intel.com>
Thu, 15 Mar 2012 20:27:05 +0000 (13:27 -0700)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 9 Apr 2012 20:37:47 +0000 (16:37 -0400)
The op_mode should check for FW_ERROR before calling send_cmd.  This
removes the need to test for FW_ERROR in the trans layer.

Signed-off-by: Don Fry <donald.h.fry@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/iwlwifi/iwl-agn-lib.c
drivers/net/wireless/iwlwifi/iwl-agn.c
drivers/net/wireless/iwlwifi/iwl-core.c
drivers/net/wireless/iwlwifi/iwl-debugfs.c
drivers/net/wireless/iwlwifi/iwl-scan.c
drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c

index bbb67b0604fb58908f5c8409e8e799bbd276c7eb..180df01d0916a786e1418a76468a01137cab9fa6 100644 (file)
@@ -1298,6 +1298,12 @@ int iwl_dvm_send_cmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
                return -EIO;
        }
 
+       if (test_bit(STATUS_FW_ERROR, &priv->status)) {
+               IWL_ERR(priv, "Command %s failed: FW Error\n",
+                       get_cmd_string(cmd->id));
+               return -EIO;
+       }
+
        /*
         * Synchronous commands from this op-mode must hold
         * the mutex, this ensures we don't try to send two
index e91d88d552ade59c19365554833e7e77cc078baa..94af564bb53f5d52a3fa1eed866056fa65b26e16 100644 (file)
@@ -920,11 +920,10 @@ void iwl_down(struct iwl_priv *priv)
                                STATUS_RF_KILL_HW |
                        test_bit(STATUS_GEO_CONFIGURED, &priv->status) <<
                                STATUS_GEO_CONFIGURED |
+                       test_bit(STATUS_FW_ERROR, &priv->status) <<
+                               STATUS_FW_ERROR |
                        test_bit(STATUS_EXIT_PENDING, &priv->status) <<
                                STATUS_EXIT_PENDING;
-       priv->shrd->status &=
-                       test_bit(STATUS_FW_ERROR, &priv->shrd->status) <<
-                               STATUS_FW_ERROR;
 
        dev_kfree_skb(priv->beacon_skb);
        priv->beacon_skb = NULL;
@@ -1013,7 +1012,7 @@ static void iwl_bg_restart(struct work_struct *data)
        if (test_bit(STATUS_EXIT_PENDING, &priv->status))
                return;
 
-       if (test_and_clear_bit(STATUS_FW_ERROR, &priv->shrd->status)) {
+       if (test_and_clear_bit(STATUS_FW_ERROR, &priv->status)) {
                mutex_lock(&priv->mutex);
                iwlagn_prepare_restart(priv);
                mutex_unlock(&priv->mutex);
index ed201e7b2844dfae9ef64c9393f5300c87ae6670..88ea31d9eb758ef611048fd2c6cc7651379fa793 100644 (file)
@@ -369,7 +369,7 @@ void iwlagn_fw_error(struct iwl_priv *priv, bool ondemand)
        priv->ucode_loaded = false;
 
        /* Set the FW error flag -- cleared on iwl_down */
-       set_bit(STATUS_FW_ERROR, &priv->shrd->status);
+       set_bit(STATUS_FW_ERROR, &priv->status);
 
        /* Cancel currently queued command. */
        clear_bit(STATUS_HCMD_ACTIVE, &priv->shrd->status);
index a2baf17565204d7f141dd0394adea31c920ed98f..03fc27db72d1b1be398e5760fa37c98d2228dd20 100644 (file)
@@ -557,7 +557,7 @@ static ssize_t iwl_dbgfs_status_read(struct file *file,
        pos += scnprintf(buf + pos, bufsz - pos, "STATUS_POWER_PMI:\t %d\n",
                test_bit(STATUS_POWER_PMI, &priv->shrd->status));
        pos += scnprintf(buf + pos, bufsz - pos, "STATUS_FW_ERROR:\t %d\n",
-               test_bit(STATUS_FW_ERROR, &priv->shrd->status));
+               test_bit(STATUS_FW_ERROR, &priv->status));
        return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
 }
 
index f3e5c2aba266400b07a6556eb709b1fc498d1af9..56becf25656a6b96f75d0e2e1f78891a8d1272a2 100644 (file)
@@ -69,7 +69,7 @@ static int iwl_send_scan_abort(struct iwl_priv *priv)
        if (!test_bit(STATUS_READY, &priv->status) ||
            !test_bit(STATUS_GEO_CONFIGURED, &priv->status) ||
            !test_bit(STATUS_SCAN_HW, &priv->status) ||
-           test_bit(STATUS_FW_ERROR, &priv->shrd->status))
+           test_bit(STATUS_FW_ERROR, &priv->status))
                return -EIO;
 
        ret = iwl_dvm_send_cmd(priv, &cmd);
index 105c093bae3f219be010393b772b62968528273c..61b0fba5abc72e03a85dfb6b9ab04ad64fa2629a 100644 (file)
@@ -536,11 +536,6 @@ static int iwl_enqueue_hcmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd)
        int trace_idx;
 #endif
 
-       if (test_bit(STATUS_FW_ERROR, &trans->shrd->status)) {
-               IWL_WARN(trans, "fw recovery, no hcmd send\n");
-               return -EIO;
-       }
-
        copy_size = sizeof(out_cmd->hdr);
        cmd_size = sizeof(out_cmd->hdr);
 
@@ -821,12 +816,6 @@ static int iwl_send_cmd_sync(struct iwl_trans *trans, struct iwl_host_cmd *cmd)
        IWL_DEBUG_INFO(trans, "Attempting to send sync command %s\n",
                        get_cmd_string(cmd->id));
 
-       if (test_bit(STATUS_FW_ERROR, &trans->shrd->status)) {
-               IWL_ERR(trans, "Command %s failed: FW Error\n",
-                              get_cmd_string(cmd->id));
-               return -EIO;
-       }
-
        if (WARN_ON(test_and_set_bit(STATUS_HCMD_ACTIVE,
                                     &trans->shrd->status))) {
                IWL_ERR(trans, "Command %s: a command is already active!\n",