if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
                return -EINVAL;
 
-       if (!iwl_is_alive(priv))
+       if (!iwl_is_alive(priv->shrd))
                return -EBUSY;
 
        /* This function hardcodes a bunch of dual-mode assumptions */
                goto out;
        }
 
-       if (!iwl_is_ready(priv)) {
+       if (!iwl_is_ready(priv->shrd)) {
                IWL_DEBUG_MAC80211(priv, "leave - not ready\n");
                goto out;
        }
 
        mutex_lock(&priv->shrd->mutex);
 
-       if (unlikely(!iwl_is_ready(priv))) {
+       if (unlikely(!iwl_is_ready(priv->shrd))) {
                IWL_DEBUG_MAC80211(priv, "leave - not ready\n");
                mutex_unlock(&priv->shrd->mutex);
                return;
 
                      keyconf->keyidx);
 
        memset(&ctx->wep_keys[keyconf->keyidx], 0, sizeof(ctx->wep_keys[0]));
-       if (iwl_is_rfkill(priv)) {
+       if (iwl_is_rfkill(priv->shrd)) {
                IWL_DEBUG_WEP(priv, "Not sending REPLY_WEPKEY command due to RFKILL.\n");
                /* but keys in device are clear anyway so return success */
                return 0;
 
        if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
                return;
 
-       if (!iwl_is_ready(priv))
+       if (!iwl_is_ready(priv->shrd))
                return;
 
        if (tt->state != IWL_TI_CT_KILL) {
        if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
                return;
 
-       if (!iwl_is_ready(priv))
+       if (!iwl_is_ready(priv->shrd))
                return;
 
        /* stop ct_kill_exit_tm timer */
 
                ctx = iwl_rxon_ctx_from_vif(info->control.vif);
 
        spin_lock_irqsave(&priv->shrd->lock, flags);
-       if (iwl_is_rfkill(priv)) {
+       if (iwl_is_rfkill(priv->shrd)) {
                IWL_DEBUG_DROP(priv, "Dropping - RF KILL\n");
                goto drop_unlock_priv;
        }
 
                return;
 
        /* dont send host command if rf-kill is on */
-       if (!iwl_is_ready_rf(priv))
+       if (!iwl_is_ready_rf(priv->shrd))
                return;
        iwlagn_send_advance_bt_config(priv);
 }
                goto out;
 
        /* dont send host command if rf-kill is on */
-       if (!iwl_is_ready_rf(priv))
+       if (!iwl_is_ready_rf(priv->shrd))
                goto out;
 
        IWL_DEBUG_INFO(priv, "BT coex in %s mode\n",
                return;
 
        /* dont send host command if rf-kill is on */
-       if (!iwl_is_ready_rf(priv))
+       if (!iwl_is_ready_rf(priv->shrd))
                return;
 
        iwl_send_statistics_request(priv, CMD_ASYNC, false);
                return;
 
        /* do nothing if rf-kill is on */
-       if (!iwl_is_ready_rf(priv))
+       if (!iwl_is_ready_rf(priv->shrd))
                return;
 
        IWL_DEBUG_INFO(priv, "device request: flush all tx frames\n");
        struct iwl_shared *shrd = dev_get_drvdata(d);
        struct iwl_priv *priv = shrd->priv;
 
-       if (!iwl_is_alive(priv))
+       if (!iwl_is_alive(priv->shrd))
                return -EAGAIN;
 
        return sprintf(buf, "%d\n", priv->temperature);
 {
        struct iwl_priv *priv = dev_get_drvdata(d);
 
-       if (!iwl_is_ready_rf(priv))
+       if (!iwl_is_ready_rf(priv->shrd))
                return sprintf(buf, "off\n");
        else
                return sprintf(buf, "%d\n", priv->tx_power_user_lmt);
        /* Enable watchdog to monitor the driver tx queues */
        iwl_setup_watchdog(priv);
 
-       if (iwl_is_rfkill(priv))
+       if (iwl_is_rfkill(priv->shrd))
                return -ERFKILL;
 
        /* download priority table before any calibration request */
 
        mutex_lock(&priv->shrd->mutex);
 
-       if (iwl_is_rfkill(priv))
+       if (iwl_is_rfkill(priv->shrd))
                goto out;
 
        if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status) ||
                IWL_DEBUG_TX(priv, "Aborting flush due to device shutdown\n");
                goto done;
        }
-       if (iwl_is_rfkill(priv)) {
+       if (iwl_is_rfkill(priv->shrd)) {
                IWL_DEBUG_TX(priv, "Aborting flush due to RF Kill\n");
                goto done;
        }
 
                return -EINVAL;
        }
 
-       if (!iwl_is_ready_rf(priv))
+       if (!iwl_is_ready_rf(priv->shrd))
                return -EIO;
 
        /* scan complete and commit_rxon use tx_power_next value,
 
        IWL_DEBUG_MAC80211(priv, "enter\n");
 
-       if (!iwl_is_ready_rf(priv)) {
+       if (!iwl_is_ready_rf(priv->shrd)) {
                IWL_DEBUG_MAC80211(priv, "leave - RF not ready\n");
                return -EIO;
        }
 
        iwlagn_disable_roc(priv);
 
-       if (!iwl_is_ready_rf(priv)) {
+       if (!iwl_is_ready_rf(priv->shrd)) {
                IWL_WARN(priv, "Try to add interface when device not ready\n");
                err = -EINVAL;
                goto out;
 
        mutex_lock(&priv->shrd->mutex);
 
-       if (!ctx->vif || !iwl_is_ready_rf(priv)) {
+       if (!ctx->vif || !iwl_is_ready_rf(priv->shrd)) {
                /*
                 * Huh? But wait ... this can maybe happen when
                 * we're in the middle of a firmware restart!
 
 int iwl_init_geos(struct iwl_priv *priv);
 void iwl_free_geos(struct iwl_priv *priv);
 
-/*************** DRIVER STATUS FUNCTIONS   *****/
-
-#define STATUS_HCMD_ACTIVE     0       /* host command in progress */
-/* 1 is unused (used to be STATUS_HCMD_SYNC_ACTIVE) */
-#define STATUS_INT_ENABLED     2
-#define STATUS_RF_KILL_HW      3
-#define STATUS_CT_KILL         4
-#define STATUS_INIT            5
-#define STATUS_ALIVE           6
-#define STATUS_READY           7
-#define STATUS_TEMPERATURE     8
-#define STATUS_GEO_CONFIGURED  9
-#define STATUS_EXIT_PENDING    10
-#define STATUS_STATISTICS      12
-#define STATUS_SCANNING                13
-#define STATUS_SCAN_ABORTING   14
-#define STATUS_SCAN_HW         15
-#define STATUS_POWER_PMI       16
-#define STATUS_FW_ERROR                17
-#define STATUS_DEVICE_ENABLED  18
-#define STATUS_CHANNEL_SWITCH_PENDING 19
-
-
-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, &priv->shrd->status) &&
-              test_bit(STATUS_GEO_CONFIGURED, &priv->shrd->status) &&
-              !test_bit(STATUS_EXIT_PENDING, &priv->shrd->status);
-}
-
-static inline int iwl_is_alive(struct iwl_priv *priv)
-{
-       return test_bit(STATUS_ALIVE, &priv->shrd->status);
-}
-
-static inline int iwl_is_init(struct iwl_priv *priv)
-{
-       return test_bit(STATUS_INIT, &priv->shrd->status);
-}
-
-static inline int iwl_is_rfkill_hw(struct iwl_priv *priv)
-{
-       return test_bit(STATUS_RF_KILL_HW, &priv->shrd->status);
-}
-
-static inline int iwl_is_rfkill(struct iwl_priv *priv)
-{
-       return iwl_is_rfkill_hw(priv);
-}
-
-static inline int iwl_is_ctkill(struct iwl_priv *priv)
-{
-       return test_bit(STATUS_CT_KILL, &priv->shrd->status);
-}
-
-static inline int iwl_is_ready_rf(struct iwl_priv *priv)
-{
-
-       if (iwl_is_rfkill(priv))
-               return 0;
-
-       return iwl_is_ready(priv);
-}
-
 extern void iwl_send_bt_config(struct iwl_priv *priv);
 extern int iwl_send_statistics_request(struct iwl_priv *priv,
                                       u8 flags, bool clear);
 
        if (value != -1 && (value < 0 || value >= IWL_POWER_NUM))
                return -EINVAL;
 
-       if (!iwl_is_ready_rf(priv))
+       if (!iwl_is_ready_rf(priv->shrd))
                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))
+       if (!iwl_is_alive(priv->shrd))
                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))
