}
 
-/*************** DRIVER STATUS FUNCTIONS   *****/
-
-static inline int iwl3945_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->status) &&
-              test_bit(STATUS_GEO_CONFIGURED, &priv->status) &&
-              !test_bit(STATUS_EXIT_PENDING, &priv->status);
-}
-
-static inline int iwl3945_is_alive(struct iwl_priv *priv)
-{
-       return test_bit(STATUS_ALIVE, &priv->status);
-}
-
-static inline int iwl3945_is_init(struct iwl_priv *priv)
-{
-       return test_bit(STATUS_INIT, &priv->status);
-}
-
-static inline int iwl3945_is_rfkill_sw(struct iwl_priv *priv)
-{
-       return test_bit(STATUS_RF_KILL_SW, &priv->status);
-}
-
-static inline int iwl3945_is_rfkill_hw(struct iwl_priv *priv)
-{
-       return test_bit(STATUS_RF_KILL_HW, &priv->status);
-}
-
-static inline int iwl3945_is_rfkill(struct iwl_priv *priv)
-{
-       return iwl3945_is_rfkill_hw(priv) ||
-               iwl3945_is_rfkill_sw(priv);
-}
-
-static inline int iwl3945_is_ready_rf(struct iwl_priv *priv)
-{
-
-       if (iwl3945_is_rfkill(priv))
-               return 0;
-
-       return iwl3945_is_ready(priv);
-}
 
 /*************** HOST COMMAND QUEUE FUNCTIONS   *****/
 
               !(cmd->meta.flags & CMD_SIZE_HUGE));
 
 
-       if (iwl3945_is_rfkill(priv)) {
+       if (iwl_is_rfkill(priv)) {
                IWL_DEBUG_INFO("Not sending command - RF KILL");
                return -EIO;
        }
        struct iwl3945_rxon_cmd *active_rxon = (void *)&priv->active39_rxon;
        int rc = 0;
 
-       if (!iwl3945_is_alive(priv))
+       if (!iwl_is_alive(priv))
                return -1;
 
        /* always get timestamp with Rx frame */
                                sizeof(struct iwl_qosparam_cmd), qos);
 }
 
