iwlwifi: move ucode_owner to priv
authorJohannes Berg <johannes.berg@intel.com>
Tue, 6 Mar 2012 21:30:59 +0000 (13:30 -0800)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 7 Mar 2012 18:56:33 +0000 (13:56 -0500)
The transport doesn't really need to know as
we can enforce it in the command wrapper.
Move the ucode_owner variable into priv and
do all enforcing there.

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>
drivers/net/wireless/iwlwifi/iwl-agn-lib.c
drivers/net/wireless/iwlwifi/iwl-agn-rx.c
drivers/net/wireless/iwlwifi/iwl-agn.c
drivers/net/wireless/iwlwifi/iwl-dev.h
drivers/net/wireless/iwlwifi/iwl-shared.h
drivers/net/wireless/iwlwifi/iwl-testmode.c
drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c
drivers/net/wireless/iwlwifi/iwl-trans-pcie.c

index 90f1f8a506f222f77926ec6dbffc1d8ff88e1e2b..dec2693c8cbaff0c62cddfe2dc3bd19a7d330cb6 100644 (file)
@@ -1306,6 +1306,12 @@ int iwl_dvm_send_cmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
        if (cmd->flags & CMD_SYNC)
                lockdep_assert_held(&priv->mutex);
 
+       if (priv->ucode_owner == IWL_OWNERSHIP_TM &&
+           !(cmd->flags & CMD_ON_DEMAND)) {
+               IWL_DEBUG_HC(priv, "tm own the uCode, no regular hcmd send\n");
+               return -EIO;
+       }
+
        return iwl_trans_send_cmd(trans(priv), cmd);
 }
 
index f17142bb5df13f7354d8fde00dd13db17b4235cb..08de306c4c227bfc6b52aaf86e0d83529e5e1e9c 100644 (file)
@@ -1165,7 +1165,7 @@ int iwl_rx_dispatch(struct iwl_op_mode *op_mode, struct iwl_rx_cmd_buffer *rxb,
        iwl_notification_wait_notify(&priv->notif_wait, pkt);
 
        if (priv->pre_rx_handler &&
-           priv->shrd->ucode_owner == IWL_OWNERSHIP_TM)
+           priv->ucode_owner == IWL_OWNERSHIP_TM)
                priv->pre_rx_handler(priv, rxb);
        else {
                /* Based on type of command response or notification,
index ce62a2fcd67ff0f1ce6d14a3bcc5fd353caebace..afded2947edd20babee400ff310eb87d63d9fb75 100644 (file)
@@ -1053,6 +1053,8 @@ static int iwl_init_drv(struct iwl_priv *priv)
        priv->missed_beacon_threshold = IWL_MISSED_BEACON_THRESHOLD_DEF;
        priv->agg_tids_count = 0;
 
+       priv->ucode_owner = IWL_OWNERSHIP_DRIVER;
+
        /* initialize force reset */
        priv->force_reset[IWL_RF_RESET].reset_duration =
                IWL_DELAY_NEXT_FORCE_RF_RESET;
index c57e605b26b70f406c96f7a35d3e86415c4ea94d..a301daf18fbcba30f4ccb33d6330637db8847cfe 100644 (file)
@@ -748,6 +748,10 @@ struct iwl_priv {
        struct iwl_spectrum_notification measure_report;
        u8 measurement_status;
 
+#define IWL_OWNERSHIP_DRIVER   0
+#define IWL_OWNERSHIP_TM       1
+       u8 ucode_owner;
+
        /* ucode beacon time */
        u32 ucode_beacon_time;
        int missed_beacon_threshold;
index 8ffc760791213df7297dfe2bbfb0a819771b05c5..a648a2b4934a1d2d4bd4febef7a391a077602670 100644 (file)
@@ -356,7 +356,6 @@ struct iwl_cfg {
 /**
  * struct iwl_shared - shared fields for all the layers of the driver
  *
- * @ucode_owner: IWL_OWNERSHIP_*
  * @cmd_queue: command queue number
  * @status: STATUS_*
  * @wowlan: are we running wowlan uCode
@@ -374,9 +373,6 @@ struct iwl_cfg {
  * @device_pointers: pointers to ucode event tables
  */
 struct iwl_shared {
-#define IWL_OWNERSHIP_DRIVER   0
-#define IWL_OWNERSHIP_TM       1
-       u8 ucode_owner;
        u8 cmd_queue;
        unsigned long status;
        u8 valid_contexts;
index cc049d22151f070ffbe57efa31b28e06d60d150b..63868df32263d64476ede7c4fb00765886011dcd 100644 (file)
@@ -770,7 +770,7 @@ static int iwl_testmode_ownership(struct ieee80211_hw *hw, struct nlattr **tb)
 
        owner = nla_get_u8(tb[IWL_TM_ATTR_UCODE_OWNER]);
        if ((owner == IWL_OWNERSHIP_DRIVER) || (owner == IWL_OWNERSHIP_TM))
-               priv->shrd->ucode_owner = owner;
+               priv->ucode_owner = owner;
        else {
                IWL_ERR(priv, "Invalid owner\n");
                return -EINVAL;
index 7feeb2d521463f56b97dcd1d109d626b115c8c5b..73febc9726cbf4fc2cbae51b9d13911be7592c29 100644 (file)
@@ -685,12 +685,6 @@ static int iwl_enqueue_hcmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd)
                return -EIO;
        }
 
-       if ((trans->shrd->ucode_owner == IWL_OWNERSHIP_TM) &&
-           !(cmd->flags & CMD_ON_DEMAND)) {
-               IWL_DEBUG_HC(trans, "tm own the uCode, no regular hcmd send\n");
-               return -EIO;
-       }
-
        copy_size = sizeof(out_cmd->hdr);
        cmd_size = sizeof(out_cmd->hdr);
 
index 6090e9800ce48734a76d7b73f0cfb420ed2f2000..598a92d5089571107c1e6c48eec2534672174fb2 100644 (file)
@@ -1022,7 +1022,6 @@ static int iwl_trans_pcie_start_fw(struct iwl_trans *trans,
                IWL_TRANS_GET_PCIE_TRANS(trans);
        bool hw_rfkill;
 
-       trans->shrd->ucode_owner = IWL_OWNERSHIP_DRIVER;
        trans_pcie->ac_to_queue[IWL_RXON_CTX_BSS] = iwlagn_bss_ac_to_queue;
        trans_pcie->ac_to_queue[IWL_RXON_CTX_PAN] = iwlagn_pan_ac_to_queue;