+       if (!iwl_is_alive(priv->shrd))
                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))
+       if (!iwl_is_alive(priv->shrd))
                return -EAGAIN;
 
        buf = kzalloc(bufsz, GFP_KERNEL);
        ssize_t ret;
        struct statistics_bt_activity *bt, *accum_bt;
 
-       if (!iwl_is_alive(priv))
+       if (!iwl_is_alive(priv->shrd))
                return -EAGAIN;
 
        if (!priv->bt_enable_flag)
                (sizeof(struct reply_agg_tx_error_statistics) * 24) + 200;
        ssize_t ret;
 
-       if (!iwl_is_alive(priv))
+       if (!iwl_is_alive(priv->shrd))
                return -EAGAIN;
 
        buf = kzalloc(bufsz, GFP_KERNEL);
        if (sscanf(buf, "%d", &flush) != 1)
                return -EINVAL;
 
-       if (iwl_is_rfkill(priv))
+       if (iwl_is_rfkill(priv->shrd))
                return -EFAULT;
 
        iwlagn_dev_txfifo_flush(priv, IWL_DROP_ALL);
 
        if (!memcmp(&priv->power_data.sleep_cmd, cmd, sizeof(*cmd)) && !force)
                return 0;
 
-       if (!iwl_is_ready_rf(priv))
+       if (!iwl_is_ready_rf(priv->shrd))
                return -EIO;
 
        /* scan complete use sleep_power_next, need to be updated */
 
 
        cancel_delayed_work(&priv->scan_check);
 