-static void iwl3945_reset_qos(struct iwl_priv *priv)
-{
-       u16 cw_min = 15;
-       u16 cw_max = 1023;
-       u8 aifs = 2;
-       u8 is_legacy = 0;
-       unsigned long flags;
-       int i;
-
-       spin_lock_irqsave(&priv->lock, flags);
-       priv->qos_data.qos_active = 0;
-
-       /* QoS always active in AP and ADHOC mode
-        * In STA mode wait for association
-        */
-       if (priv->iw_mode == NL80211_IFTYPE_ADHOC ||
-           priv->iw_mode == NL80211_IFTYPE_AP)
-               priv->qos_data.qos_active = 1;
-       else
-               priv->qos_data.qos_active = 0;
-
-
-       /* check for legacy mode */
-       if ((priv->iw_mode == NL80211_IFTYPE_ADHOC &&
-            (priv->active_rate & IWL_OFDM_RATES_MASK) == 0) ||
-           (priv->iw_mode == NL80211_IFTYPE_STATION &&
-            (priv->staging39_rxon.flags & RXON_FLG_SHORT_SLOT_MSK) == 0)) {
-               cw_min = 31;
-               is_legacy = 1;
-       }
-
-       if (priv->qos_data.qos_active)
-               aifs = 3;
-
-       priv->qos_data.def_qos_parm.ac[0].cw_min = cpu_to_le16(cw_min);
-       priv->qos_data.def_qos_parm.ac[0].cw_max = cpu_to_le16(cw_max);
-       priv->qos_data.def_qos_parm.ac[0].aifsn = aifs;
-       priv->qos_data.def_qos_parm.ac[0].edca_txop = 0;
-       priv->qos_data.def_qos_parm.ac[0].reserved1 = 0;
-
-       if (priv->qos_data.qos_active) {
-               i = 1;
-               priv->qos_data.def_qos_parm.ac[i].cw_min = cpu_to_le16(cw_min);
-               priv->qos_data.def_qos_parm.ac[i].cw_max = cpu_to_le16(cw_max);
-               priv->qos_data.def_qos_parm.ac[i].aifsn = 7;
-               priv->qos_data.def_qos_parm.ac[i].edca_txop = 0;
-               priv->qos_data.def_qos_parm.ac[i].reserved1 = 0;
-
-               i = 2;
-               priv->qos_data.def_qos_parm.ac[i].cw_min =
-                       cpu_to_le16((cw_min + 1) / 2 - 1);
-               priv->qos_data.def_qos_parm.ac[i].cw_max =
-                       cpu_to_le16(cw_max);
-               priv->qos_data.def_qos_parm.ac[i].aifsn = 2;
-               if (is_legacy)
-                       priv->qos_data.def_qos_parm.ac[i].edca_txop =
-                               cpu_to_le16(6016);
-               else
-                       priv->qos_data.def_qos_parm.ac[i].edca_txop =
-                               cpu_to_le16(3008);
-               priv->qos_data.def_qos_parm.ac[i].reserved1 = 0;
-
-               i = 3;
-               priv->qos_data.def_qos_parm.ac[i].cw_min =
-                       cpu_to_le16((cw_min + 1) / 4 - 1);
-               priv->qos_data.def_qos_parm.ac[i].cw_max =
-                       cpu_to_le16((cw_max + 1) / 2 - 1);
-               priv->qos_data.def_qos_parm.ac[i].aifsn = 2;
-               priv->qos_data.def_qos_parm.ac[i].reserved1 = 0;
-               if (is_legacy)
-                       priv->qos_data.def_qos_parm.ac[i].edca_txop =
-                               cpu_to_le16(3264);
-               else
-                       priv->qos_data.def_qos_parm.ac[i].edca_txop =
-                               cpu_to_le16(1504);
-       } else {
-               for (i = 1; i < 4; i++) {
-                       priv->qos_data.def_qos_parm.ac[i].cw_min =
-                               cpu_to_le16(cw_min);
-                       priv->qos_data.def_qos_parm.ac[i].cw_max =
-                               cpu_to_le16(cw_max);
-                       priv->qos_data.def_qos_parm.ac[i].aifsn = aifs;
-                       priv->qos_data.def_qos_parm.ac[i].edca_txop = 0;
-                       priv->qos_data.def_qos_parm.ac[i].reserved1 = 0;
-               }
-       }
-       IWL_DEBUG_QOS("set QoS to default \n");
-
-       spin_unlock_irqrestore(&priv->lock, flags);
-}
-
 static void iwl3945_activate_qos(struct iwl_priv *priv, u8 force)
 {
        unsigned long flags;
 
 static int iwl3945_scan_initiate(struct iwl_priv *priv)
 {
-       if (!iwl3945_is_ready_rf(priv)) {
+       if (!iwl_is_ready_rf(priv)) {
                IWL_DEBUG_SCAN("Aborting scan due to not ready.\n");
                return -EIO;
        }
        iwl3945_clear_stations_table(priv);
 
        /* don't commit rxon if rf-kill is on*/
-       if (!iwl3945_is_ready_rf(priv))
+       if (!iwl_is_ready_rf(priv))
                return -EAGAIN;
 
        cancel_delayed_work(&priv->scan_check);
        int rc;
 
        spin_lock_irqsave(&priv->lock, flags);
-       if (iwl3945_is_rfkill(priv)) {
+       if (iwl_is_rfkill(priv)) {
                IWL_DEBUG_DROP("Dropping - RF KILL\n");
                goto drop_unlock;
        }
        /* Clear out the uCode error bit if it is set */
        clear_bit(STATUS_FW_ERROR, &priv->status);
 
-       if (iwl3945_is_rfkill(priv))
+       if (iwl_is_rfkill(priv))
                return;
 
        ieee80211_wake_queues(priv->hw);
 
        /* If we have not previously called iwl3945_init() then
         * clear all bits but the RF Kill and SUSPEND bits and return */
-       if (!iwl3945_is_init(priv)) {
+       if (!iwl_is_init(priv)) {
                priv->status = test_bit(STATUS_RF_KILL_HW, &priv->status) <<
                                        STATUS_RF_KILL_HW |
                               test_bit(STATUS_RF_KILL_SW, &priv->status) <<
 
        mutex_lock(&priv->mutex);
 
-       if (!iwl3945_is_rfkill(priv)) {
+       if (!iwl_is_rfkill(priv)) {
                IWL_DEBUG(IWL_DL_INFO | IWL_DL_RF_KILL,
                          "HW and/or SW RF Kill no longer active, restarting "
                          "device\n");
 
        mutex_lock(&priv->mutex);
 
-       if (!iwl3945_is_ready(priv)) {
+       if (!iwl_is_ready(priv)) {
                IWL_WARN(priv, "request scan called when driver not ready.\n");
                goto done;
        }
                goto done;
        }
 
-       if (iwl3945_is_rfkill(priv)) {
+       if (iwl_is_rfkill(priv)) {
                IWL_DEBUG_HC("Aborting scan due to RF Kill activation\n");
                goto done;
        }
 {
        struct iwl_priv *priv = container_of(work, struct iwl_priv, abort_scan);
 
-       if (!iwl3945_is_ready(priv))
+       if (!iwl_is_ready(priv))
                return;
 
        mutex_lock(&priv->mutex);
 
        priv->is_open = 0;
 
-       if (iwl3945_is_ready_rf(priv)) {
+       if (iwl_is_ready_rf(priv)) {
                /* stop mac, cancel any scan request and clear
                 * RXON_FILTER_ASSOC_MSK BIT
                 */
                memcpy(priv->mac_addr, conf->mac_addr, ETH_ALEN);
        }
 
-       if (iwl3945_is_ready(priv))
+       if (iwl_is_ready(priv))
                iwl3945_set_mode(priv, conf->type);
 
        mutex_unlock(&priv->mutex);
        mutex_lock(&priv->mutex);
        IWL_DEBUG_MAC80211("enter to channel %d\n", conf->channel->hw_value);
 
-       if (!iwl3945_is_ready(priv)) {
+       if (!iwl_is_ready(priv)) {
                IWL_DEBUG_MAC80211("leave - not ready\n");
                ret = -EIO;
                goto out;
                goto out;
        }
 
-       if (iwl3945_is_rfkill(priv)) {
+       if (iwl_is_rfkill(priv)) {
                IWL_DEBUG_MAC80211("leave - RF kill\n");
                ret = -EIO;
                goto out;
                        return rc;
        }
 
-       if (!iwl3945_is_alive(priv))
+       if (!iwl_is_alive(priv))
                return -EAGAIN;
 
        mutex_lock(&priv->mutex);
                priv->ibss_beacon = ieee80211_beacon_get(hw, vif);
        }
 
-       if (iwl3945_is_rfkill(priv))
+       if (iwl_is_rfkill(priv))
                goto done;
 
        if (conf->bssid && !is_zero_ether_addr(conf->bssid) &&
 
        mutex_lock(&priv->mutex);
 
-       if (iwl3945_is_ready_rf(priv)) {
+       if (iwl_is_ready_rf(priv)) {
                iwl3945_scan_cancel_timeout(priv, 100);
                priv->staging39_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
                iwl3945_commit_rxon(priv);
        mutex_lock(&priv->mutex);
        spin_lock_irqsave(&priv->lock, flags);
 
-       if (!iwl3945_is_ready_rf(priv)) {
+       if (!iwl_is_ready_rf(priv)) {
                rc = -EIO;
                IWL_DEBUG_MAC80211("leave - not ready or exit pending\n");
                goto out_unlock;
 
        IWL_DEBUG_MAC80211("enter\n");
 
-       if (!iwl3945_is_ready_rf(priv)) {
+       if (!iwl_is_ready_rf(priv)) {
                IWL_DEBUG_MAC80211("leave - RF not ready\n");
                return -EIO;
        }
 
        IWL_DEBUG_MAC80211("enter\n");
 
-       if (!iwl3945_is_ready_rf(priv)) {
+       if (!iwl_is_ready_rf(priv)) {
                IWL_DEBUG_MAC80211("leave - RF not ready\n");
                return -EIO;
        }
        mutex_lock(&priv->mutex);
        IWL_DEBUG_MAC80211("enter\n");
 
-       iwl3945_reset_qos(priv);
+       iwl_reset_qos(priv);
 
        spin_lock_irqsave(&priv->lock, flags);
        priv->assoc_id = 0;
 
        spin_unlock_irqrestore(&priv->lock, flags);
 
-       if (!iwl3945_is_ready_rf(priv)) {
+       if (!iwl_is_ready_rf(priv)) {
                IWL_DEBUG_MAC80211("leave - not ready\n");
                mutex_unlock(&priv->mutex);
                return;
 
        IWL_DEBUG_MAC80211("enter\n");
 
-       if (!iwl3945_is_ready_rf(priv)) {
+       if (!iwl_is_ready_rf(priv)) {
                IWL_DEBUG_MAC80211("leave - RF not ready\n");
                return -EIO;
        }
        IWL_DEBUG_MAC80211("leave\n");
        spin_unlock_irqrestore(&priv->lock, flags);
 
-       iwl3945_reset_qos(priv);
+       iwl_reset_qos(priv);
 
        iwl3945_post_associate(priv);
 
 {
        struct iwl_priv *priv = (struct iwl_priv *)d->driver_data;
 
-       if (!iwl3945_is_alive(priv))
+       if (!iwl_is_alive(priv))
                return -EAGAIN;
 
        return sprintf(buf, "%d\n", iwl3945_hw_get_temperature(priv));
        mode = simple_strtoul(buf, NULL, 0);
        mutex_lock(&priv->mutex);
 
-       if (!iwl3945_is_ready(priv)) {
+       if (!iwl_is_ready(priv)) {
                rc = -EAGAIN;
                goto out;
        }
        u8 *data = (u8 *)&priv->statistics_39;
        int rc = 0;
 
-       if (!iwl3945_is_alive(priv))
+       if (!iwl_is_alive(priv))
                return -EAGAIN;
 
        mutex_lock(&priv->mutex);
 {
        struct iwl_priv *priv = dev_get_drvdata(d);
 
-       if (!iwl3945_is_alive(priv))
+       if (!iwl_is_alive(priv))
                return -EAGAIN;
 
        return sprintf(buf, "%d\n", priv->antenna);
                           struct device_attribute *attr, char *buf)
 {
        struct iwl_priv *priv = (struct iwl_priv *)d->driver_data;
-       if (!iwl3945_is_alive(priv))
+       if (!iwl_is_alive(priv))
                return -EAGAIN;
        return sprintf(buf, "0x%08x\n", (int)priv->status);
 }
 
        priv->iw_mode = NL80211_IFTYPE_STATION;
 
-       iwl3945_reset_qos(priv);
+       iwl_reset_qos(priv);
 
        priv->qos_data.qos_active = 0;
        priv->qos_data.qos_cap.val = 0;
 
        switch (state) {
        case RFKILL_STATE_UNBLOCKED:
-               if (iwl3945_is_rfkill_hw(priv)) {
+               if (iwl_is_rfkill_hw(priv)) {
                        err = -EBUSY;
                        goto out_unlock;
                }
        if (!priv->rfkill)
                return;
 
-       if (iwl3945_is_rfkill_hw(priv)) {
+       if (iwl_is_rfkill_hw(priv)) {
                rfkill_force_state(priv->rfkill, RFKILL_STATE_HARD_BLOCKED);
                return;
        }
 
-       if (!iwl3945_is_rfkill_sw(priv))
+       if (!iwl_is_rfkill_sw(priv))
                rfkill_force_state(priv->rfkill, RFKILL_STATE_UNBLOCKED);
        else
                rfkill_force_state(priv->rfkill, RFKILL_STATE_SOFT_BLOCKED);