Continue splitting the status bits between transport and op_mode.
All but a few are separated.
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>
        struct iwlagn_tx_power_dbm_cmd tx_power_cmd;
        u8 tx_ant_cfg_cmd;
 
-       if (WARN_ONCE(test_bit(STATUS_SCAN_HW, &priv->shrd->status),
+       if (WARN_ONCE(test_bit(STATUS_SCAN_HW, &priv->status),
                      "TX Power requested while scanning!\n"))
                return -EAGAIN;
 
         * STATUS_SCANNING to avoid race when queue_work two times from
         * different notifications, but quit and not perform any work at all.
         */
-       if (test_bit(STATUS_SCAN_HW, &priv->shrd->status))
+       if (test_bit(STATUS_SCAN_HW, &priv->status))
                goto out;
 
        iwl_update_chain_flags(priv);
 
 int iwl_dvm_send_cmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
 {
-       if (iwl_is_rfkill(priv->shrd) || iwl_is_ctkill(priv)) {
+       if (iwl_is_rfkill(priv) || iwl_is_ctkill(priv)) {
                IWL_WARN(priv, "Not sending command - %s KILL\n",
-                        iwl_is_rfkill(priv->shrd) ? "RF" : "CT");
+                        iwl_is_rfkill(priv) ? "RF" : "CT");
                return -EIO;
        }
 
 
        struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];
        struct iwl_rxon_cmd *rxon = (void *)&ctx->active;
 
-       if (!test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->shrd->status))
+       if (!test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status))
                return 0;
 
        if (!le32_to_cpu(csa->status) && csa->channel == priv->switch_channel) {
 {
        unsigned int msecs;
 
-       if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
+       if (test_bit(STATUS_EXIT_PENDING, &priv->status))
                return;
 
        msecs = jiffies_to_msecs(stamp - priv->rx_statistics_jiffies);
 
        priv->rx_statistics_jiffies = stamp;
 
-       set_bit(STATUS_STATISTICS, &priv->shrd->status);
+       set_bit(STATUS_STATISTICS, &priv->status);
 
        /* Reschedule the statistics timer to occur in
         * reg_recalib_period seconds to ensure we get a
        mod_timer(&priv->statistics_periodic, jiffies +
                  msecs_to_jiffies(reg_recalib_period * 1000));
 
-       if (unlikely(!test_bit(STATUS_SCANNING, &priv->shrd->status)) &&
+       if (unlikely(!test_bit(STATUS_SCANNING, &priv->status)) &&
            (pkt->hdr.cmd == STATISTICS_NOTIFICATION)) {
                iwlagn_rx_calc_noise(priv);
                queue_work(priv->workqueue, &priv->run_time_calib_work);
                iwl_tt_exit_ct_kill(priv);
 
        if (flags & HW_CARD_DISABLED)
-               set_bit(STATUS_RF_KILL_HW, &priv->shrd->status);
+               set_bit(STATUS_RF_KILL_HW, &priv->status);
        else
-               clear_bit(STATUS_RF_KILL_HW, &priv->shrd->status);
+               clear_bit(STATUS_RF_KILL_HW, &priv->status);
 
 
        if (!(flags & RXON_CARD_DISABLED))
                iwl_scan_cancel(priv);
 
        if ((test_bit(STATUS_RF_KILL_HW, &status) !=
-            test_bit(STATUS_RF_KILL_HW, &priv->shrd->status)))
+            test_bit(STATUS_RF_KILL_HW, &priv->status)))
                wiphy_rfkill_set_hw_state(priv->hw->wiphy,
-                       test_bit(STATUS_RF_KILL_HW, &priv->shrd->status));
+                       test_bit(STATUS_RF_KILL_HW, &priv->status));
        else
                wake_up(&priv->shrd->wait_command_queue);
        return 0;
                    le32_to_cpu(missed_beacon->total_missed_becons),
                    le32_to_cpu(missed_beacon->num_recvd_beacons),
                    le32_to_cpu(missed_beacon->num_expected_beacons));
-               if (!test_bit(STATUS_SCANNING, &priv->shrd->status))
+               if (!test_bit(STATUS_SCANNING, &priv->status))
                        iwl_init_sensitivity(priv);
        }
        return 0;
 
                slot0 = bcnint / 2;
                slot1 = bcnint - slot0;
 
-               if (test_bit(STATUS_SCAN_HW, &priv->shrd->status) ||
+               if (test_bit(STATUS_SCAN_HW, &priv->status) ||
                    (!ctx_bss->vif->bss_conf.idle &&
                     !ctx_bss->vif->bss_conf.assoc)) {
                        slot0 = dtim * bcnint * 3 - IWL_MIN_SLOT_TIME;
                                        ctx_pan->beacon_int;
                slot1 = max_t(int, DEFAULT_BEACON_INTERVAL, slot1);
 
-               if (test_bit(STATUS_SCAN_HW, &priv->shrd->status)) {
+               if (test_bit(STATUS_SCAN_HW, &priv->status)) {
                        slot0 = slot1 * 3 - IWL_MIN_SLOT_TIME;
                        slot1 = IWL_MIN_SLOT_TIME;
                }
 
        lockdep_assert_held(&priv->mutex);
 
-       if (!iwl_is_alive(priv->shrd))
+       if (!iwl_is_alive(priv))
                return -EBUSY;
 
        /* This function hardcodes a bunch of dual-mode assumptions */
         * receive commit_rxon request
         * abort any previous channel switch if still in process
         */
-       if (test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->shrd->status) &&
+       if (test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status) &&
            (priv->switch_channel != ctx->staging.channel)) {
                IWL_DEBUG_11H(priv, "abort channel switch on %d\n",
                              le16_to_cpu(priv->switch_channel));
 
        mutex_lock(&priv->mutex);
 
-       if (unlikely(test_bit(STATUS_SCANNING, &priv->shrd->status))) {
+       if (unlikely(test_bit(STATUS_SCANNING, &priv->status))) {
                IWL_DEBUG_MAC80211(priv, "leave - scanning\n");
                goto out;
        }
 
-       if (!iwl_is_ready(priv->shrd)) {
+       if (!iwl_is_ready(priv)) {
                IWL_DEBUG_MAC80211(priv, "leave - not ready\n");
                goto out;
        }
 
        mutex_lock(&priv->mutex);
 
-       if (unlikely(!iwl_is_ready(priv->shrd))) {
+       if (unlikely(!iwl_is_ready(priv))) {
                IWL_DEBUG_MAC80211(priv, "leave - not ready\n");
                mutex_unlock(&priv->mutex);
                return;
 
 {
        u8 tid;
 
-       if (!iwl_is_ready(priv->shrd)) {
+       if (!iwl_is_ready(priv)) {
                IWL_DEBUG_INFO(priv,
                        "Unable to remove station %pM, device not ready.\n",
                        addr);
        int ret;
        bool send_lq;
 
-       if (!iwl_is_ready(priv->shrd)) {
+       if (!iwl_is_ready(priv)) {
                IWL_DEBUG_INFO(priv,
                               "Not ready yet, not restoring any stations.\n");
                return;
                      keyconf->keyidx);
 
        memset(&ctx->wep_keys[keyconf->keyidx], 0, sizeof(ctx->wep_keys[0]));
-       if (iwl_is_rfkill(priv->shrd)) {
+       if (iwl_is_rfkill(priv)) {
                IWL_DEBUG_WEP(priv,
                        "Not sending REPLY_WEPKEY command due to RFKILL.\n");
                /* but keys in device are clear anyway so return success */
 
        struct iwl_tt_mgmt *tt = &priv->thermal_throttle;
        unsigned long flags;
 
-       if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
+       if (test_bit(STATUS_EXIT_PENDING, &priv->status))
                return;
 
        if (tt->state == IWL_TI_CT_KILL) {
        struct iwl_priv *priv = (struct iwl_priv *)data;
        struct iwl_tt_mgmt *tt = &priv->thermal_throttle;
 
-       if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
+       if (test_bit(STATUS_EXIT_PENDING, &priv->status))
                return;
 
        /* temperature timer expired, ready to go into CT_KILL state */
        struct iwl_priv *priv = container_of(work, struct iwl_priv, ct_enter);
        struct iwl_tt_mgmt *tt = &priv->thermal_throttle;
 
-       if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
+       if (test_bit(STATUS_EXIT_PENDING, &priv->status))
                return;
 
-       if (!iwl_is_ready(priv->shrd))
+       if (!iwl_is_ready(priv))
                return;
 
        if (tt->state != IWL_TI_CT_KILL) {
        struct iwl_priv *priv = container_of(work, struct iwl_priv, ct_exit);
        struct iwl_tt_mgmt *tt = &priv->thermal_throttle;
 
-       if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
+       if (test_bit(STATUS_EXIT_PENDING, &priv->status))
                return;
 
-       if (!iwl_is_ready(priv->shrd))
+       if (!iwl_is_ready(priv))
                return;
 
        /* stop ct_kill_exit_tm timer */
 
 void iwl_tt_enter_ct_kill(struct iwl_priv *priv)
 {
-       if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
+       if (test_bit(STATUS_EXIT_PENDING, &priv->status))
                return;
 
        IWL_DEBUG_TEMP(priv, "Queueing critical temperature enter.\n");
 
 void iwl_tt_exit_ct_kill(struct iwl_priv *priv)
 {
-       if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
+       if (test_bit(STATUS_EXIT_PENDING, &priv->status))
                return;
 
        IWL_DEBUG_TEMP(priv, "Queueing critical temperature exit.\n");
        struct iwl_priv *priv = container_of(work, struct iwl_priv, tt_work);
        s32 temp = priv->temperature; /* degrees CELSIUS except specified */
 
-       if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
+       if (test_bit(STATUS_EXIT_PENDING, &priv->status))
                return;
 
        if (!priv->thermal_throttle.advanced_tt)
 
 void iwl_tt_handler(struct iwl_priv *priv)
 {
-       if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
+       if (test_bit(STATUS_EXIT_PENDING, &priv->status))
                return;
 
        IWL_DEBUG_TEMP(priv, "Queueing thermal throttling work.\n");
 
        if (info->control.vif)
                ctx = iwl_rxon_ctx_from_vif(info->control.vif);
 
-       if (iwl_is_rfkill(priv->shrd)) {
+       if (iwl_is_rfkill(priv)) {
                IWL_DEBUG_DROP(priv, "Dropping - RF KILL\n");
                goto drop_unlock_priv;
        }
 {
        if (frame_count == 1 && status == TX_STATUS_FAIL_RFKILL_FLUSH) {
                IWL_ERR(priv, "Tx flush command to flush out all frames\n");
-               if (!test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
+               if (!test_bit(STATUS_EXIT_PENDING, &priv->status))
                        queue_work(priv->workqueue, &priv->tx_flush);
        }
 }
 
        struct iwl_priv *priv =
                container_of(work, struct iwl_priv, bt_runtime_config);
 
-       if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
+       if (test_bit(STATUS_EXIT_PENDING, &priv->status))
                return;
 
        /* dont send host command if rf-kill is on */
-       if (!iwl_is_ready_rf(priv->shrd))
+       if (!iwl_is_ready_rf(priv))
                return;
        iwlagn_send_advance_bt_config(priv);
 }
 
        mutex_lock(&priv->mutex);
 
-       if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
+       if (test_bit(STATUS_EXIT_PENDING, &priv->status))
                goto out;
 
        /* dont send host command if rf-kill is on */
-       if (!iwl_is_ready_rf(priv->shrd))
+       if (!iwl_is_ready_rf(priv))
                goto out;
 
        IWL_DEBUG_INFO(priv, "BT coex in %s mode\n",
 {
        struct iwl_priv *priv = (struct iwl_priv *)data;
 
-       if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
+       if (test_bit(STATUS_EXIT_PENDING, &priv->status))
                return;
 
        /* dont send host command if rf-kill is on */
-       if (!iwl_is_ready_rf(priv->shrd))
+       if (!iwl_is_ready_rf(priv))
                return;
 
        iwl_send_statistics_request(priv, CMD_ASYNC, false);
 {
        struct iwl_priv *priv = (struct iwl_priv *)data;
 
-       if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
+       if (test_bit(STATUS_EXIT_PENDING, &priv->status))
                return;
 
        if (priv->event_log.ucode_trace) {
        struct iwl_priv *priv =
                container_of(work, struct iwl_priv, tx_flush);
 
-       if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
+       if (test_bit(STATUS_EXIT_PENDING, &priv->status))
                return;
 
        /* do nothing if rf-kill is on */
-       if (!iwl_is_ready_rf(priv->shrd))
+       if (!iwl_is_ready_rf(priv))
                return;
 
        IWL_DEBUG_INFO(priv, "device request: flush all tx frames\n");
        IWL_DEBUG_INFO(priv, "Runtime Alive received.\n");
 
        /* After the ALIVE response, we can send host commands to the uCode */
-       set_bit(STATUS_ALIVE, &priv->shrd->status);
+       set_bit(STATUS_ALIVE, &priv->status);
 
        /* Enable watchdog to monitor the driver tx queues */
        iwl_setup_watchdog(priv);
 
-       if (iwl_is_rfkill(priv->shrd))
+       if (iwl_is_rfkill(priv))
                return -ERFKILL;
 
        if (priv->event_log.ucode_trace) {
                iwl_reset_run_time_calib(priv);
        }
 
-       set_bit(STATUS_READY, &priv->shrd->status);
+       set_bit(STATUS_READY, &priv->status);
 
        /* Configure the adapter for unassociated operation */
        ret = iwlagn_commit_rxon(priv, ctx);
        ieee80211_remain_on_channel_expired(priv->hw);
 
        exit_pending =
-               test_and_set_bit(STATUS_EXIT_PENDING, &priv->shrd->status);
+               test_and_set_bit(STATUS_EXIT_PENDING, &priv->status);
 
        /* Stop TX queues watchdog. We need to have STATUS_EXIT_PENDING bit set
         * to prevent rearm timer */
        /* Wipe out the EXIT_PENDING status bit if we are not actually
         * exiting the module */
        if (!exit_pending)
-               clear_bit(STATUS_EXIT_PENDING, &priv->shrd->status);
+               clear_bit(STATUS_EXIT_PENDING, &priv->status);
 
        if (priv->mac80211_registered)
                ieee80211_stop_queues(priv->hw);
 
        /* Clear out all status bits but a few that are stable across reset */
        priv->shrd->status &=
-                       test_bit(STATUS_RF_KILL_HW, &priv->shrd->status) <<
+                       test_bit(STATUS_RF_KILL_HW, &priv->status) <<
                                STATUS_RF_KILL_HW |
-                       test_bit(STATUS_GEO_CONFIGURED, &priv->shrd->status) <<
+                       test_bit(STATUS_GEO_CONFIGURED, &priv->status) <<
                                STATUS_GEO_CONFIGURED |
                        test_bit(STATUS_FW_ERROR, &priv->shrd->status) <<
                                STATUS_FW_ERROR |
-                       test_bit(STATUS_EXIT_PENDING, &priv->shrd->status) <<
+                       test_bit(STATUS_EXIT_PENDING, &priv->status) <<
                                STATUS_EXIT_PENDING;
 
        dev_kfree_skb(priv->beacon_skb);
 
        mutex_lock(&priv->mutex);
 
-       if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status) ||
-           test_bit(STATUS_SCANNING, &priv->shrd->status)) {
+       if (test_bit(STATUS_EXIT_PENDING, &priv->status) ||
+           test_bit(STATUS_SCANNING, &priv->status)) {
                mutex_unlock(&priv->mutex);
                return;
        }
 {
        struct iwl_priv *priv = container_of(data, struct iwl_priv, restart);
 
-       if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
+       if (test_bit(STATUS_EXIT_PENDING, &priv->status))
                return;
 
        if (test_and_clear_bit(STATUS_FW_ERROR, &priv->shrd->status)) {
 
 
 /* status checks */
 
-static inline int iwl_is_ready(struct iwl_shared *shrd)
+static inline int iwl_is_ready(struct iwl_priv *priv)
 {
        /* The adapter is 'ready' if READY and GEO_CONFIGURED bits are
         * set but EXIT_PENDING is not */
-       return test_bit(STATUS_READY, &shrd->status) &&
-              test_bit(STATUS_GEO_CONFIGURED, &shrd->status) &&
-              !test_bit(STATUS_EXIT_PENDING, &shrd->status);
+       return test_bit(STATUS_READY, &priv->status) &&
+              test_bit(STATUS_GEO_CONFIGURED, &priv->status) &&
+              !test_bit(STATUS_EXIT_PENDING, &priv->status);
 }
 
-static inline int iwl_is_alive(struct iwl_shared *shrd)
+static inline int iwl_is_alive(struct iwl_priv *priv)
 {
-       return test_bit(STATUS_ALIVE, &shrd->status);
+       return test_bit(STATUS_ALIVE, &priv->status);
 }
 
-static inline int iwl_is_rfkill_hw(struct iwl_shared *shrd)
+static inline int iwl_is_rfkill(struct iwl_priv *priv)
 {
-       return test_bit(STATUS_RF_KILL_HW, &shrd->status);
-}
-
-static inline int iwl_is_rfkill(struct iwl_shared *shrd)
-{
-       return iwl_is_rfkill_hw(shrd);
+       return test_bit(STATUS_RF_KILL_HW, &priv->status);
 }
 
 static inline int iwl_is_ctkill(struct iwl_priv *priv)
        return test_bit(STATUS_CT_KILL, &priv->status);
 }
 
-static inline int iwl_is_ready_rf(struct iwl_shared *shrd)
+static inline int iwl_is_ready_rf(struct iwl_priv *priv)
 {
-       if (iwl_is_rfkill(shrd))
+       if (iwl_is_rfkill(priv))
                return 0;
 
-       return iwl_is_ready(shrd);
+       return iwl_is_ready(priv);
 }
 
 #ifdef CONFIG_IWLWIFI_DEBUG
 #define IWL_DEBUG_QUIET_RFKILL(m, fmt, args...)        \
 do {                                                                   \
-       if (!iwl_is_rfkill((m)->shrd))                                  \
+       if (!iwl_is_rfkill((m)))                                        \
                IWL_ERR(m, fmt, ##args);                                \
        else                                                            \
                __iwl_err(trans(m)->dev, true,                          \
 #else
 #define IWL_DEBUG_QUIET_RFKILL(m, fmt, args...)        \
 do {                                                                   \
-       if (!iwl_is_rfkill((m)->shrd))                                  \
+       if (!iwl_is_rfkill((m)))                                        \
                IWL_ERR(m, fmt, ##args);                                \
        else                                                            \
                __iwl_err(trans(m)->dev, true, true, fmt, ##args);      \
 
        if (priv->bands[IEEE80211_BAND_2GHZ].n_bitrates ||
            priv->bands[IEEE80211_BAND_5GHZ].n_bitrates) {
                IWL_DEBUG_INFO(priv, "Geography modes already initialized.\n");
-               set_bit(STATUS_GEO_CONFIGURED, &priv->shrd->status);
+               set_bit(STATUS_GEO_CONFIGURED, &priv->status);
                return 0;
        }
 
                   priv->bands[IEEE80211_BAND_2GHZ].n_channels,
                   priv->bands[IEEE80211_BAND_5GHZ].n_channels);
 
-       set_bit(STATUS_GEO_CONFIGURED, &priv->shrd->status);
+       set_bit(STATUS_GEO_CONFIGURED, &priv->status);
 
        return 0;
 }
 {
        kfree(priv->ieee_channels);
        kfree(priv->ieee_rates);
-       clear_bit(STATUS_GEO_CONFIGURED, &priv->shrd->status);
+       clear_bit(STATUS_GEO_CONFIGURED, &priv->status);
 }
 
 static bool iwl_is_channel_extension(struct iwl_priv *priv,
         */
        struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];
 
-       if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
+       if (test_bit(STATUS_EXIT_PENDING, &priv->status))
                return;
 
-       if (test_and_clear_bit(STATUS_CHANNEL_SWITCH_PENDING,
-                               &priv->shrd->status))
+       if (test_and_clear_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status))
                ieee80211_chswitch_done(ctx->vif, is_success);
 }
 
 
        /* Keep the restart process from trying to send host
         * commands by clearing the ready bit */
-       clear_bit(STATUS_READY, &priv->shrd->status);
+       clear_bit(STATUS_READY, &priv->status);
 
        wake_up(&priv->shrd->wait_command_queue);
 
                        priv->reload_count = 0;
        }
 
-       if (!test_bit(STATUS_EXIT_PENDING, &priv->shrd->status)) {
+       if (!test_bit(STATUS_EXIT_PENDING, &priv->status)) {
                if (iwlagn_mod_params.restart_fw) {
                        IWL_DEBUG_FW_ERRORS(priv,
                                  "Restarting adapter due to uCode error.\n");
                return -EINVAL;
        }
 
-       if (!iwl_is_ready_rf(priv->shrd))
+       if (!iwl_is_ready_rf(priv))
                return -EIO;
 
        /* scan complete and commit_rxon use tx_power_next value,
        priv->tx_power_next = tx_power;
 
        /* do not set tx power when scanning or channel changing */
-       defer = test_bit(STATUS_SCANNING, &priv->shrd->status) ||
+       defer = test_bit(STATUS_SCANNING, &priv->status) ||
                memcmp(&ctx->active, &ctx->staging, sizeof(ctx->staging));
        if (defer && !force) {
                IWL_DEBUG_INFO(priv, "Deferring tx power set\n");
 
 static void iwl_force_rf_reset(struct iwl_priv *priv)
 {
-       if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
+       if (test_bit(STATUS_EXIT_PENDING, &priv->status))
                return;
 
        if (!iwl_is_any_associated(priv)) {
 {
        struct iwl_force_reset *force_reset;
 
-       if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
+       if (test_bit(STATUS_EXIT_PENDING, &priv->status))
                return -EINVAL;
 
        if (mode >= IWL_MAX_FORCE_RESET) {
        int cnt;
        unsigned long timeout;
 
-       if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
+       if (test_bit(STATUS_EXIT_PENDING, &priv->status))
                return;
 
-       if (iwl_is_rfkill(priv->shrd))
+       if (iwl_is_rfkill(priv))
                return;
 
        timeout = hw_params(priv).wd_timeout;
        struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode);
 
        if (state)
-               set_bit(STATUS_RF_KILL_HW, &priv->shrd->status);
+               set_bit(STATUS_RF_KILL_HW, &priv->status);
        else
-               clear_bit(STATUS_RF_KILL_HW, &priv->shrd->status);
+               clear_bit(STATUS_RF_KILL_HW, &priv->status);
 
        wiphy_rfkill_set_hw_state(priv->hw->wiphy, state);
 }
 
        char *buf;
        ssize_t ret;
 
-       if (!test_bit(STATUS_GEO_CONFIGURED, &priv->shrd->status))
+       if (!test_bit(STATUS_GEO_CONFIGURED, &priv->status))
                return -EAGAIN;
 
        buf = kzalloc(bufsz, GFP_KERNEL);
 
        pos += scnprintf(buf + pos, bufsz - pos, "STATUS_HCMD_ACTIVE:\t %d\n",
                test_bit(STATUS_HCMD_ACTIVE, &priv->shrd->status));
-       pos += scnprintf(buf + pos, bufsz - pos, "STATUS_INT_ENABLED:\t %d\n",
-               test_bit(STATUS_INT_ENABLED, &priv->shrd->status));
        pos += scnprintf(buf + pos, bufsz - pos, "STATUS_RF_KILL_HW:\t %d\n",
-               test_bit(STATUS_RF_KILL_HW, &priv->shrd->status));
+               test_bit(STATUS_RF_KILL_HW, &priv->status));
        pos += scnprintf(buf + pos, bufsz - pos, "STATUS_CT_KILL:\t\t %d\n",
                test_bit(STATUS_CT_KILL, &priv->status));
        pos += scnprintf(buf + pos, bufsz - pos, "STATUS_ALIVE:\t\t %d\n",
-               test_bit(STATUS_ALIVE, &priv->shrd->status));
+               test_bit(STATUS_ALIVE, &priv->status));
        pos += scnprintf(buf + pos, bufsz - pos, "STATUS_READY:\t\t %d\n",
-               test_bit(STATUS_READY, &priv->shrd->status));
+               test_bit(STATUS_READY, &priv->status));
        pos += scnprintf(buf + pos, bufsz - pos, "STATUS_GEO_CONFIGURED:\t %d\n",
-               test_bit(STATUS_GEO_CONFIGURED, &priv->shrd->status));
+               test_bit(STATUS_GEO_CONFIGURED, &priv->status));
        pos += scnprintf(buf + pos, bufsz - pos, "STATUS_EXIT_PENDING:\t %d\n",
-               test_bit(STATUS_EXIT_PENDING, &priv->shrd->status));
+               test_bit(STATUS_EXIT_PENDING, &priv->status));
        pos += scnprintf(buf + pos, bufsz - pos, "STATUS_STATISTICS:\t %d\n",
-               test_bit(STATUS_STATISTICS, &priv->shrd->status));
+               test_bit(STATUS_STATISTICS, &priv->status));
        pos += scnprintf(buf + pos, bufsz - pos, "STATUS_SCANNING:\t %d\n",
-               test_bit(STATUS_SCANNING, &priv->shrd->status));
+               test_bit(STATUS_SCANNING, &priv->status));
        pos += scnprintf(buf + pos, bufsz - pos, "STATUS_SCAN_ABORTING:\t %d\n",
-               test_bit(STATUS_SCAN_ABORTING, &priv->shrd->status));
+               test_bit(STATUS_SCAN_ABORTING, &priv->status));
        pos += scnprintf(buf + pos, bufsz - pos, "STATUS_SCAN_HW:\t\t %d\n",
-               test_bit(STATUS_SCAN_HW, &priv->shrd->status));
+               test_bit(STATUS_SCAN_HW, &priv->status));
        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",
        if (value != -1 && (value < 0 || value >= IWL_POWER_NUM))
                return -EINVAL;
 
-       if (!iwl_is_ready_rf(priv->shrd))
+       if (!iwl_is_ready_rf(priv))
                return -EAGAIN;
 
        priv->power_data.debug_sleep_level_override = value;
        struct statistics_rx_non_phy *delta_general, *max_general;
        struct statistics_rx_ht_phy *ht, *accum_ht, *delta_ht, *max_ht;
 
-       if (!iwl_is_alive(priv->shrd))
+       if (!iwl_is_alive(priv))
                return -EAGAIN;
 
        buf = kzalloc(bufsz, GFP_KERNEL);
        ssize_t ret;
        struct statistics_tx *tx, *accum_tx, *delta_tx, *max_tx;
 
-       if (!iwl_is_alive(priv->shrd))
+       if (!iwl_is_alive(priv))
                return -EAGAIN;
 
        buf = kzalloc(bufsz, GFP_KERNEL);
        struct statistics_dbg *dbg, *accum_dbg, *delta_dbg, *max_dbg;
        struct statistics_div *div, *accum_div, *delta_div, *max_div;
 
-       if (!iwl_is_alive(priv->shrd))
+       if (!iwl_is_alive(priv))
                return -EAGAIN;
 
        buf = kzalloc(bufsz, GFP_KERNEL);
        ssize_t ret;
        struct statistics_bt_activity *bt, *accum_bt;
 
-       if (!iwl_is_alive(priv->shrd))
+       if (!iwl_is_alive(priv))
                return -EAGAIN;
 
        if (!priv->bt_enable_flag)
                (sizeof(struct reply_agg_tx_error_statistics) * 24) + 200;
        ssize_t ret;
 
-       if (!iwl_is_alive(priv->shrd))
+       if (!iwl_is_alive(priv))
                return -EAGAIN;
 
        buf = kzalloc(bufsz, GFP_KERNEL);
 
        if (trace) {
                priv->event_log.ucode_trace = true;
-               if (iwl_is_alive(priv->shrd)) {
+               if (iwl_is_alive(priv)) {
                        /* start collecting data now */
                        mod_timer(&priv->ucode_trace, jiffies);
                }
        if (sscanf(buf, "%d", &flush) != 1)
                return -EINVAL;
 
-       if (iwl_is_rfkill(priv->shrd))
+       if (iwl_is_rfkill(priv))
                return -EFAULT;
 
        iwlagn_dev_txfifo_flush(priv, IWL_DROP_ALL);
 
        };
        int ret;
 
-       if (!test_bit(STATUS_READY, &priv->shrd->status))
+       if (!test_bit(STATUS_READY, &priv->status))
                return -EBUSY;
 
        if (priv->blink_on == on && priv->blink_off == off)
 
 
        lockdep_assert_held(&priv->mutex);
 
-       if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status)) {
+       if (test_bit(STATUS_EXIT_PENDING, &priv->status)) {
                IWL_WARN(priv, "Exit pending; will not bring the NIC up\n");
                return -EIO;
        }
        return 0;
 
  error:
-       set_bit(STATUS_EXIT_PENDING, &priv->shrd->status);
+       set_bit(STATUS_EXIT_PENDING, &priv->status);
        iwl_down(priv);
-       clear_bit(STATUS_EXIT_PENDING, &priv->shrd->status);
+       clear_bit(STATUS_EXIT_PENDING, &priv->status);
 
        IWL_ERR(priv, "Unable to initialize device.\n");
        return ret;
        IWL_DEBUG_INFO(priv, "Start UP work done.\n");
 
        /* Now we should be done, and the READY bit should be set. */
-       if (WARN_ON(!test_bit(STATUS_READY, &priv->shrd->status)))
+       if (WARN_ON(!test_bit(STATUS_READY, &priv->status)))
                ret = -EIO;
 
        iwlagn_led_enable(priv);
         * mac80211 might WARN if we fail, but due the way we
         * (badly) handle hard rfkill, we might fail here
         */
-       if (iwl_is_rfkill(priv->shrd))
+       if (iwl_is_rfkill(priv))
                ret = 0;
 
        mutex_unlock(&priv->mutex);
 
        mutex_lock(&priv->mutex);
 
-       if (iwl_is_rfkill(priv->shrd))
+       if (iwl_is_rfkill(priv))
                goto out;
 
-       if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status) ||
-           test_bit(STATUS_SCANNING, &priv->shrd->status) ||
-           test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->shrd->status))
+       if (test_bit(STATUS_EXIT_PENDING, &priv->status) ||
+           test_bit(STATUS_SCANNING, &priv->status) ||
+           test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status))
                goto out;
 
        if (!iwl_is_associated_ctx(ctx))
         * at this point, staging_rxon has the
         * configuration for channel switch
         */
-       set_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->shrd->status);
+       set_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status);
        priv->switch_channel = cpu_to_le16(ch);
        if (cfg(priv)->lib->set_channel_switch(priv, ch_switch)) {
-               clear_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->shrd->status);
+               clear_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status);
                priv->switch_channel = 0;
                ieee80211_chswitch_done(ctx->vif, false);
        }
        mutex_lock(&priv->mutex);
        IWL_DEBUG_MAC80211(priv, "enter\n");
 
-       if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status)) {
+       if (test_bit(STATUS_EXIT_PENDING, &priv->status)) {
                IWL_DEBUG_TX(priv, "Aborting flush due to device shutdown\n");
                goto done;
        }
-       if (iwl_is_rfkill(priv->shrd)) {
+       if (iwl_is_rfkill(priv)) {
                IWL_DEBUG_TX(priv, "Aborting flush due to RF Kill\n");
                goto done;
        }
        IWL_DEBUG_MAC80211(priv, "enter\n");
        mutex_lock(&priv->mutex);
 
-       if (test_bit(STATUS_SCAN_HW, &priv->shrd->status)) {
+       if (test_bit(STATUS_SCAN_HW, &priv->status)) {
                err = -EBUSY;
                goto out;
        }
 
        IWL_DEBUG_MAC80211(priv, "enter\n");
 
-       if (!iwl_is_ready_rf(priv->shrd)) {
+       if (!iwl_is_ready_rf(priv)) {
                IWL_DEBUG_MAC80211(priv, "leave - RF not ready\n");
                return -EIO;
        }
 
        iwlagn_disable_roc(priv);
 
-       if (!iwl_is_ready_rf(priv->shrd)) {
+       if (!iwl_is_ready_rf(priv)) {
                IWL_WARN(priv, "Try to add interface when device not ready\n");
                err = -EINVAL;
                goto out;
 
        mutex_lock(&priv->mutex);
 
-       if (!ctx->vif || !iwl_is_ready_rf(priv->shrd)) {
+       if (!ctx->vif || !iwl_is_ready_rf(priv)) {
                /*
                 * Huh? But wait ... this can maybe happen when
                 * we're in the middle of a firmware restart!
 
        if (!memcmp(&priv->power_data.sleep_cmd, cmd, sizeof(*cmd)) && !force)
                return 0;
 
-       if (!iwl_is_ready_rf(priv->shrd))
+       if (!iwl_is_ready_rf(priv))
                return -EIO;
 
        /* scan complete use sleep_power_next, need to be updated */
        memcpy(&priv->power_data.sleep_cmd_next, cmd, sizeof(*cmd));
-       if (test_bit(STATUS_SCANNING, &priv->shrd->status) && !force) {
+       if (test_bit(STATUS_SCANNING, &priv->status) && !force) {
                IWL_DEBUG_INFO(priv, "Defer power set mode while scanning\n");
                return 0;
        }
 
        /* Exit instantly with error when device is not ready
         * to receive scan abort command or it does not perform
         * hardware scan currently */
-       if (!test_bit(STATUS_READY, &priv->shrd->status) ||
-           !test_bit(STATUS_GEO_CONFIGURED, &priv->shrd->status) ||
-           !test_bit(STATUS_SCAN_HW, &priv->shrd->status) ||
+       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))
                return -EIO;
 
 
        lockdep_assert_held(&priv->mutex);
 
-       if (!test_and_clear_bit(STATUS_SCAN_COMPLETE, &priv->shrd->status))
+       if (!test_and_clear_bit(STATUS_SCAN_COMPLETE, &priv->status))
                return;
 
        IWL_DEBUG_SCAN(priv, "Completed scan.\n");
 
        cancel_delayed_work(&priv->scan_check);
 
-       aborted = test_and_clear_bit(STATUS_SCAN_ABORTING, &priv->shrd->status);
+       aborted = test_and_clear_bit(STATUS_SCAN_ABORTING, &priv->status);
        if (aborted)
                IWL_DEBUG_SCAN(priv, "Aborted scan completed.\n");
 
-       if (!test_and_clear_bit(STATUS_SCANNING, &priv->shrd->status)) {
+       if (!test_and_clear_bit(STATUS_SCANNING, &priv->status)) {
                IWL_DEBUG_SCAN(priv, "Scan already completed.\n");
                goto out_settings;
        }
 
 out_settings:
        /* Can we still talk to firmware ? */
-       if (!iwl_is_ready_rf(priv->shrd))
+       if (!iwl_is_ready_rf(priv))
                return;
 
        iwlagn_post_scan(priv);
 {
        lockdep_assert_held(&priv->mutex);
 
-       if (!test_bit(STATUS_SCANNING, &priv->shrd->status)) {
+       if (!test_bit(STATUS_SCANNING, &priv->status)) {
                IWL_DEBUG_SCAN(priv, "Forcing scan end while not scanning\n");
                return;
        }
 
        IWL_DEBUG_SCAN(priv, "Forcing scan end\n");
-       clear_bit(STATUS_SCANNING, &priv->shrd->status);
-       clear_bit(STATUS_SCAN_HW, &priv->shrd->status);
-       clear_bit(STATUS_SCAN_ABORTING, &priv->shrd->status);
-       clear_bit(STATUS_SCAN_COMPLETE, &priv->shrd->status);
+       clear_bit(STATUS_SCANNING, &priv->status);
+       clear_bit(STATUS_SCAN_HW, &priv->status);
+       clear_bit(STATUS_SCAN_ABORTING, &priv->status);
+       clear_bit(STATUS_SCAN_COMPLETE, &priv->status);
        iwl_complete_scan(priv, true);
 }
 
 
        lockdep_assert_held(&priv->mutex);
 
-       if (!test_bit(STATUS_SCANNING, &priv->shrd->status)) {
+       if (!test_bit(STATUS_SCANNING, &priv->status)) {
                IWL_DEBUG_SCAN(priv, "Not performing scan to abort\n");
                return;
        }
 
-       if (test_and_set_bit(STATUS_SCAN_ABORTING, &priv->shrd->status)) {
+       if (test_and_set_bit(STATUS_SCAN_ABORTING, &priv->status)) {
                IWL_DEBUG_SCAN(priv, "Scan abort in progress\n");
                return;
        }
        iwl_do_scan_abort(priv);
 
        while (time_before_eq(jiffies, timeout)) {
-               if (!test_bit(STATUS_SCAN_HW, &priv->shrd->status))
+               if (!test_bit(STATUS_SCAN_HW, &priv->status))
                        goto finished;
                msleep(20);
        }
         * to clear, we need to set SCAN_COMPLETE before clearing SCAN_HW
         * to avoid a race there.
         */
-       set_bit(STATUS_SCAN_COMPLETE, &priv->shrd->status);
-       clear_bit(STATUS_SCAN_HW, &priv->shrd->status);
+       set_bit(STATUS_SCAN_COMPLETE, &priv->status);
+       clear_bit(STATUS_SCAN_HW, &priv->status);
        queue_work(priv->workqueue, &priv->scan_completed);
 
        if (priv->iw_mode != NL80211_IFTYPE_ADHOC &&
        scan->len = cpu_to_le16(cmd.len[0]);
 
        /* set scan bit here for PAN params */
-       set_bit(STATUS_SCAN_HW, &priv->shrd->status);
+       set_bit(STATUS_SCAN_HW, &priv->status);
 
        ret = iwlagn_set_pan_params(priv);
        if (ret)
 
        ret = iwl_dvm_send_cmd(priv, &cmd);
        if (ret) {
-               clear_bit(STATUS_SCAN_HW, &priv->shrd->status);
+               clear_bit(STATUS_SCAN_HW, &priv->status);
                iwlagn_set_pan_params(priv);
        }
 
 
        cancel_delayed_work(&priv->scan_check);
 
-       if (!iwl_is_ready_rf(priv->shrd)) {
+       if (!iwl_is_ready_rf(priv)) {
                IWL_WARN(priv, "Request scan called when driver not ready.\n");
                return -EIO;
        }
 
-       if (test_bit(STATUS_SCAN_HW, &priv->shrd->status)) {
+       if (test_bit(STATUS_SCAN_HW, &priv->status)) {
                IWL_DEBUG_SCAN(priv,
                        "Multiple concurrent scan requests in parallel.\n");
                return -EBUSY;
        }
 
-       if (test_bit(STATUS_SCAN_ABORTING, &priv->shrd->status)) {
+       if (test_bit(STATUS_SCAN_ABORTING, &priv->status)) {
                IWL_DEBUG_SCAN(priv, "Scan request while abort pending.\n");
                return -EBUSY;
        }
                        scan_type == IWL_SCAN_ROC ? "remain-on-channel " :
                        "internal short ");
 
-       set_bit(STATUS_SCANNING, &priv->shrd->status);
+       set_bit(STATUS_SCANNING, &priv->status);
        priv->scan_type = scan_type;
        priv->scan_start = jiffies;
        priv->scan_band = band;
 
        ret = iwlagn_request_scan(priv, vif);
        if (ret) {
-               clear_bit(STATUS_SCANNING, &priv->shrd->status);
+               clear_bit(STATUS_SCANNING, &priv->status);
                priv->scan_type = IWL_SCAN_NORMAL;
                return ret;
        }
                goto unlock;
        }
 
-       if (test_bit(STATUS_SCANNING, &priv->shrd->status)) {
+       if (test_bit(STATUS_SCANNING, &priv->status)) {
                IWL_DEBUG_SCAN(priv, "Scan already in progress.\n");
                goto unlock;
        }
 
 ******************************************************/
 static inline void iwl_disable_interrupts(struct iwl_trans *trans)
 {
-       clear_bit(STATUS_INT_ENABLED, &trans->shrd->status);
+       struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
+       clear_bit(STATUS_INT_ENABLED, &trans_pcie->status);
 
        /* disable interrupts from uCode/NIC to host */
        iwl_write32(trans, CSR_INT_MASK, 0x00000000);
 
 static inline void iwl_enable_interrupts(struct iwl_trans *trans)
 {
-       struct iwl_trans_pcie *trans_pcie =
-               IWL_TRANS_GET_PCIE_TRANS(trans);
+       struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
 
        IWL_DEBUG_ISR(trans, "Enabling interrupts\n");
-       set_bit(STATUS_INT_ENABLED, &trans->shrd->status);
+       set_bit(STATUS_INT_ENABLED, &trans_pcie->status);
        iwl_write32(trans, CSR_INT_MASK, trans_pcie->inta_mask);
 }
 
 
 
        /* Re-enable all interrupts */
        /* only Re-enable if disabled by irq */
-       if (test_bit(STATUS_INT_ENABLED, &trans->shrd->status))
+       if (test_bit(STATUS_INT_ENABLED, &trans_pcie->status))
                iwl_enable_interrupts(trans);
        /* Re-enable RF_KILL if it occurred */
        else if (handled & CSR_INT_BIT_RF_KILL)
        /* iwl_irq_tasklet() will service interrupts and re-enable them */
        if (likely(inta))
                tasklet_schedule(&trans_pcie->irq_tasklet);
-       else if (test_bit(STATUS_INT_ENABLED, &trans->shrd->status) &&
+       else if (test_bit(STATUS_INT_ENABLED, &trans_pcie->status) &&
                        !trans_pcie->inta)
                iwl_enable_interrupts(trans);
 
  none:
        /* re-enable interrupts here since we don't have anything to service. */
        /* only Re-enable if disabled by irq  and no schedules tasklet. */
-       if (test_bit(STATUS_INT_ENABLED, &trans->shrd->status) &&
+       if (test_bit(STATUS_INT_ENABLED, &trans_pcie->status) &&
                !trans_pcie->inta)
                iwl_enable_interrupts(trans);
 
        /* iwl_irq_tasklet() will service interrupts and re-enable them */
        if (likely(inta))
                tasklet_schedule(&trans_pcie->irq_tasklet);
-       else if (test_bit(STATUS_INT_ENABLED, &trans->shrd->status) &&
+       else if (test_bit(STATUS_INT_ENABLED, &trans_pcie->status) &&
                 !trans_pcie->inta) {
                /* Allow interrupt if was disabled by this handler and
                 * no tasklet was schedules, We should not enable interrupt,
        /* re-enable interrupts here since we don't have anything to service.
         * only Re-enable if disabled by irq.
         */
-       if (test_bit(STATUS_INT_ENABLED, &trans->shrd->status) &&
+       if (test_bit(STATUS_INT_ENABLED, &trans_pcie->status) &&
            !trans_pcie->inta)
                iwl_enable_interrupts(trans);
 
 
  */
 static int iwl_apm_init(struct iwl_trans *trans)
 {
+       struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
        int ret = 0;
        IWL_DEBUG_INFO(trans, "Init card's basic functions\n");
 
        iwl_set_bits_prph(trans, APMG_PCIDEV_STT_REG,
                          APMG_PCIDEV_STT_VAL_L1_ACT_DIS);
 
-       set_bit(STATUS_DEVICE_ENABLED, &trans->shrd->status);
+       set_bit(STATUS_DEVICE_ENABLED, &trans_pcie->status);
 
 out:
        return ret;
 
 static void iwl_apm_stop(struct iwl_trans *trans)
 {
+       struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
        IWL_DEBUG_INFO(trans, "Stop card, put in low power state\n");
 
-       clear_bit(STATUS_DEVICE_ENABLED, &trans->shrd->status);
+       clear_bit(STATUS_DEVICE_ENABLED, &trans_pcie->status);
 
        /* Stop device's DMA activity */
        iwl_apm_stop_master(trans);
         * restart. So don't process again if the device is
         * already dead.
         */
-       if (test_bit(STATUS_DEVICE_ENABLED, &trans->shrd->status)) {
+       if (test_bit(STATUS_DEVICE_ENABLED, &trans_pcie->status)) {
                iwl_trans_tx_stop(trans);
 #ifndef CONFIG_IWLWIFI_IDI
                iwl_trans_rx_stop(trans);