-       if (!iwl_is_ready_rf(priv)) {
+       if (!iwl_is_ready_rf(priv->shrd)) {
                IWL_WARN(priv, "Request scan called when driver not ready.\n");
                return -EIO;
        }
 
 out_settings:
        /* Can we still talk to firmware ? */
-       if (!iwl_is_ready_rf(priv))
+       if (!iwl_is_ready_rf(priv->shrd))
                goto out;
 
        iwlagn_post_scan(priv);
 
                struct iwl_cfg *cfg);
 void __devexit iwl_remove(struct iwl_priv * priv);
 
+/*****************************************************
+* DRIVER STATUS FUNCTIONS
+******************************************************/
+#define STATUS_HCMD_ACTIVE     0       /* host command in progress */
+/* 1 is unused (used to be STATUS_HCMD_SYNC_ACTIVE) */
+#define STATUS_INT_ENABLED     2
+#define STATUS_RF_KILL_HW      3
+#define STATUS_CT_KILL         4
+#define STATUS_INIT            5
+#define STATUS_ALIVE           6
+#define STATUS_READY           7
+#define STATUS_TEMPERATURE     8
+#define STATUS_GEO_CONFIGURED  9
+#define STATUS_EXIT_PENDING    10
+#define STATUS_STATISTICS      12
+#define STATUS_SCANNING                13
+#define STATUS_SCAN_ABORTING   14
+#define STATUS_SCAN_HW         15
+#define STATUS_POWER_PMI       16
+#define STATUS_FW_ERROR                17
+#define STATUS_DEVICE_ENABLED  18
+#define STATUS_CHANNEL_SWITCH_PENDING 19
+
+static inline int iwl_is_ready(struct iwl_shared *shrd)
+{
+       /* 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);
+}
+
+static inline int iwl_is_alive(struct iwl_shared *shrd)
+{
+       return test_bit(STATUS_ALIVE, &shrd->status);
+}
+
+static inline int iwl_is_init(struct iwl_shared *shrd)
+{
+       return test_bit(STATUS_INIT, &shrd->status);
+}
+
+static inline int iwl_is_rfkill_hw(struct iwl_shared *shrd)
+{
+       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);
+}
+
+static inline int iwl_is_ctkill(struct iwl_shared *shrd)
+{
+       return test_bit(STATUS_CT_KILL, &shrd->status);
+}
+
+static inline int iwl_is_ready_rf(struct iwl_shared *shrd)
+{
+       if (iwl_is_rfkill(shrd))
+               return 0;
+
+       return iwl_is_ready(shrd);
+}
+
 #endif /* #__iwl_shared_h__ */
 
 {
        unsigned long flags;
 
-       if (!iwl_is_ready(priv)) {
+       if (!iwl_is_ready(priv->shrd)) {
                IWL_DEBUG_INFO(priv,
                        "Unable to remove station %pM, device not ready.\n",
                        addr);
        int ret;
        bool send_lq;
 
-       if (!iwl_is_ready(priv)) {
+       if (!iwl_is_ready(priv->shrd)) {
                IWL_DEBUG_INFO(priv, "Not ready yet, not restoring any stations.\n");
                return;
        }
 
        if (WARN_ON(copy_size > TFD_MAX_PAYLOAD_SIZE))
                return -EINVAL;
 
-       if (iwl_is_rfkill(priv) || iwl_is_ctkill(priv)) {
+       if (iwl_is_rfkill(priv->shrd) || iwl_is_ctkill(priv->shrd)) {
                IWL_WARN(priv, "Not sending command - %s KILL\n",
-                        iwl_is_rfkill(priv) ? "RF" : "CT");
+                        iwl_is_rfkill(priv->shrd) ? "RF" : "CT");
                return -EIO;
        }
 
 
        else
                set_bit(STATUS_RF_KILL_HW, &priv->shrd->status);
 
-       if (iwl_is_rfkill(priv)) {
+       if (iwl_is_rfkill(priv->shrd)) {
                wiphy_rfkill_set_hw_state(priv->hw->wiphy, true);
                iwl_enable_interrupts(trans(priv));
                return -ERFKILL;