iwlegacy: remove for_each_context
[cascardo/linux.git] / drivers / net / wireless / iwlegacy / iwl4965-base.c
index d2fba9e..df86431 100644 (file)
@@ -72,7 +72,7 @@
  */
 #define DRV_DESCRIPTION        "Intel(R) Wireless WiFi 4965 driver for Linux"
 
-#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
+#ifdef CONFIG_IWLEGACY_DEBUG
 #define VD "d"
 #else
 #define VD
@@ -87,93 +87,89 @@ MODULE_AUTHOR(DRV_COPYRIGHT " " DRV_AUTHOR);
 MODULE_LICENSE("GPL");
 MODULE_ALIAS("iwl4965");
 
-void iwl4965_update_chain_flags(struct iwl_priv *priv)
+void il4965_update_chain_flags(struct il_priv *il)
 {
-       struct iwl_rxon_context *ctx;
-
-       if (priv->cfg->ops->hcmd->set_rxon_chain) {
-               for_each_context(priv, ctx) {
-                       priv->cfg->ops->hcmd->set_rxon_chain(priv, ctx);
-                       if (ctx->active.rx_chain != ctx->staging.rx_chain)
-                               iwl_legacy_commit_rxon(priv, ctx);
-               }
+       if (il->cfg->ops->hcmd->set_rxon_chain) {
+               il->cfg->ops->hcmd->set_rxon_chain(il, &il->ctx);
+               if (il->ctx.active.rx_chain != il->ctx.staging.rx_chain)
+                       il_commit_rxon(il, &il->ctx);
        }
 }
 
-static void iwl4965_clear_free_frames(struct iwl_priv *priv)
+static void il4965_clear_free_frames(struct il_priv *il)
 {
        struct list_head *element;
 
-       IWL_DEBUG_INFO(priv, "%d frames on pre-allocated heap on clear.\n",
-                      priv->frames_count);
+       D_INFO("%d frames on pre-allocated heap on clear.\n",
+                      il->frames_count);
 
-       while (!list_empty(&priv->free_frames)) {
-               element = priv->free_frames.next;
+       while (!list_empty(&il->free_frames)) {
+               element = il->free_frames.next;
                list_del(element);
-               kfree(list_entry(element, struct iwl_frame, list));
-               priv->frames_count--;
+               kfree(list_entry(element, struct il_frame, list));
+               il->frames_count--;
        }
 
-       if (priv->frames_count) {
-               IWL_WARN(priv, "%d frames still in use.  Did we lose one?\n",
-                           priv->frames_count);
-               priv->frames_count = 0;
+       if (il->frames_count) {
+               IL_WARN("%d frames still in use.  Did we lose one?\n",
+                           il->frames_count);
+               il->frames_count = 0;
        }
 }
 
-static struct iwl_frame *iwl4965_get_free_frame(struct iwl_priv *priv)
+static struct il_frame *il4965_get_free_frame(struct il_priv *il)
 {
-       struct iwl_frame *frame;
+       struct il_frame *frame;
        struct list_head *element;
-       if (list_empty(&priv->free_frames)) {
+       if (list_empty(&il->free_frames)) {
                frame = kzalloc(sizeof(*frame), GFP_KERNEL);
                if (!frame) {
-                       IWL_ERR(priv, "Could not allocate frame!\n");
+                       IL_ERR("Could not allocate frame!\n");
                        return NULL;
                }
 
-               priv->frames_count++;
+               il->frames_count++;
                return frame;
        }
 
-       element = priv->free_frames.next;
+       element = il->free_frames.next;
        list_del(element);
-       return list_entry(element, struct iwl_frame, list);
+       return list_entry(element, struct il_frame, list);
 }
 
-static void iwl4965_free_frame(struct iwl_priv *priv, struct iwl_frame *frame)
+static void il4965_free_frame(struct il_priv *il, struct il_frame *frame)
 {
        memset(frame, 0, sizeof(*frame));
-       list_add(&frame->list, &priv->free_frames);
+       list_add(&frame->list, &il->free_frames);
 }
 
-static u32 iwl4965_fill_beacon_frame(struct iwl_priv *priv,
+static u32 il4965_fill_beacon_frame(struct il_priv *il,
                                 struct ieee80211_hdr *hdr,
                                 int left)
 {
-       lockdep_assert_held(&priv->mutex);
+       lockdep_assert_held(&il->mutex);
 
-       if (!priv->beacon_skb)
+       if (!il->beacon_skb)
                return 0;
 
-       if (priv->beacon_skb->len > left)
+       if (il->beacon_skb->len > left)
                return 0;
 
-       memcpy(hdr, priv->beacon_skb->data, priv->beacon_skb->len);
+       memcpy(hdr, il->beacon_skb->data, il->beacon_skb->len);
 
-       return priv->beacon_skb->len;
+       return il->beacon_skb->len;
 }
 
 /* Parse the beacon frame to find the TIM element and set tim_idx & tim_size */
-static void iwl4965_set_beacon_tim(struct iwl_priv *priv,
-                              struct iwl_tx_beacon_cmd *tx_beacon_cmd,
+static void il4965_set_beacon_tim(struct il_priv *il,
+                              struct il_tx_beacon_cmd *tx_beacon_cmd,
                               u8 *beacon, u32 frame_size)
 {
        u16 tim_idx;
        struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)beacon;
 
        /*
-        * The index is relative to frame start but we start looking at the
+        * The idx is relative to frame start but we start looking at the
         * variable-length part of the beacon.
         */
        tim_idx = mgmt->u.beacon.variable - beacon;
@@ -188,13 +184,13 @@ static void iwl4965_set_beacon_tim(struct iwl_priv *priv,
                tx_beacon_cmd->tim_idx = cpu_to_le16(tim_idx);
                tx_beacon_cmd->tim_size = beacon[tim_idx+1];
        } else
-               IWL_WARN(priv, "Unable to find TIM Element in beacon\n");
+               IL_WARN("Unable to find TIM Element in beacon\n");
 }
 
-static unsigned int iwl4965_hw_get_beacon_cmd(struct iwl_priv *priv,
-                                      struct iwl_frame *frame)
+static unsigned int il4965_hw_get_beacon_cmd(struct il_priv *il,
+                                      struct il_frame *frame)
 {
-       struct iwl_tx_beacon_cmd *tx_beacon_cmd;
+       struct il_tx_beacon_cmd *tx_beacon_cmd;
        u32 frame_size;
        u32 rate_flags;
        u32 rate;
@@ -203,10 +199,10 @@ static unsigned int iwl4965_hw_get_beacon_cmd(struct iwl_priv *priv,
         * beacon contents.
         */
 
-       lockdep_assert_held(&priv->mutex);
+       lockdep_assert_held(&il->mutex);
 
-       if (!priv->beacon_ctx) {
-               IWL_ERR(priv, "trying to build beacon w/o beacon context!\n");
+       if (!il->beacon_ctx) {
+               IL_ERR("trying to build beacon w/o beacon context!\n");
                return 0;
        }
 
@@ -215,7 +211,7 @@ static unsigned int iwl4965_hw_get_beacon_cmd(struct iwl_priv *priv,
        memset(tx_beacon_cmd, 0, sizeof(*tx_beacon_cmd));
 
        /* Set up TX beacon contents */
-       frame_size = iwl4965_fill_beacon_frame(priv, tx_beacon_cmd->frame,
+       frame_size = il4965_fill_beacon_frame(il, tx_beacon_cmd->frame,
                                sizeof(frame->u) - sizeof(*tx_beacon_cmd));
        if (WARN_ON_ONCE(frame_size > MAX_MPDU_SIZE))
                return 0;
@@ -224,59 +220,59 @@ static unsigned int iwl4965_hw_get_beacon_cmd(struct iwl_priv *priv,
 
        /* Set up TX command fields */
        tx_beacon_cmd->tx.len = cpu_to_le16((u16)frame_size);
-       tx_beacon_cmd->tx.sta_id = priv->beacon_ctx->bcast_sta_id;
+       tx_beacon_cmd->tx.sta_id = il->beacon_ctx->bcast_sta_id;
        tx_beacon_cmd->tx.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE;
        tx_beacon_cmd->tx.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK |
                TX_CMD_FLG_TSF_MSK | TX_CMD_FLG_STA_RATE_MSK;
 
        /* Set up TX beacon command fields */
-       iwl4965_set_beacon_tim(priv, tx_beacon_cmd, (u8 *)tx_beacon_cmd->frame,
+       il4965_set_beacon_tim(il, tx_beacon_cmd, (u8 *)tx_beacon_cmd->frame,
                           frame_size);
 
        /* Set up packet rate and flags */
-       rate = iwl_legacy_get_lowest_plcp(priv, priv->beacon_ctx);
-       priv->mgmt_tx_ant = iwl4965_toggle_tx_ant(priv, priv->mgmt_tx_ant,
-                                             priv->hw_params.valid_tx_ant);
-       rate_flags = iwl4965_ant_idx_to_flags(priv->mgmt_tx_ant);
-       if ((rate >= IWL_FIRST_CCK_RATE) && (rate <= IWL_LAST_CCK_RATE))
+       rate = il_get_lowest_plcp(il, il->beacon_ctx);
+       il->mgmt_tx_ant = il4965_toggle_tx_ant(il, il->mgmt_tx_ant,
+                                             il->hw_params.valid_tx_ant);
+       rate_flags = il4965_ant_idx_to_flags(il->mgmt_tx_ant);
+       if ((rate >= IL_FIRST_CCK_RATE) && (rate <= IL_LAST_CCK_RATE))
                rate_flags |= RATE_MCS_CCK_MSK;
-       tx_beacon_cmd->tx.rate_n_flags = iwl4965_hw_set_rate_n_flags(rate,
+       tx_beacon_cmd->tx.rate_n_flags = il4965_hw_set_rate_n_flags(rate,
                        rate_flags);
 
        return sizeof(*tx_beacon_cmd) + frame_size;
 }
 
-int iwl4965_send_beacon_cmd(struct iwl_priv *priv)
+int il4965_send_beacon_cmd(struct il_priv *il)
 {
-       struct iwl_frame *frame;
+       struct il_frame *frame;
        unsigned int frame_size;
        int rc;
 
-       frame = iwl4965_get_free_frame(priv);
+       frame = il4965_get_free_frame(il);
        if (!frame) {
-               IWL_ERR(priv, "Could not obtain free frame buffer for beacon "
+               IL_ERR("Could not obtain free frame buffer for beacon "
                          "command.\n");
                return -ENOMEM;
        }
 
-       frame_size = iwl4965_hw_get_beacon_cmd(priv, frame);
+       frame_size = il4965_hw_get_beacon_cmd(il, frame);
        if (!frame_size) {
-               IWL_ERR(priv, "Error configuring the beacon command\n");
-               iwl4965_free_frame(priv, frame);
+               IL_ERR("Error configuring the beacon command\n");
+               il4965_free_frame(il, frame);
                return -EINVAL;
        }
 
-       rc = iwl_legacy_send_cmd_pdu(priv, REPLY_TX_BEACON, frame_size,
+       rc = il_send_cmd_pdu(il, REPLY_TX_BEACON, frame_size,
                              &frame->u.cmd[0]);
 
-       iwl4965_free_frame(priv, frame);
+       il4965_free_frame(il, frame);
 
        return rc;
 }
 
-static inline dma_addr_t iwl4965_tfd_tb_get_addr(struct iwl_tfd *tfd, u8 idx)
+static inline dma_addr_t il4965_tfd_tb_get_addr(struct il_tfd *tfd, u8 idx)
 {
-       struct iwl_tfd_tb *tb = &tfd->tbs[idx];
+       struct il_tfd_tb *tb = &tfd->tbs[idx];
 
        dma_addr_t addr = get_unaligned_le32(&tb->lo);
        if (sizeof(dma_addr_t) > sizeof(u32))
@@ -286,17 +282,17 @@ static inline dma_addr_t iwl4965_tfd_tb_get_addr(struct iwl_tfd *tfd, u8 idx)
        return addr;
 }
 
-static inline u16 iwl4965_tfd_tb_get_len(struct iwl_tfd *tfd, u8 idx)
+static inline u16 il4965_tfd_tb_get_len(struct il_tfd *tfd, u8 idx)
 {
-       struct iwl_tfd_tb *tb = &tfd->tbs[idx];
+       struct il_tfd_tb *tb = &tfd->tbs[idx];
 
        return le16_to_cpu(tb->hi_n_len) >> 4;
 }
 
-static inline void iwl4965_tfd_set_tb(struct iwl_tfd *tfd, u8 idx,
+static inline void il4965_tfd_set_tb(struct il_tfd *tfd, u8 idx,
                                  dma_addr_t addr, u16 len)
 {
-       struct iwl_tfd_tb *tb = &tfd->tbs[idx];
+       struct il_tfd_tb *tb = &tfd->tbs[idx];
        u16 hi_n_len = len << 4;
 
        put_unaligned_le32(addr, &tb->lo);
@@ -308,35 +304,35 @@ static inline void iwl4965_tfd_set_tb(struct iwl_tfd *tfd, u8 idx,
        tfd->num_tbs = idx + 1;
 }
 
-static inline u8 iwl4965_tfd_get_num_tbs(struct iwl_tfd *tfd)
+static inline u8 il4965_tfd_get_num_tbs(struct il_tfd *tfd)
 {
        return tfd->num_tbs & 0x1f;
 }
 
 /**
- * iwl4965_hw_txq_free_tfd - Free all chunks referenced by TFD [txq->q.read_ptr]
- * @priv - driver private data
+ * il4965_hw_txq_free_tfd - Free all chunks referenced by TFD [txq->q.read_ptr]
+ * @il - driver ilate data
  * @txq - tx queue
  *
- * Does NOT advance any TFD circular buffer read/write indexes
+ * Does NOT advance any TFD circular buffer read/write idxes
  * Does NOT free the TFD itself (which is within circular buffer)
  */
-void iwl4965_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq)
+void il4965_hw_txq_free_tfd(struct il_priv *il, struct il_tx_queue *txq)
 {
-       struct iwl_tfd *tfd_tmp = (struct iwl_tfd *)txq->tfds;
-       struct iwl_tfd *tfd;
-       struct pci_dev *dev = priv->pci_dev;
-       int index = txq->q.read_ptr;
+       struct il_tfd *tfd_tmp = (struct il_tfd *)txq->tfds;
+       struct il_tfd *tfd;
+       struct pci_dev *dev = il->pci_dev;
+       int idx = txq->q.read_ptr;
        int i;
        int num_tbs;
 
-       tfd = &tfd_tmp[index];
+       tfd = &tfd_tmp[idx];
 
        /* Sanity check on number of chunks */
-       num_tbs = iwl4965_tfd_get_num_tbs(tfd);
+       num_tbs = il4965_tfd_get_num_tbs(tfd);
 
-       if (num_tbs >= IWL_NUM_OF_TBS) {
-               IWL_ERR(priv, "Too many chunks: %i\n", num_tbs);
+       if (num_tbs >= IL_NUM_OF_TBS) {
+               IL_ERR("Too many chunks: %i\n", num_tbs);
                /* @todo issue fatal error, it is quite serious situation */
                return;
        }
@@ -344,14 +340,14 @@ void iwl4965_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq)
        /* Unmap tx_cmd */
        if (num_tbs)
                pci_unmap_single(dev,
-                               dma_unmap_addr(&txq->meta[index], mapping),
-                               dma_unmap_len(&txq->meta[index], len),
+                               dma_unmap_addr(&txq->meta[idx], mapping),
+                               dma_unmap_len(&txq->meta[idx], len),
                                PCI_DMA_BIDIRECTIONAL);
 
        /* Unmap chunks, if any. */
        for (i = 1; i < num_tbs; i++)
-               pci_unmap_single(dev, iwl4965_tfd_tb_get_addr(tfd, i),
-                               iwl4965_tfd_tb_get_len(tfd, i),
+               pci_unmap_single(dev, il4965_tfd_tb_get_addr(tfd, i),
+                               il4965_tfd_tb_get_len(tfd, i),
                                PCI_DMA_TODEVICE);
 
        /* free SKB */
@@ -368,37 +364,37 @@ void iwl4965_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq)
        }
 }
 
-int iwl4965_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv,
-                                struct iwl_tx_queue *txq,
+int il4965_hw_txq_attach_buf_to_tfd(struct il_priv *il,
+                                struct il_tx_queue *txq,
                                 dma_addr_t addr, u16 len,
                                 u8 reset, u8 pad)
 {
-       struct iwl_queue *q;
-       struct iwl_tfd *tfd, *tfd_tmp;
+       struct il_queue *q;
+       struct il_tfd *tfd, *tfd_tmp;
        u32 num_tbs;
 
        q = &txq->q;
-       tfd_tmp = (struct iwl_tfd *)txq->tfds;
+       tfd_tmp = (struct il_tfd *)txq->tfds;
        tfd = &tfd_tmp[q->write_ptr];
 
        if (reset)
                memset(tfd, 0, sizeof(*tfd));
 
-       num_tbs = iwl4965_tfd_get_num_tbs(tfd);
+       num_tbs = il4965_tfd_get_num_tbs(tfd);
 
        /* Each TFD can point to a maximum 20 Tx buffers */
-       if (num_tbs >= IWL_NUM_OF_TBS) {
-               IWL_ERR(priv, "Error can not send more than %d chunks\n",
-                         IWL_NUM_OF_TBS);
+       if (num_tbs >= IL_NUM_OF_TBS) {
+               IL_ERR("Error can not send more than %d chunks\n",
+                         IL_NUM_OF_TBS);
                return -EINVAL;
        }
 
        BUG_ON(addr & ~DMA_BIT_MASK(36));
-       if (unlikely(addr & ~IWL_TX_DMA_MASK))
-               IWL_ERR(priv, "Unaligned address = %llx\n",
+       if (unlikely(addr & ~IL_TX_DMA_MASK))
+               IL_ERR("Unaligned address = %llx\n",
                          (unsigned long long)addr);
 
-       iwl4965_tfd_set_tb(tfd, num_tbs, addr, len);
+       il4965_tfd_set_tb(tfd, num_tbs, addr, len);
 
        return 0;
 }
@@ -410,13 +406,13 @@ int iwl4965_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv,
  * 4965 supports up to 16 Tx queues in DRAM, mapped to up to 8 Tx DMA
  * channels supported in hardware.
  */
-int iwl4965_hw_tx_queue_init(struct iwl_priv *priv,
-                        struct iwl_tx_queue *txq)
+int il4965_hw_tx_queue_init(struct il_priv *il,
+                        struct il_tx_queue *txq)
 {
        int txq_id = txq->q.id;
 
        /* Circular buffer (TFD queue in DRAM) physical base address */
-       iwl_legacy_write_direct32(priv, FH_MEM_CBBC_QUEUE(txq_id),
+       il_wr(il, FH_MEM_CBBC_QUEUE(txq_id),
                             txq->q.dma_addr >> 8);
 
        return 0;
@@ -427,76 +423,76 @@ int iwl4965_hw_tx_queue_init(struct iwl_priv *priv,
  * Generic RX handler implementations
  *
  ******************************************************************************/
-static void iwl4965_rx_reply_alive(struct iwl_priv *priv,
-                               struct iwl_rx_mem_buffer *rxb)
+static void il4965_rx_reply_alive(struct il_priv *il,
+                               struct il_rx_buf *rxb)
 {
-       struct iwl_rx_packet *pkt = rxb_addr(rxb);
-       struct iwl_alive_resp *palive;
+       struct il_rx_pkt *pkt = rxb_addr(rxb);
+       struct il_alive_resp *palive;
        struct delayed_work *pwork;
 
        palive = &pkt->u.alive_frame;
 
-       IWL_DEBUG_INFO(priv, "Alive ucode status 0x%08X revision "
+       D_INFO("Alive ucode status 0x%08X revision "
                       "0x%01X 0x%01X\n",
                       palive->is_valid, palive->ver_type,
                       palive->ver_subtype);
 
        if (palive->ver_subtype == INITIALIZE_SUBTYPE) {
-               IWL_DEBUG_INFO(priv, "Initialization Alive received.\n");
-               memcpy(&priv->card_alive_init,
+               D_INFO("Initialization Alive received.\n");
+               memcpy(&il->card_alive_init,
                       &pkt->u.alive_frame,
-                      sizeof(struct iwl_init_alive_resp));
-               pwork = &priv->init_alive_start;
+                      sizeof(struct il_init_alive_resp));
+               pwork = &il->init_alive_start;
        } else {
-               IWL_DEBUG_INFO(priv, "Runtime Alive received.\n");
-               memcpy(&priv->card_alive, &pkt->u.alive_frame,
-                      sizeof(struct iwl_alive_resp));
-               pwork = &priv->alive_start;
+               D_INFO("Runtime Alive received.\n");
+               memcpy(&il->card_alive, &pkt->u.alive_frame,
+                      sizeof(struct il_alive_resp));
+               pwork = &il->alive_start;
        }
 
        /* We delay the ALIVE response by 5ms to
         * give the HW RF Kill time to activate... */
        if (palive->is_valid == UCODE_VALID_OK)
-               queue_delayed_work(priv->workqueue, pwork,
+               queue_delayed_work(il->workqueue, pwork,
                                   msecs_to_jiffies(5));
        else
-               IWL_WARN(priv, "uCode did not respond OK.\n");
+               IL_WARN("uCode did not respond OK.\n");
 }
 
 /**
- * iwl4965_bg_statistics_periodic - Timer callback to queue statistics
+ * il4965_bg_stats_periodic - Timer callback to queue stats
  *
- * This callback is provided in order to send a statistics request.
+ * This callback is provided in order to send a stats request.
  *
  * This timer function is continually reset to execute within
  * REG_RECALIB_PERIOD seconds since the last STATISTICS_NOTIFICATION
- * was received.  We need to ensure we receive the statistics in order
+ * was received.  We need to ensure we receive the stats in order
  * to update the temperature used for calibrating the TXPOWER.
  */
-static void iwl4965_bg_statistics_periodic(unsigned long data)
+static void il4965_bg_stats_periodic(unsigned long data)
 {
-       struct iwl_priv *priv = (struct iwl_priv *)data;
+       struct il_priv *il = (struct il_priv *)data;
 
-       if (test_bit(STATUS_EXIT_PENDING, &priv->status))
+       if (test_bit(STATUS_EXIT_PENDING, &il->status))
                return;
 
        /* dont send host command if rf-kill is on */
-       if (!iwl_legacy_is_ready_rf(priv))
+       if (!il_is_ready_rf(il))
                return;
 
-       iwl_legacy_send_statistics_request(priv, CMD_ASYNC, false);
+       il_send_stats_request(il, CMD_ASYNC, false);
 }
 
-static void iwl4965_rx_beacon_notif(struct iwl_priv *priv,
-                               struct iwl_rx_mem_buffer *rxb)
+static void il4965_rx_beacon_notif(struct il_priv *il,
+                               struct il_rx_buf *rxb)
 {
-       struct iwl_rx_packet *pkt = rxb_addr(rxb);
-       struct iwl4965_beacon_notif *beacon =
-               (struct iwl4965_beacon_notif *)pkt->u.raw;
-#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
-       u8 rate = iwl4965_hw_get_rate(beacon->beacon_notify_hdr.rate_n_flags);
+       struct il_rx_pkt *pkt = rxb_addr(rxb);
+       struct il4965_beacon_notif *beacon =
+               (struct il4965_beacon_notif *)pkt->u.raw;
+#ifdef CONFIG_IWLEGACY_DEBUG
+       u8 rate = il4965_hw_get_rate(beacon->beacon_notify_hdr.rate_n_flags);
 
-       IWL_DEBUG_RX(priv, "beacon status %x retries %d iss %d "
+       D_RX("beacon status %x retries %d iss %d "
                "tsf %d %d rate %d\n",
                le32_to_cpu(beacon->beacon_notify_hdr.u.status) & TX_STATUS_MSK,
                beacon->beacon_notify_hdr.failure_frame,
@@ -505,38 +501,38 @@ static void iwl4965_rx_beacon_notif(struct iwl_priv *priv,
                le32_to_cpu(beacon->low_tsf), rate);
 #endif
 
-       priv->ibss_manager = le32_to_cpu(beacon->ibss_mgr_status);
+       il->ibss_manager = le32_to_cpu(beacon->ibss_mgr_status);
 }
 
-static void iwl4965_perform_ct_kill_task(struct iwl_priv *priv)
+static void il4965_perform_ct_kill_task(struct il_priv *il)
 {
        unsigned long flags;
 
-       IWL_DEBUG_POWER(priv, "Stop all queues\n");
+       D_POWER("Stop all queues\n");
 
-       if (priv->mac80211_registered)
-               ieee80211_stop_queues(priv->hw);
+       if (il->mac80211_registered)
+               ieee80211_stop_queues(il->hw);
 
-       iwl_write32(priv, CSR_UCODE_DRV_GP1_SET,
+       _il_wr(il, CSR_UCODE_DRV_GP1_SET,
                        CSR_UCODE_DRV_GP1_REG_BIT_CT_KILL_EXIT);
-       iwl_read32(priv, CSR_UCODE_DRV_GP1);
+       _il_rd(il, CSR_UCODE_DRV_GP1);
 
-       spin_lock_irqsave(&priv->reg_lock, flags);
-       if (!iwl_grab_nic_access(priv))
-               iwl_release_nic_access(priv);
-       spin_unlock_irqrestore(&priv->reg_lock, flags);
+       spin_lock_irqsave(&il->reg_lock, flags);
+       if (!_il_grab_nic_access(il))
+               _il_release_nic_access(il);
+       spin_unlock_irqrestore(&il->reg_lock, flags);
 }
 
 /* Handle notification from uCode that card's power state is changing
  * due to software, hardware, or critical temperature RFKILL */
-static void iwl4965_rx_card_state_notif(struct iwl_priv *priv,
-                                   struct iwl_rx_mem_buffer *rxb)
+static void il4965_rx_card_state_notif(struct il_priv *il,
+                                   struct il_rx_buf *rxb)
 {
-       struct iwl_rx_packet *pkt = rxb_addr(rxb);
+       struct il_rx_pkt *pkt = rxb_addr(rxb);
        u32 flags = le32_to_cpu(pkt->u.card_state_notif.flags);
-       unsigned long status = priv->status;
+       unsigned long status = il->status;
 
-       IWL_DEBUG_RF_KILL(priv, "Card state received: HW:%s SW:%s CT:%s\n",
+       D_RF_KILL("Card state received: HW:%s SW:%s CT:%s\n",
                          (flags & HW_CARD_DISABLED) ? "Kill" : "On",
                          (flags & SW_CARD_DISABLED) ? "Kill" : "On",
                          (flags & CT_CARD_DISABLED) ?
@@ -545,41 +541,41 @@ static void iwl4965_rx_card_state_notif(struct iwl_priv *priv,
        if (flags & (SW_CARD_DISABLED | HW_CARD_DISABLED |
                     CT_CARD_DISABLED)) {
 
-               iwl_write32(priv, CSR_UCODE_DRV_GP1_SET,
+               _il_wr(il, CSR_UCODE_DRV_GP1_SET,
                            CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED);
 
-               iwl_legacy_write_direct32(priv, HBUS_TARG_MBX_C,
+               il_wr(il, HBUS_TARG_MBX_C,
                                        HBUS_TARG_MBX_C_REG_BIT_CMD_BLOCKED);
 
                if (!(flags & RXON_CARD_DISABLED)) {
-                       iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR,
+                       _il_wr(il, CSR_UCODE_DRV_GP1_CLR,
                                    CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED);
-                       iwl_legacy_write_direct32(priv, HBUS_TARG_MBX_C,
+                       il_wr(il, HBUS_TARG_MBX_C,
                                        HBUS_TARG_MBX_C_REG_BIT_CMD_BLOCKED);
                }
        }
 
        if (flags & CT_CARD_DISABLED)
-               iwl4965_perform_ct_kill_task(priv);
+               il4965_perform_ct_kill_task(il);
 
        if (flags & HW_CARD_DISABLED)
-               set_bit(STATUS_RF_KILL_HW, &priv->status);
+               set_bit(STATUS_RF_KILL_HW, &il->status);
        else
-               clear_bit(STATUS_RF_KILL_HW, &priv->status);
+               clear_bit(STATUS_RF_KILL_HW, &il->status);
 
        if (!(flags & RXON_CARD_DISABLED))
-               iwl_legacy_scan_cancel(priv);
+               il_scan_cancel(il);
 
        if ((test_bit(STATUS_RF_KILL_HW, &status) !=
-            test_bit(STATUS_RF_KILL_HW, &priv->status)))
-               wiphy_rfkill_set_hw_state(priv->hw->wiphy,
-                       test_bit(STATUS_RF_KILL_HW, &priv->status));
+            test_bit(STATUS_RF_KILL_HW, &il->status)))
+               wiphy_rfkill_set_hw_state(il->hw->wiphy,
+                       test_bit(STATUS_RF_KILL_HW, &il->status));
        else
-               wake_up(&priv->wait_command_queue);
+               wake_up(&il->wait_command_queue);
 }
 
 /**
- * iwl4965_setup_rx_handlers - Initialize Rx handler callbacks
+ * il4965_setup_rx_handlers - Initialize Rx handler callbacks
  *
  * Setup the RX handlers for each of the reply types sent from the uCode
  * to the host.
@@ -587,55 +583,55 @@ static void iwl4965_rx_card_state_notif(struct iwl_priv *priv,
  * This function chains into the hardware specific files for them to setup
  * any hardware specific handlers as well.
  */
-static void iwl4965_setup_rx_handlers(struct iwl_priv *priv)
-{
-       priv->rx_handlers[REPLY_ALIVE] = iwl4965_rx_reply_alive;
-       priv->rx_handlers[REPLY_ERROR] = iwl_legacy_rx_reply_error;
-       priv->rx_handlers[CHANNEL_SWITCH_NOTIFICATION] = iwl_legacy_rx_csa;
-       priv->rx_handlers[SPECTRUM_MEASURE_NOTIFICATION] =
-                       iwl_legacy_rx_spectrum_measure_notif;
-       priv->rx_handlers[PM_SLEEP_NOTIFICATION] = iwl_legacy_rx_pm_sleep_notif;
-       priv->rx_handlers[PM_DEBUG_STATISTIC_NOTIFIC] =
-           iwl_legacy_rx_pm_debug_statistics_notif;
-       priv->rx_handlers[BEACON_NOTIFICATION] = iwl4965_rx_beacon_notif;
+static void il4965_setup_rx_handlers(struct il_priv *il)
+{
+       il->rx_handlers[REPLY_ALIVE] = il4965_rx_reply_alive;
+       il->rx_handlers[REPLY_ERROR] = il_rx_reply_error;
+       il->rx_handlers[CHANNEL_SWITCH_NOTIFICATION] = il_rx_csa;
+       il->rx_handlers[SPECTRUM_MEASURE_NOTIFICATION] =
+                       il_rx_spectrum_measure_notif;
+       il->rx_handlers[PM_SLEEP_NOTIFICATION] = il_rx_pm_sleep_notif;
+       il->rx_handlers[PM_DEBUG_STATISTIC_NOTIFIC] =
+           il_rx_pm_debug_stats_notif;
+       il->rx_handlers[BEACON_NOTIFICATION] = il4965_rx_beacon_notif;
 
        /*
         * The same handler is used for both the REPLY to a discrete
-        * statistics request from the host as well as for the periodic
-        * statistics notifications (after received beacons) from the uCode.
+        * stats request from the host as well as for the periodic
+        * stats notifications (after received beacons) from the uCode.
         */
-       priv->rx_handlers[REPLY_STATISTICS_CMD] = iwl4965_reply_statistics;
-       priv->rx_handlers[STATISTICS_NOTIFICATION] = iwl4965_rx_statistics;
+       il->rx_handlers[REPLY_STATISTICS_CMD] = il4965_reply_stats;
+       il->rx_handlers[STATISTICS_NOTIFICATION] = il4965_rx_stats;
 
-       iwl_legacy_setup_rx_scan_handlers(priv);
+       il_setup_rx_scan_handlers(il);
 
        /* status change handler */
-       priv->rx_handlers[CARD_STATE_NOTIFICATION] =
-                                       iwl4965_rx_card_state_notif;
+       il->rx_handlers[CARD_STATE_NOTIFICATION] =
+                                       il4965_rx_card_state_notif;
 
-       priv->rx_handlers[MISSED_BEACONS_NOTIFICATION] =
-           iwl4965_rx_missed_beacon_notif;
+       il->rx_handlers[MISSED_BEACONS_NOTIFICATION] =
+           il4965_rx_missed_beacon_notif;
        /* Rx handlers */
-       priv->rx_handlers[REPLY_RX_PHY_CMD] = iwl4965_rx_reply_rx_phy;
-       priv->rx_handlers[REPLY_RX_MPDU_CMD] = iwl4965_rx_reply_rx;
+       il->rx_handlers[REPLY_RX_PHY_CMD] = il4965_rx_reply_rx_phy;
+       il->rx_handlers[REPLY_RX_MPDU_CMD] = il4965_rx_reply_rx;
        /* block ack */
-       priv->rx_handlers[REPLY_COMPRESSED_BA] = iwl4965_rx_reply_compressed_ba;
+       il->rx_handlers[REPLY_COMPRESSED_BA] = il4965_rx_reply_compressed_ba;
        /* Set up hardware specific Rx handlers */
-       priv->cfg->ops->lib->rx_handler_setup(priv);
+       il->cfg->ops->lib->rx_handler_setup(il);
 }
 
 /**
- * iwl4965_rx_handle - Main entry function for receiving responses from uCode
+ * il4965_rx_handle - Main entry function for receiving responses from uCode
  *
- * Uses the priv->rx_handlers callback function array to invoke
+ * Uses the il->rx_handlers callback function array to invoke
  * the appropriate handlers, including command responses,
  * frame-received notifications, and other notifications.
  */
-void iwl4965_rx_handle(struct iwl_priv *priv)
+void il4965_rx_handle(struct il_priv *il)
 {
-       struct iwl_rx_mem_buffer *rxb;
-       struct iwl_rx_packet *pkt;
-       struct iwl_rx_queue *rxq = &priv->rxq;
+       struct il_rx_buf *rxb;
+       struct il_rx_pkt *pkt;
+       struct il_rx_queue *rxq = &il->rxq;
        u32 r, i;
        int reclaim;
        unsigned long flags;
@@ -643,14 +639,14 @@ void iwl4965_rx_handle(struct iwl_priv *priv)
        u32 count = 8;
        int total_empty;
 
-       /* uCode's read index (stored in shared DRAM) indicates the last Rx
+       /* uCode's read idx (stored in shared DRAM) indicates the last Rx
         * buffer that the driver may process (last buffer filled by ucode). */
        r = le16_to_cpu(rxq->rb_stts->closed_rb_num) &  0x0FFF;
        i = rxq->read;
 
        /* Rx interrupt, but nothing sent from uCode */
        if (i == r)
-               IWL_DEBUG_RX(priv, "r = %d, i = %d\n", r, i);
+               D_RX("r = %d, i = %d\n", r, i);
 
        /* calculate total frames need to be restock after handling RX */
        total_empty = r - rxq->write_actual;
@@ -672,14 +668,13 @@ void iwl4965_rx_handle(struct iwl_priv *priv)
 
                rxq->queue[i] = NULL;
 
-               pci_unmap_page(priv->pci_dev, rxb->page_dma,
-                              PAGE_SIZE << priv->hw_params.rx_page_order,
+               pci_unmap_page(il->pci_dev, rxb->page_dma,
+                              PAGE_SIZE << il->hw_params.rx_page_order,
                               PCI_DMA_FROMDEVICE);
                pkt = rxb_addr(rxb);
 
                len = le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK;
                len += sizeof(u32); /* account for status word */
-               trace_iwlwifi_legacy_dev_rx(priv, pkt, len);
 
                /* Reclaim a command buffer only if this packet is a response
                 *   to a (driver-originated) command.
@@ -697,18 +692,18 @@ void iwl4965_rx_handle(struct iwl_priv *priv)
 
                /* Based on type of command response or notification,
                 *   handle those that need handling via function in
-                *   rx_handlers table.  See iwl4965_setup_rx_handlers() */
-               if (priv->rx_handlers[pkt->hdr.cmd]) {
-                       IWL_DEBUG_RX(priv, "r = %d, i = %d, %s, 0x%02x\n", r,
-                               i, iwl_legacy_get_cmd_string(pkt->hdr.cmd),
+                *   rx_handlers table.  See il4965_setup_rx_handlers() */
+               if (il->rx_handlers[pkt->hdr.cmd]) {
+                       D_RX("r = %d, i = %d, %s, 0x%02x\n", r,
+                               i, il_get_cmd_string(pkt->hdr.cmd),
                                pkt->hdr.cmd);
-                       priv->isr_stats.rx_handlers[pkt->hdr.cmd]++;
-                       priv->rx_handlers[pkt->hdr.cmd] (priv, rxb);
+                       il->isr_stats.rx_handlers[pkt->hdr.cmd]++;
+                       il->rx_handlers[pkt->hdr.cmd] (il, rxb);
                } else {
                        /* No handling needed */
-                       IWL_DEBUG_RX(priv,
+                       D_RX(
                                "r %d i %d No handler needed for %s, 0x%02x\n",
-                               r, i, iwl_legacy_get_cmd_string(pkt->hdr.cmd),
+                               r, i, il_get_cmd_string(pkt->hdr.cmd),
                                pkt->hdr.cmd);
                }
 
@@ -721,12 +716,12 @@ void iwl4965_rx_handle(struct iwl_priv *priv)
 
                if (reclaim) {
                        /* Invoke any callbacks, transfer the buffer to caller,
-                        * and fire off the (possibly) blocking iwl_legacy_send_cmd()
+                        * and fire off the (possibly) blocking il_send_cmd()
                         * as we reclaim the driver command queue */
                        if (rxb->page)
-                               iwl_legacy_tx_cmd_complete(priv, rxb);
+                               il_tx_cmd_complete(il, rxb);
                        else
-                               IWL_WARN(priv, "Claim null rxb?\n");
+                               IL_WARN("Claim null rxb?\n");
                }
 
                /* Reuse the page if possible. For notification packets and
@@ -734,8 +729,8 @@ void iwl4965_rx_handle(struct iwl_priv *priv)
                 * rx_free list for reuse later. */
                spin_lock_irqsave(&rxq->lock, flags);
                if (rxb->page != NULL) {
-                       rxb->page_dma = pci_map_page(priv->pci_dev, rxb->page,
-                               0, PAGE_SIZE << priv->hw_params.rx_page_order,
+                       rxb->page_dma = pci_map_page(il->pci_dev, rxb->page,
+                               0, PAGE_SIZE << il->hw_params.rx_page_order,
                                PCI_DMA_FROMDEVICE);
                        list_add_tail(&rxb->list, &rxq->rx_free);
                        rxq->free_count++;
@@ -751,7 +746,7 @@ void iwl4965_rx_handle(struct iwl_priv *priv)
                        count++;
                        if (count >= 8) {
                                rxq->read = i;
-                               iwl4965_rx_replenish_now(priv);
+                               il4965_rx_replenish_now(il);
                                count = 0;
                        }
                }
@@ -760,53 +755,53 @@ void iwl4965_rx_handle(struct iwl_priv *priv)
        /* Backtrack one entry */
        rxq->read = i;
        if (fill_rx)
-               iwl4965_rx_replenish_now(priv);
+               il4965_rx_replenish_now(il);
        else
-               iwl4965_rx_queue_restock(priv);
+               il4965_rx_queue_restock(il);
 }
 
 /* call this function to flush any scheduled tasklet */
-static inline void iwl4965_synchronize_irq(struct iwl_priv *priv)
+static inline void il4965_synchronize_irq(struct il_priv *il)
 {
        /* wait to make sure we flush pending tasklet*/
-       synchronize_irq(priv->pci_dev->irq);
-       tasklet_kill(&priv->irq_tasklet);
+       synchronize_irq(il->pci_dev->irq);
+       tasklet_kill(&il->irq_tasklet);
 }
 
-static void iwl4965_irq_tasklet(struct iwl_priv *priv)
+static void il4965_irq_tasklet(struct il_priv *il)
 {
        u32 inta, handled = 0;
        u32 inta_fh;
        unsigned long flags;
        u32 i;
-#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
+#ifdef CONFIG_IWLEGACY_DEBUG
        u32 inta_mask;
 #endif
 
-       spin_lock_irqsave(&priv->lock, flags);
+       spin_lock_irqsave(&il->lock, flags);
 
        /* Ack/clear/reset pending uCode interrupts.
         * Note:  Some bits in CSR_INT are "OR" of bits in CSR_FH_INT_STATUS,
         *  and will clear only when CSR_FH_INT_STATUS gets cleared. */
-       inta = iwl_read32(priv, CSR_INT);
-       iwl_write32(priv, CSR_INT, inta);
+       inta = _il_rd(il, CSR_INT);
+       _il_wr(il, CSR_INT, inta);
 
        /* Ack/clear/reset pending flow-handler (DMA) interrupts.
         * Any new interrupts that happen after this, either while we're
         * in this tasklet, or later, will show up in next ISR/tasklet. */
-       inta_fh = iwl_read32(priv, CSR_FH_INT_STATUS);
-       iwl_write32(priv, CSR_FH_INT_STATUS, inta_fh);
+       inta_fh = _il_rd(il, CSR_FH_INT_STATUS);
+       _il_wr(il, CSR_FH_INT_STATUS, inta_fh);
 
-#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
-       if (iwl_legacy_get_debug_level(priv) & IWL_DL_ISR) {
+#ifdef CONFIG_IWLEGACY_DEBUG
+       if (il_get_debug_level(il) & IL_DL_ISR) {
                /* just for debug */
-               inta_mask = iwl_read32(priv, CSR_INT_MASK);
-               IWL_DEBUG_ISR(priv, "inta 0x%08x, enabled 0x%08x, fh 0x%08x\n",
+               inta_mask = _il_rd(il, CSR_INT_MASK);
+               D_ISR("inta 0x%08x, enabled 0x%08x, fh 0x%08x\n",
                              inta, inta_mask, inta_fh);
        }
 #endif
 
-       spin_unlock_irqrestore(&priv->lock, flags);
+       spin_unlock_irqrestore(&il->lock, flags);
 
        /* Since CSR_INT and CSR_FH_INT_STATUS reads and clears are not
         * atomic, make sure that inta covers all the interrupts that
@@ -819,32 +814,32 @@ static void iwl4965_irq_tasklet(struct iwl_priv *priv)
 
        /* Now service all interrupt bits discovered above. */
        if (inta & CSR_INT_BIT_HW_ERR) {
-               IWL_ERR(priv, "Hardware error detected.  Restarting.\n");
+               IL_ERR("Hardware error detected.  Restarting.\n");
 
                /* Tell the device to stop sending interrupts */
-               iwl_legacy_disable_interrupts(priv);
+               il_disable_interrupts(il);
 
-               priv->isr_stats.hw++;
-               iwl_legacy_irq_handle_error(priv);
+               il->isr_stats.hw++;
+               il_irq_handle_error(il);
 
                handled |= CSR_INT_BIT_HW_ERR;
 
                return;
        }
 
-#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
-       if (iwl_legacy_get_debug_level(priv) & (IWL_DL_ISR)) {
+#ifdef CONFIG_IWLEGACY_DEBUG
+       if (il_get_debug_level(il) & (IL_DL_ISR)) {
                /* NIC fires this, but we don't use it, redundant with WAKEUP */
                if (inta & CSR_INT_BIT_SCD) {
-                       IWL_DEBUG_ISR(priv, "Scheduler finished to transmit "
+                       D_ISR("Scheduler finished to transmit "
                                      "the frame/frames.\n");
-                       priv->isr_stats.sch++;
+                       il->isr_stats.sch++;
                }
 
                /* Alive notification via Rx interrupt will do the real work */
                if (inta & CSR_INT_BIT_ALIVE) {
-                       IWL_DEBUG_ISR(priv, "Alive interrupt\n");
-                       priv->isr_stats.alive++;
+                       D_ISR("Alive interrupt\n");
+                       il->isr_stats.alive++;
                }
        }
 #endif
@@ -854,26 +849,26 @@ static void iwl4965_irq_tasklet(struct iwl_priv *priv)
        /* HW RF KILL switch toggled */
        if (inta & CSR_INT_BIT_RF_KILL) {
                int hw_rf_kill = 0;
-               if (!(iwl_read32(priv, CSR_GP_CNTRL) &
+               if (!(_il_rd(il, CSR_GP_CNTRL) &
                                CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW))
                        hw_rf_kill = 1;
 
-               IWL_WARN(priv, "RF_KILL bit toggled to %s.\n",
+               IL_WARN("RF_KILL bit toggled to %s.\n",
                                hw_rf_kill ? "disable radio" : "enable radio");
 
-               priv->isr_stats.rfkill++;
+               il->isr_stats.rfkill++;
 
                /* driver only loads ucode once setting the interface up.
                 * the driver allows loading the ucode even if the radio
                 * is killed. Hence update the killswitch state here. The
                 * rfkill handler will care about restarting if needed.
                 */
-               if (!test_bit(STATUS_ALIVE, &priv->status)) {
+               if (!test_bit(STATUS_ALIVE, &il->status)) {
                        if (hw_rf_kill)
-                               set_bit(STATUS_RF_KILL_HW, &priv->status);
+                               set_bit(STATUS_RF_KILL_HW, &il->status);
                        else
-                               clear_bit(STATUS_RF_KILL_HW, &priv->status);
-                       wiphy_rfkill_set_hw_state(priv->hw->wiphy, hw_rf_kill);
+                               clear_bit(STATUS_RF_KILL_HW, &il->status);
+                       wiphy_rfkill_set_hw_state(il->hw->wiphy, hw_rf_kill);
                }
 
                handled |= CSR_INT_BIT_RF_KILL;
@@ -881,17 +876,17 @@ static void iwl4965_irq_tasklet(struct iwl_priv *priv)
 
        /* Chip got too hot and stopped itself */
        if (inta & CSR_INT_BIT_CT_KILL) {
-               IWL_ERR(priv, "Microcode CT kill error detected.\n");
-               priv->isr_stats.ctkill++;
+               IL_ERR("Microcode CT kill error detected.\n");
+               il->isr_stats.ctkill++;
                handled |= CSR_INT_BIT_CT_KILL;
        }
 
        /* Error detected by uCode */
        if (inta & CSR_INT_BIT_SW_ERR) {
-               IWL_ERR(priv, "Microcode SW error detected. "
+               IL_ERR("Microcode SW error detected. "
                        " Restarting 0x%X.\n", inta);
-               priv->isr_stats.sw++;
-               iwl_legacy_irq_handle_error(priv);
+               il->isr_stats.sw++;
+               il_irq_handle_error(il);
                handled |= CSR_INT_BIT_SW_ERR;
        }
 
@@ -901,11 +896,11 @@ static void iwl4965_irq_tasklet(struct iwl_priv *priv)
         * and about any Rx buffers made available while asleep.
         */
        if (inta & CSR_INT_BIT_WAKEUP) {
-               IWL_DEBUG_ISR(priv, "Wakeup interrupt\n");
-               iwl_legacy_rx_queue_update_write_ptr(priv, &priv->rxq);
-               for (i = 0; i < priv->hw_params.max_txq_num; i++)
-                       iwl_legacy_txq_update_write_ptr(priv, &priv->txq[i]);
-               priv->isr_stats.wakeup++;
+               D_ISR("Wakeup interrupt\n");
+               il_rx_queue_update_write_ptr(il, &il->rxq);
+               for (i = 0; i < il->hw_params.max_txq_num; i++)
+                       il_txq_update_write_ptr(il, &il->txq[i]);
+               il->isr_stats.wakeup++;
                handled |= CSR_INT_BIT_WAKEUP;
        }
 
@@ -913,46 +908,46 @@ static void iwl4965_irq_tasklet(struct iwl_priv *priv)
         * Rx "responses" (frame-received notification), and other
         * notifications from uCode come through here*/
        if (inta & (CSR_INT_BIT_FH_RX | CSR_INT_BIT_SW_RX)) {
-               iwl4965_rx_handle(priv);
-               priv->isr_stats.rx++;
+               il4965_rx_handle(il);
+               il->isr_stats.rx++;
                handled |= (CSR_INT_BIT_FH_RX | CSR_INT_BIT_SW_RX);
        }
 
        /* This "Tx" DMA channel is used only for loading uCode */
        if (inta & CSR_INT_BIT_FH_TX) {
-               IWL_DEBUG_ISR(priv, "uCode load interrupt\n");
-               priv->isr_stats.tx++;
+               D_ISR("uCode load interrupt\n");
+               il->isr_stats.tx++;
                handled |= CSR_INT_BIT_FH_TX;
                /* Wake up uCode load routine, now that load is complete */
-               priv->ucode_write_complete = 1;
-               wake_up(&priv->wait_command_queue);
+               il->ucode_write_complete = 1;
+               wake_up(&il->wait_command_queue);
        }
 
        if (inta & ~handled) {
-               IWL_ERR(priv, "Unhandled INTA bits 0x%08x\n", inta & ~handled);
-               priv->isr_stats.unhandled++;
+               IL_ERR("Unhandled INTA bits 0x%08x\n", inta & ~handled);
+               il->isr_stats.unhandled++;
        }
 
-       if (inta & ~(priv->inta_mask)) {
-               IWL_WARN(priv, "Disabled INTA bits 0x%08x were pending\n",
-                        inta & ~priv->inta_mask);
-               IWL_WARN(priv, "   with FH_INT = 0x%08x\n", inta_fh);
+       if (inta & ~(il->inta_mask)) {
+               IL_WARN("Disabled INTA bits 0x%08x were pending\n",
+                        inta & ~il->inta_mask);
+               IL_WARN("   with FH_INT = 0x%08x\n", inta_fh);
        }
 
        /* Re-enable all interrupts */
        /* only Re-enable if disabled by irq */
-       if (test_bit(STATUS_INT_ENABLED, &priv->status))
-               iwl_legacy_enable_interrupts(priv);
+       if (test_bit(STATUS_INT_ENABLED, &il->status))
+               il_enable_interrupts(il);
        /* Re-enable RF_KILL if it occurred */
        else if (handled & CSR_INT_BIT_RF_KILL)
-               iwl_legacy_enable_rfkill_int(priv);
-
-#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
-       if (iwl_legacy_get_debug_level(priv) & (IWL_DL_ISR)) {
-               inta = iwl_read32(priv, CSR_INT);
-               inta_mask = iwl_read32(priv, CSR_INT_MASK);
-               inta_fh = iwl_read32(priv, CSR_FH_INT_STATUS);
-               IWL_DEBUG_ISR(priv,
+               il_enable_rfkill_int(il);
+
+#ifdef CONFIG_IWLEGACY_DEBUG
+       if (il_get_debug_level(il) & (IL_DL_ISR)) {
+               inta = _il_rd(il, CSR_INT);
+               inta_mask = _il_rd(il, CSR_INT_MASK);
+               inta_fh = _il_rd(il, CSR_FH_INT_STATUS);
+               D_ISR(
                        "End inta 0x%08x, enabled 0x%08x, fh 0x%08x, "
                        "flags 0x%08lx\n", inta, inta_mask, inta_fh, flags);
        }
@@ -965,7 +960,7 @@ static void iwl4965_irq_tasklet(struct iwl_priv *priv)
  *
  *****************************************************************************/
 
-#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
+#ifdef CONFIG_IWLEGACY_DEBUG
 
 /*
  * The following adds a new attribute to the sysfs representation
@@ -978,78 +973,78 @@ static void iwl4965_irq_tasklet(struct iwl_priv *priv)
  * level that is used instead of the global debug level if it (the per
  * device debug level) is set.
  */
-static ssize_t iwl4965_show_debug_level(struct device *d,
+static ssize_t il4965_show_debug_level(struct device *d,
                                struct device_attribute *attr, char *buf)
 {
-       struct iwl_priv *priv = dev_get_drvdata(d);
-       return sprintf(buf, "0x%08X\n", iwl_legacy_get_debug_level(priv));
+       struct il_priv *il = dev_get_drvdata(d);
+       return sprintf(buf, "0x%08X\n", il_get_debug_level(il));
 }
-static ssize_t iwl4965_store_debug_level(struct device *d,
+static ssize_t il4965_store_debug_level(struct device *d,
                                struct device_attribute *attr,
                                 const char *buf, size_t count)
 {
-       struct iwl_priv *priv = dev_get_drvdata(d);
+       struct il_priv *il = dev_get_drvdata(d);
        unsigned long val;
        int ret;
 
        ret = strict_strtoul(buf, 0, &val);
        if (ret)
-               IWL_ERR(priv, "%s is not in hex or decimal form.\n", buf);
+               IL_ERR("%s is not in hex or decimal form.\n", buf);
        else {
-               priv->debug_level = val;
-               if (iwl_legacy_alloc_traffic_mem(priv))
-                       IWL_ERR(priv,
+               il->debug_level = val;
+               if (il_alloc_traffic_mem(il))
+                       IL_ERR(
                                "Not enough memory to generate traffic log\n");
        }
        return strnlen(buf, count);
 }
 
 static DEVICE_ATTR(debug_level, S_IWUSR | S_IRUGO,
-                       iwl4965_show_debug_level, iwl4965_store_debug_level);
+                       il4965_show_debug_level, il4965_store_debug_level);
 
 
-#endif /* CONFIG_IWLWIFI_LEGACY_DEBUG */
+#endif /* CONFIG_IWLEGACY_DEBUG */
 
 
-static ssize_t iwl4965_show_temperature(struct device *d,
+static ssize_t il4965_show_temperature(struct device *d,
                                struct device_attribute *attr, char *buf)
 {
-       struct iwl_priv *priv = dev_get_drvdata(d);
+       struct il_priv *il = dev_get_drvdata(d);
 
-       if (!iwl_legacy_is_alive(priv))
+       if (!il_is_alive(il))
                return -EAGAIN;
 
-       return sprintf(buf, "%d\n", priv->temperature);
+       return sprintf(buf, "%d\n", il->temperature);
 }
 
-static DEVICE_ATTR(temperature, S_IRUGO, iwl4965_show_temperature, NULL);
+static DEVICE_ATTR(temperature, S_IRUGO, il4965_show_temperature, NULL);
 
-static ssize_t iwl4965_show_tx_power(struct device *d,
+static ssize_t il4965_show_tx_power(struct device *d,
                             struct device_attribute *attr, char *buf)
 {
-       struct iwl_priv *priv = dev_get_drvdata(d);
+       struct il_priv *il = dev_get_drvdata(d);
 
-       if (!iwl_legacy_is_ready_rf(priv))
+       if (!il_is_ready_rf(il))
                return sprintf(buf, "off\n");
        else
-               return sprintf(buf, "%d\n", priv->tx_power_user_lmt);
+               return sprintf(buf, "%d\n", il->tx_power_user_lmt);
 }
 
-static ssize_t iwl4965_store_tx_power(struct device *d,
+static ssize_t il4965_store_tx_power(struct device *d,
                              struct device_attribute *attr,
                              const char *buf, size_t count)
 {
-       struct iwl_priv *priv = dev_get_drvdata(d);
+       struct il_priv *il = dev_get_drvdata(d);
        unsigned long val;
        int ret;
 
        ret = strict_strtoul(buf, 10, &val);
        if (ret)
-               IWL_INFO(priv, "%s is not in decimal form.\n", buf);
+               IL_INFO("%s is not in decimal form.\n", buf);
        else {
-               ret = iwl_legacy_set_tx_power(priv, val, false);
+               ret = il_set_tx_power(il, val, false);
                if (ret)
-                       IWL_ERR(priv, "failed setting tx power (0x%d).\n",
+                       IL_ERR("failed setting tx power (0x%d).\n",
                                ret);
                else
                        ret = count;
@@ -1058,20 +1053,20 @@ static ssize_t iwl4965_store_tx_power(struct device *d,
 }
 
 static DEVICE_ATTR(tx_power, S_IWUSR | S_IRUGO,
-                       iwl4965_show_tx_power, iwl4965_store_tx_power);
+                       il4965_show_tx_power, il4965_store_tx_power);
 
-static struct attribute *iwl_sysfs_entries[] = {
+static struct attribute *il_sysfs_entries[] = {
        &dev_attr_temperature.attr,
        &dev_attr_tx_power.attr,
-#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
+#ifdef CONFIG_IWLEGACY_DEBUG
        &dev_attr_debug_level.attr,
 #endif
        NULL
 };
 
-static struct attribute_group iwl_attribute_group = {
+static struct attribute_group il_attribute_group = {
        .name = NULL,           /* put in device directory */
-       .attrs = iwl_sysfs_entries,
+       .attrs = il_sysfs_entries,
 };
 
 /******************************************************************************
@@ -1080,70 +1075,70 @@ static struct attribute_group iwl_attribute_group = {
  *
  ******************************************************************************/
 
-static void iwl4965_dealloc_ucode_pci(struct iwl_priv *priv)
+static void il4965_dealloc_ucode_pci(struct il_priv *il)
 {
-       iwl_legacy_free_fw_desc(priv->pci_dev, &priv->ucode_code);
-       iwl_legacy_free_fw_desc(priv->pci_dev, &priv->ucode_data);
-       iwl_legacy_free_fw_desc(priv->pci_dev, &priv->ucode_data_backup);
-       iwl_legacy_free_fw_desc(priv->pci_dev, &priv->ucode_init);
-       iwl_legacy_free_fw_desc(priv->pci_dev, &priv->ucode_init_data);
-       iwl_legacy_free_fw_desc(priv->pci_dev, &priv->ucode_boot);
+       il_free_fw_desc(il->pci_dev, &il->ucode_code);
+       il_free_fw_desc(il->pci_dev, &il->ucode_data);
+       il_free_fw_desc(il->pci_dev, &il->ucode_data_backup);
+       il_free_fw_desc(il->pci_dev, &il->ucode_init);
+       il_free_fw_desc(il->pci_dev, &il->ucode_init_data);
+       il_free_fw_desc(il->pci_dev, &il->ucode_boot);
 }
 
-static void iwl4965_nic_start(struct iwl_priv *priv)
+static void il4965_nic_start(struct il_priv *il)
 {
        /* Remove all resets to allow NIC to operate */
-       iwl_write32(priv, CSR_RESET, 0);
+       _il_wr(il, CSR_RESET, 0);
 }
 
-static void iwl4965_ucode_callback(const struct firmware *ucode_raw,
+static void il4965_ucode_callback(const struct firmware *ucode_raw,
                                        void *context);
-static int iwl4965_mac_setup_register(struct iwl_priv *priv,
+static int il4965_mac_setup_register(struct il_priv *il,
                                                u32 max_probe_length);
 
-static int __must_check iwl4965_request_firmware(struct iwl_priv *priv, bool first)
+static int __must_check il4965_request_firmware(struct il_priv *il, bool first)
 {
-       const char *name_pre = priv->cfg->fw_name_pre;
+       const char *name_pre = il->cfg->fw_name_pre;
        char tag[8];
 
        if (first) {
-               priv->fw_index = priv->cfg->ucode_api_max;
-               sprintf(tag, "%d", priv->fw_index);
+               il->fw_idx = il->cfg->ucode_api_max;
+               sprintf(tag, "%d", il->fw_idx);
        } else {
-               priv->fw_index--;
-               sprintf(tag, "%d", priv->fw_index);
+               il->fw_idx--;
+               sprintf(tag, "%d", il->fw_idx);
        }
 
-       if (priv->fw_index < priv->cfg->ucode_api_min) {
-               IWL_ERR(priv, "no suitable firmware found!\n");
+       if (il->fw_idx < il->cfg->ucode_api_min) {
+               IL_ERR("no suitable firmware found!\n");
                return -ENOENT;
        }
 
-       sprintf(priv->firmware_name, "%s%s%s", name_pre, tag, ".ucode");
+       sprintf(il->firmware_name, "%s%s%s", name_pre, tag, ".ucode");
 
-       IWL_DEBUG_INFO(priv, "attempting to load firmware '%s'\n",
-                      priv->firmware_name);
+       D_INFO("attempting to load firmware '%s'\n",
+                      il->firmware_name);
 
-       return request_firmware_nowait(THIS_MODULE, 1, priv->firmware_name,
-                                      &priv->pci_dev->dev, GFP_KERNEL, priv,
-                                      iwl4965_ucode_callback);
+       return request_firmware_nowait(THIS_MODULE, 1, il->firmware_name,
+                                      &il->pci_dev->dev, GFP_KERNEL, il,
+                                      il4965_ucode_callback);
 }
 
-struct iwl4965_firmware_pieces {
+struct il4965_firmware_pieces {
        const void *inst, *data, *init, *init_data, *boot;
        size_t inst_size, data_size, init_size, init_data_size, boot_size;
 };
 
-static int iwl4965_load_firmware(struct iwl_priv *priv,
+static int il4965_load_firmware(struct il_priv *il,
                                       const struct firmware *ucode_raw,
-                                      struct iwl4965_firmware_pieces *pieces)
+                                      struct il4965_firmware_pieces *pieces)
 {
-       struct iwl_ucode_header *ucode = (void *)ucode_raw->data;
+       struct il_ucode_header *ucode = (void *)ucode_raw->data;
        u32 api_ver, hdr_size;
        const u8 *src;
 
-       priv->ucode_ver = le32_to_cpu(ucode->ver);
-       api_ver = IWL_UCODE_API(priv->ucode_ver);
+       il->ucode_ver = le32_to_cpu(ucode->ver);
+       api_ver = IL_UCODE_API(il->ucode_ver);
 
        switch (api_ver) {
        default:
@@ -1152,7 +1147,7 @@ static int iwl4965_load_firmware(struct iwl_priv *priv,
        case 2:
                hdr_size = 24;
                if (ucode_raw->size < hdr_size) {
-                       IWL_ERR(priv, "File size too small!\n");
+                       IL_ERR("File size too small!\n");
                        return -EINVAL;
                }
                pieces->inst_size = le32_to_cpu(ucode->v1.inst_size);
@@ -1170,7 +1165,7 @@ static int iwl4965_load_firmware(struct iwl_priv *priv,
                                pieces->data_size + pieces->init_size +
                                pieces->init_data_size + pieces->boot_size) {
 
-               IWL_ERR(priv,
+               IL_ERR(
                        "uCode file size %d does not match expected size\n",
                        (int)ucode_raw->size);
                return -EINVAL;
@@ -1191,54 +1186,54 @@ static int iwl4965_load_firmware(struct iwl_priv *priv,
 }
 
 /**
- * iwl4965_ucode_callback - callback when firmware was loaded
+ * il4965_ucode_callback - callback when firmware was loaded
  *
  * If loaded successfully, copies the firmware into buffers
  * for the card to fetch (via DMA).
  */
 static void
-iwl4965_ucode_callback(const struct firmware *ucode_raw, void *context)
+il4965_ucode_callback(const struct firmware *ucode_raw, void *context)
 {
-       struct iwl_priv *priv = context;
-       struct iwl_ucode_header *ucode;
+       struct il_priv *il = context;
+       struct il_ucode_header *ucode;
        int err;
-       struct iwl4965_firmware_pieces pieces;
-       const unsigned int api_max = priv->cfg->ucode_api_max;
-       const unsigned int api_min = priv->cfg->ucode_api_min;
+       struct il4965_firmware_pieces pieces;
+       const unsigned int api_max = il->cfg->ucode_api_max;
+       const unsigned int api_min = il->cfg->ucode_api_min;
        u32 api_ver;
 
        u32 max_probe_length = 200;
        u32 standard_phy_calibration_size =
-                       IWL_DEFAULT_STANDARD_PHY_CALIBRATE_TBL_SIZE;
+                       IL_DEFAULT_STANDARD_PHY_CALIBRATE_TBL_SIZE;
 
        memset(&pieces, 0, sizeof(pieces));
 
        if (!ucode_raw) {
-               if (priv->fw_index <= priv->cfg->ucode_api_max)
-                       IWL_ERR(priv,
+               if (il->fw_idx <= il->cfg->ucode_api_max)
+                       IL_ERR(
                                "request for firmware file '%s' failed.\n",
-                               priv->firmware_name);
+                               il->firmware_name);
                goto try_again;
        }
 
-       IWL_DEBUG_INFO(priv, "Loaded firmware file '%s' (%zd bytes).\n",
-                      priv->firmware_name, ucode_raw->size);
+       D_INFO("Loaded firmware file '%s' (%zd bytes).\n",
+                      il->firmware_name, ucode_raw->size);
 
        /* Make sure that we got at least the API version number */
        if (ucode_raw->size < 4) {
-               IWL_ERR(priv, "File size way too small!\n");
+               IL_ERR("File size way too small!\n");
                goto try_again;
        }
 
        /* Data from ucode file:  header followed by uCode images */
-       ucode = (struct iwl_ucode_header *)ucode_raw->data;
+       ucode = (struct il_ucode_header *)ucode_raw->data;
 
-       err = iwl4965_load_firmware(priv, ucode_raw, &pieces);
+       err = il4965_load_firmware(il, ucode_raw, &pieces);
 
        if (err)
                goto try_again;
 
-       api_ver = IWL_UCODE_API(priv->ucode_ver);
+       api_ver = IL_UCODE_API(il->ucode_ver);
 
        /*
         * api_ver should match the api version forming part of the
@@ -1246,7 +1241,7 @@ iwl4965_ucode_callback(const struct firmware *ucode_raw, void *context)
         * on the API version read from firmware header from here on forward
         */
        if (api_ver < api_min || api_ver > api_max) {
-               IWL_ERR(priv,
+               IL_ERR(
                        "Driver unable to support your firmware API. "
                        "Driver supports v%u, firmware is v%u.\n",
                        api_max, api_ver);
@@ -1254,25 +1249,25 @@ iwl4965_ucode_callback(const struct firmware *ucode_raw, void *context)
        }
 
        if (api_ver != api_max)
-               IWL_ERR(priv,
+               IL_ERR(
                        "Firmware has old API version. Expected v%u, "
                        "got v%u. New firmware can be obtained "
                        "from http://www.intellinuxwireless.org.\n",
                        api_max, api_ver);
 
-       IWL_INFO(priv, "loaded firmware version %u.%u.%u.%u\n",
-                IWL_UCODE_MAJOR(priv->ucode_ver),
-                IWL_UCODE_MINOR(priv->ucode_ver),
-                IWL_UCODE_API(priv->ucode_ver),
-                IWL_UCODE_SERIAL(priv->ucode_ver));
+       IL_INFO("loaded firmware version %u.%u.%u.%u\n",
+                IL_UCODE_MAJOR(il->ucode_ver),
+                IL_UCODE_MINOR(il->ucode_ver),
+                IL_UCODE_API(il->ucode_ver),
+                IL_UCODE_SERIAL(il->ucode_ver));
 
-       snprintf(priv->hw->wiphy->fw_version,
-                sizeof(priv->hw->wiphy->fw_version),
+       snprintf(il->hw->wiphy->fw_version,
+                sizeof(il->hw->wiphy->fw_version),
                 "%u.%u.%u.%u",
-                IWL_UCODE_MAJOR(priv->ucode_ver),
-                IWL_UCODE_MINOR(priv->ucode_ver),
-                IWL_UCODE_API(priv->ucode_ver),
-                IWL_UCODE_SERIAL(priv->ucode_ver));
+                IL_UCODE_MAJOR(il->ucode_ver),
+                IL_UCODE_MINOR(il->ucode_ver),
+                IL_UCODE_API(il->ucode_ver),
+                IL_UCODE_SERIAL(il->ucode_ver));
 
        /*
         * For any of the failures below (before allocating pci memory)
@@ -1280,46 +1275,46 @@ iwl4965_ucode_callback(const struct firmware *ucode_raw, void *context)
         * user just got a corrupted version of the latest API.
         */
 
-       IWL_DEBUG_INFO(priv, "f/w package hdr ucode version raw = 0x%x\n",
-                      priv->ucode_ver);
-       IWL_DEBUG_INFO(priv, "f/w package hdr runtime inst size = %Zd\n",
+       D_INFO("f/w package hdr ucode version raw = 0x%x\n",
+                      il->ucode_ver);
+       D_INFO("f/w package hdr runtime inst size = %Zd\n",
                       pieces.inst_size);
-       IWL_DEBUG_INFO(priv, "f/w package hdr runtime data size = %Zd\n",
+       D_INFO("f/w package hdr runtime data size = %Zd\n",
                       pieces.data_size);
-       IWL_DEBUG_INFO(priv, "f/w package hdr init inst size = %Zd\n",
+       D_INFO("f/w package hdr init inst size = %Zd\n",
                       pieces.init_size);
-       IWL_DEBUG_INFO(priv, "f/w package hdr init data size = %Zd\n",
+       D_INFO("f/w package hdr init data size = %Zd\n",
                       pieces.init_data_size);
-       IWL_DEBUG_INFO(priv, "f/w package hdr boot inst size = %Zd\n",
+       D_INFO("f/w package hdr boot inst size = %Zd\n",
                       pieces.boot_size);
 
        /* Verify that uCode images will fit in card's SRAM */
-       if (pieces.inst_size > priv->hw_params.max_inst_size) {
-               IWL_ERR(priv, "uCode instr len %Zd too large to fit in\n",
+       if (pieces.inst_size > il->hw_params.max_inst_size) {
+               IL_ERR("uCode instr len %Zd too large to fit in\n",
                        pieces.inst_size);
                goto try_again;
        }
 
-       if (pieces.data_size > priv->hw_params.max_data_size) {
-               IWL_ERR(priv, "uCode data len %Zd too large to fit in\n",
+       if (pieces.data_size > il->hw_params.max_data_size) {
+               IL_ERR("uCode data len %Zd too large to fit in\n",
                        pieces.data_size);
                goto try_again;
        }
 
-       if (pieces.init_size > priv->hw_params.max_inst_size) {
-               IWL_ERR(priv, "uCode init instr len %Zd too large to fit in\n",
+       if (pieces.init_size > il->hw_params.max_inst_size) {
+               IL_ERR("uCode init instr len %Zd too large to fit in\n",
                        pieces.init_size);
                goto try_again;
        }
 
-       if (pieces.init_data_size > priv->hw_params.max_data_size) {
-               IWL_ERR(priv, "uCode init data len %Zd too large to fit in\n",
+       if (pieces.init_data_size > il->hw_params.max_data_size) {
+               IL_ERR("uCode init data len %Zd too large to fit in\n",
                        pieces.init_data_size);
                goto try_again;
        }
 
-       if (pieces.boot_size > priv->hw_params.max_bsm_size) {
-               IWL_ERR(priv, "uCode boot instr len %Zd too large to fit in\n",
+       if (pieces.boot_size > il->hw_params.max_bsm_size) {
+               IL_ERR("uCode boot instr len %Zd too large to fit in\n",
                        pieces.boot_size);
                goto try_again;
        }
@@ -1329,92 +1324,92 @@ iwl4965_ucode_callback(const struct firmware *ucode_raw, void *context)
        /* Runtime instructions and 2 copies of data:
         * 1) unmodified from disk
         * 2) backup cache for save/restore during power-downs */
-       priv->ucode_code.len = pieces.inst_size;
-       iwl_legacy_alloc_fw_desc(priv->pci_dev, &priv->ucode_code);
+       il->ucode_code.len = pieces.inst_size;
+       il_alloc_fw_desc(il->pci_dev, &il->ucode_code);
 
-       priv->ucode_data.len = pieces.data_size;
-       iwl_legacy_alloc_fw_desc(priv->pci_dev, &priv->ucode_data);
+       il->ucode_data.len = pieces.data_size;
+       il_alloc_fw_desc(il->pci_dev, &il->ucode_data);
 
-       priv->ucode_data_backup.len = pieces.data_size;
-       iwl_legacy_alloc_fw_desc(priv->pci_dev, &priv->ucode_data_backup);
+       il->ucode_data_backup.len = pieces.data_size;
+       il_alloc_fw_desc(il->pci_dev, &il->ucode_data_backup);
 
-       if (!priv->ucode_code.v_addr || !priv->ucode_data.v_addr ||
-           !priv->ucode_data_backup.v_addr)
+       if (!il->ucode_code.v_addr || !il->ucode_data.v_addr ||
+           !il->ucode_data_backup.v_addr)
                goto err_pci_alloc;
 
        /* Initialization instructions and data */
        if (pieces.init_size && pieces.init_data_size) {
-               priv->ucode_init.len = pieces.init_size;
-               iwl_legacy_alloc_fw_desc(priv->pci_dev, &priv->ucode_init);
+               il->ucode_init.len = pieces.init_size;
+               il_alloc_fw_desc(il->pci_dev, &il->ucode_init);
 
-               priv->ucode_init_data.len = pieces.init_data_size;
-               iwl_legacy_alloc_fw_desc(priv->pci_dev, &priv->ucode_init_data);
+               il->ucode_init_data.len = pieces.init_data_size;
+               il_alloc_fw_desc(il->pci_dev, &il->ucode_init_data);
 
-               if (!priv->ucode_init.v_addr || !priv->ucode_init_data.v_addr)
+               if (!il->ucode_init.v_addr || !il->ucode_init_data.v_addr)
                        goto err_pci_alloc;
        }
 
        /* Bootstrap (instructions only, no data) */
        if (pieces.boot_size) {
-               priv->ucode_boot.len = pieces.boot_size;
-               iwl_legacy_alloc_fw_desc(priv->pci_dev, &priv->ucode_boot);
+               il->ucode_boot.len = pieces.boot_size;
+               il_alloc_fw_desc(il->pci_dev, &il->ucode_boot);
 
-               if (!priv->ucode_boot.v_addr)
+               if (!il->ucode_boot.v_addr)
                        goto err_pci_alloc;
        }
 
        /* Now that we can no longer fail, copy information */
 
-       priv->sta_key_max_num = STA_KEY_MAX_NUM;
+       il->sta_key_max_num = STA_KEY_MAX_NUM;
 
        /* Copy images into buffers for card's bus-master reads ... */
 
        /* Runtime instructions (first block of data in file) */
-       IWL_DEBUG_INFO(priv, "Copying (but not loading) uCode instr len %Zd\n",
+       D_INFO("Copying (but not loading) uCode instr len %Zd\n",
                        pieces.inst_size);
-       memcpy(priv->ucode_code.v_addr, pieces.inst, pieces.inst_size);
+       memcpy(il->ucode_code.v_addr, pieces.inst, pieces.inst_size);
 
-       IWL_DEBUG_INFO(priv, "uCode instr buf vaddr = 0x%p, paddr = 0x%08x\n",
-               priv->ucode_code.v_addr, (u32)priv->ucode_code.p_addr);
+       D_INFO("uCode instr buf vaddr = 0x%p, paddr = 0x%08x\n",
+               il->ucode_code.v_addr, (u32)il->ucode_code.p_addr);
 
        /*
         * Runtime data
-        * NOTE:  Copy into backup buffer will be done in iwl_up()
+        * NOTE:  Copy into backup buffer will be done in il_up()
         */
-       IWL_DEBUG_INFO(priv, "Copying (but not loading) uCode data len %Zd\n",
+       D_INFO("Copying (but not loading) uCode data len %Zd\n",
                        pieces.data_size);
-       memcpy(priv->ucode_data.v_addr, pieces.data, pieces.data_size);
-       memcpy(priv->ucode_data_backup.v_addr, pieces.data, pieces.data_size);
+       memcpy(il->ucode_data.v_addr, pieces.data, pieces.data_size);
+       memcpy(il->ucode_data_backup.v_addr, pieces.data, pieces.data_size);
 
        /* Initialization instructions */
        if (pieces.init_size) {
-               IWL_DEBUG_INFO(priv,
+               D_INFO(
                                "Copying (but not loading) init instr len %Zd\n",
                                pieces.init_size);
-               memcpy(priv->ucode_init.v_addr, pieces.init, pieces.init_size);
+               memcpy(il->ucode_init.v_addr, pieces.init, pieces.init_size);
        }
 
        /* Initialization data */
        if (pieces.init_data_size) {
-               IWL_DEBUG_INFO(priv,
+               D_INFO(
                                "Copying (but not loading) init data len %Zd\n",
                               pieces.init_data_size);
-               memcpy(priv->ucode_init_data.v_addr, pieces.init_data,
+               memcpy(il->ucode_init_data.v_addr, pieces.init_data,
                       pieces.init_data_size);
        }
 
        /* Bootstrap instructions */
-       IWL_DEBUG_INFO(priv, "Copying (but not loading) boot instr len %Zd\n",
+       D_INFO("Copying (but not loading) boot instr len %Zd\n",
                        pieces.boot_size);
-       memcpy(priv->ucode_boot.v_addr, pieces.boot, pieces.boot_size);
+       memcpy(il->ucode_boot.v_addr, pieces.boot, pieces.boot_size);
 
        /*
         * figure out the offset of chain noise reset and gain commands
         * base on the size of standard phy calibration commands table size
         */
-       priv->_4965.phy_calib_chain_noise_reset_cmd =
+       il->_4965.phy_calib_chain_noise_reset_cmd =
                standard_phy_calibration_size;
-       priv->_4965.phy_calib_chain_noise_gain_cmd =
+       il->_4965.phy_calib_chain_noise_gain_cmd =
                standard_phy_calibration_size + 1;
 
        /**************************************************
@@ -1422,40 +1417,40 @@ iwl4965_ucode_callback(const struct firmware *ucode_raw, void *context)
         *
         * 9. Setup and register with mac80211 and debugfs
         **************************************************/
-       err = iwl4965_mac_setup_register(priv, max_probe_length);
+       err = il4965_mac_setup_register(il, max_probe_length);
        if (err)
                goto out_unbind;
 
-       err = iwl_legacy_dbgfs_register(priv, DRV_NAME);
+       err = il_dbgfs_register(il, DRV_NAME);
        if (err)
-               IWL_ERR(priv,
+               IL_ERR(
                "failed to create debugfs files. Ignoring error: %d\n", err);
 
-       err = sysfs_create_group(&priv->pci_dev->dev.kobj,
-                                       &iwl_attribute_group);
+       err = sysfs_create_group(&il->pci_dev->dev.kobj,
+                                       &il_attribute_group);
        if (err) {
-               IWL_ERR(priv, "failed to create sysfs device attributes\n");
+               IL_ERR("failed to create sysfs device attributes\n");
                goto out_unbind;
        }
 
        /* We have our copies now, allow OS release its copies */
        release_firmware(ucode_raw);
-       complete(&priv->_4965.firmware_loading_complete);
+       complete(&il->_4965.firmware_loading_complete);
        return;
 
  try_again:
        /* try next, if any */
-       if (iwl4965_request_firmware(priv, false))
+       if (il4965_request_firmware(il, false))
                goto out_unbind;
        release_firmware(ucode_raw);
        return;
 
  err_pci_alloc:
-       IWL_ERR(priv, "failed to allocate pci memory\n");
-       iwl4965_dealloc_ucode_pci(priv);
+       IL_ERR("failed to allocate pci memory\n");
+       il4965_dealloc_ucode_pci(il);
  out_unbind:
-       complete(&priv->_4965.firmware_loading_complete);
-       device_release_driver(&priv->pci_dev->dev);
+       complete(&il->_4965.firmware_loading_complete);
+       device_release_driver(&il->pci_dev->dev);
        release_firmware(ucode_raw);
 }
 
@@ -1471,7 +1466,7 @@ static const char * const desc_lookup_text[] = {
        "HW_ERROR_TUNE_LOCK",
        "HW_ERROR_TEMPERATURE",
        "ILLEGAL_CHAN_FREQ",
-       "VCC_NOT_STABLE",
+       "VCC_NOT_STBL",
        "FH_ERROR",
        "NMI_INTERRUPT_HOST",
        "NMI_INTERRUPT_ACTION_PT",
@@ -1509,7 +1504,7 @@ static struct { char *name; u8 num; } advanced_lookup[] = {
        { "ADVANCED_SYSASSERT", 0 },
 };
 
-static const char *iwl4965_desc_lookup(u32 num)
+static const char *il4965_desc_lookup(u32 num)
 {
        int i;
        int max = ARRAY_SIZE(desc_lookup_text);
@@ -1528,535 +1523,526 @@ static const char *iwl4965_desc_lookup(u32 num)
 #define ERROR_START_OFFSET  (1 * sizeof(u32))
 #define ERROR_ELEM_SIZE     (7 * sizeof(u32))
 
-void iwl4965_dump_nic_error_log(struct iwl_priv *priv)
+void il4965_dump_nic_error_log(struct il_priv *il)
 {
        u32 data2, line;
        u32 desc, time, count, base, data1;
        u32 blink1, blink2, ilink1, ilink2;
        u32 pc, hcmd;
 
-       if (priv->ucode_type == UCODE_INIT) {
-               base = le32_to_cpu(priv->card_alive_init.error_event_table_ptr);
+       if (il->ucode_type == UCODE_INIT) {
+               base = le32_to_cpu(il->card_alive_init.error_event_table_ptr);
        } else {
-               base = le32_to_cpu(priv->card_alive.error_event_table_ptr);
+               base = le32_to_cpu(il->card_alive.error_event_table_ptr);
        }
 
-       if (!priv->cfg->ops->lib->is_valid_rtc_data_addr(base)) {
-               IWL_ERR(priv,
+       if (!il->cfg->ops->lib->is_valid_rtc_data_addr(base)) {
+               IL_ERR(
                        "Not valid error log pointer 0x%08X for %s uCode\n",
-                       base, (priv->ucode_type == UCODE_INIT) ? "Init" : "RT");
+                       base, (il->ucode_type == UCODE_INIT) ? "Init" : "RT");
                return;
        }
 
-       count = iwl_legacy_read_targ_mem(priv, base);
+       count = il_read_targ_mem(il, base);
 
        if (ERROR_START_OFFSET <= count * ERROR_ELEM_SIZE) {
-               IWL_ERR(priv, "Start IWL Error Log Dump:\n");
-               IWL_ERR(priv, "Status: 0x%08lX, count: %d\n",
-                       priv->status, count);
-       }
-
-       desc = iwl_legacy_read_targ_mem(priv, base + 1 * sizeof(u32));
-       priv->isr_stats.err_code = desc;
-       pc = iwl_legacy_read_targ_mem(priv, base + 2 * sizeof(u32));
-       blink1 = iwl_legacy_read_targ_mem(priv, base + 3 * sizeof(u32));
-       blink2 = iwl_legacy_read_targ_mem(priv, base + 4 * sizeof(u32));
-       ilink1 = iwl_legacy_read_targ_mem(priv, base + 5 * sizeof(u32));
-       ilink2 = iwl_legacy_read_targ_mem(priv, base + 6 * sizeof(u32));
-       data1 = iwl_legacy_read_targ_mem(priv, base + 7 * sizeof(u32));
-       data2 = iwl_legacy_read_targ_mem(priv, base + 8 * sizeof(u32));
-       line = iwl_legacy_read_targ_mem(priv, base + 9 * sizeof(u32));
-       time = iwl_legacy_read_targ_mem(priv, base + 11 * sizeof(u32));
-       hcmd = iwl_legacy_read_targ_mem(priv, base + 22 * sizeof(u32));
-
-       trace_iwlwifi_legacy_dev_ucode_error(priv, desc,
-                                       time, data1, data2, line,
-                                     blink1, blink2, ilink1, ilink2);
-
-       IWL_ERR(priv, "Desc                                  Time       "
+               IL_ERR("Start IWL Error Log Dump:\n");
+               IL_ERR("Status: 0x%08lX, count: %d\n",
+                       il->status, count);
+       }
+
+       desc = il_read_targ_mem(il, base + 1 * sizeof(u32));
+       il->isr_stats.err_code = desc;
+       pc = il_read_targ_mem(il, base + 2 * sizeof(u32));
+       blink1 = il_read_targ_mem(il, base + 3 * sizeof(u32));
+       blink2 = il_read_targ_mem(il, base + 4 * sizeof(u32));
+       ilink1 = il_read_targ_mem(il, base + 5 * sizeof(u32));
+       ilink2 = il_read_targ_mem(il, base + 6 * sizeof(u32));
+       data1 = il_read_targ_mem(il, base + 7 * sizeof(u32));
+       data2 = il_read_targ_mem(il, base + 8 * sizeof(u32));
+       line = il_read_targ_mem(il, base + 9 * sizeof(u32));
+       time = il_read_targ_mem(il, base + 11 * sizeof(u32));
+       hcmd = il_read_targ_mem(il, base + 22 * sizeof(u32));
+
+       IL_ERR("Desc                                  Time       "
                "data1      data2      line\n");
-       IWL_ERR(priv, "%-28s (0x%04X) %010u 0x%08X 0x%08X %u\n",
-               iwl4965_desc_lookup(desc), desc, time, data1, data2, line);
-       IWL_ERR(priv, "pc      blink1  blink2  ilink1  ilink2  hcmd\n");
-       IWL_ERR(priv, "0x%05X 0x%05X 0x%05X 0x%05X 0x%05X 0x%05X\n",
+       IL_ERR("%-28s (0x%04X) %010u 0x%08X 0x%08X %u\n",
+               il4965_desc_lookup(desc), desc, time, data1, data2, line);
+       IL_ERR("pc      blink1  blink2  ilink1  ilink2  hcmd\n");
+       IL_ERR("0x%05X 0x%05X 0x%05X 0x%05X 0x%05X 0x%05X\n",
                pc, blink1, blink2, ilink1, ilink2, hcmd);
 }
 
-static void iwl4965_rf_kill_ct_config(struct iwl_priv *priv)
+static void il4965_rf_kill_ct_config(struct il_priv *il)
 {
-       struct iwl_ct_kill_config cmd;
+       struct il_ct_kill_config cmd;
        unsigned long flags;
        int ret = 0;
 
-       spin_lock_irqsave(&priv->lock, flags);
-       iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR,
+       spin_lock_irqsave(&il->lock, flags);
+       _il_wr(il, CSR_UCODE_DRV_GP1_CLR,
                    CSR_UCODE_DRV_GP1_REG_BIT_CT_KILL_EXIT);
-       spin_unlock_irqrestore(&priv->lock, flags);
+       spin_unlock_irqrestore(&il->lock, flags);
 
        cmd.critical_temperature_R =
-               cpu_to_le32(priv->hw_params.ct_kill_threshold);
+               cpu_to_le32(il->hw_params.ct_kill_threshold);
 
-       ret = iwl_legacy_send_cmd_pdu(priv, REPLY_CT_KILL_CONFIG_CMD,
+       ret = il_send_cmd_pdu(il, REPLY_CT_KILL_CONFIG_CMD,
                               sizeof(cmd), &cmd);
        if (ret)
-               IWL_ERR(priv, "REPLY_CT_KILL_CONFIG_CMD failed\n");
+               IL_ERR("REPLY_CT_KILL_CONFIG_CMD failed\n");
        else
-               IWL_DEBUG_INFO(priv, "REPLY_CT_KILL_CONFIG_CMD "
+               D_INFO("REPLY_CT_KILL_CONFIG_CMD "
                                "succeeded, "
                                "critical temperature is %d\n",
-                               priv->hw_params.ct_kill_threshold);
+                               il->hw_params.ct_kill_threshold);
 }
 
 static const s8 default_queue_to_tx_fifo[] = {
-       IWL_TX_FIFO_VO,
-       IWL_TX_FIFO_VI,
-       IWL_TX_FIFO_BE,
-       IWL_TX_FIFO_BK,
-       IWL49_CMD_FIFO_NUM,
-       IWL_TX_FIFO_UNUSED,
-       IWL_TX_FIFO_UNUSED,
+       IL_TX_FIFO_VO,
+       IL_TX_FIFO_VI,
+       IL_TX_FIFO_BE,
+       IL_TX_FIFO_BK,
+       IL49_CMD_FIFO_NUM,
+       IL_TX_FIFO_UNUSED,
+       IL_TX_FIFO_UNUSED,
 };
 
-static int iwl4965_alive_notify(struct iwl_priv *priv)
+static int il4965_alive_notify(struct il_priv *il)
 {
        u32 a;
        unsigned long flags;
        int i, chan;
        u32 reg_val;
 
-       spin_lock_irqsave(&priv->lock, flags);
+       spin_lock_irqsave(&il->lock, flags);
 
        /* Clear 4965's internal Tx Scheduler data base */
-       priv->scd_base_addr = iwl_legacy_read_prph(priv,
-                                       IWL49_SCD_SRAM_BASE_ADDR);
-       a = priv->scd_base_addr + IWL49_SCD_CONTEXT_DATA_OFFSET;
-       for (; a < priv->scd_base_addr + IWL49_SCD_TX_STTS_BITMAP_OFFSET; a += 4)
-               iwl_legacy_write_targ_mem(priv, a, 0);
-       for (; a < priv->scd_base_addr + IWL49_SCD_TRANSLATE_TBL_OFFSET; a += 4)
-               iwl_legacy_write_targ_mem(priv, a, 0);
-       for (; a < priv->scd_base_addr +
-              IWL49_SCD_TRANSLATE_TBL_OFFSET_QUEUE(priv->hw_params.max_txq_num); a += 4)
-               iwl_legacy_write_targ_mem(priv, a, 0);
+       il->scd_base_addr = il_rd_prph(il,
+                                       IL49_SCD_SRAM_BASE_ADDR);
+       a = il->scd_base_addr + IL49_SCD_CONTEXT_DATA_OFFSET;
+       for (; a < il->scd_base_addr + IL49_SCD_TX_STTS_BITMAP_OFFSET; a += 4)
+               il_write_targ_mem(il, a, 0);
+       for (; a < il->scd_base_addr + IL49_SCD_TRANSLATE_TBL_OFFSET; a += 4)
+               il_write_targ_mem(il, a, 0);
+       for (; a < il->scd_base_addr +
+              IL49_SCD_TRANSLATE_TBL_OFFSET_QUEUE(il->hw_params.max_txq_num); a += 4)
+               il_write_targ_mem(il, a, 0);
 
        /* Tel 4965 where to find Tx byte count tables */
-       iwl_legacy_write_prph(priv, IWL49_SCD_DRAM_BASE_ADDR,
-                       priv->scd_bc_tbls.dma >> 10);
+       il_wr_prph(il, IL49_SCD_DRAM_BASE_ADDR,
+                       il->scd_bc_tbls.dma >> 10);
 
        /* Enable DMA channel */
        for (chan = 0; chan < FH49_TCSR_CHNL_NUM ; chan++)
-               iwl_legacy_write_direct32(priv,
+               il_wr(il,
                                FH_TCSR_CHNL_TX_CONFIG_REG(chan),
                                FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE |
                                FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_ENABLE);
 
        /* Update FH chicken bits */
-       reg_val = iwl_legacy_read_direct32(priv, FH_TX_CHICKEN_BITS_REG);
-       iwl_legacy_write_direct32(priv, FH_TX_CHICKEN_BITS_REG,
+       reg_val = il_rd(il, FH_TX_CHICKEN_BITS_REG);
+       il_wr(il, FH_TX_CHICKEN_BITS_REG,
                           reg_val | FH_TX_CHICKEN_BITS_SCD_AUTO_RETRY_EN);
 
        /* Disable chain mode for all queues */
-       iwl_legacy_write_prph(priv, IWL49_SCD_QUEUECHAIN_SEL, 0);
+       il_wr_prph(il, IL49_SCD_QUEUECHAIN_SEL, 0);
 
        /* Initialize each Tx queue (including the command queue) */
-       for (i = 0; i < priv->hw_params.max_txq_num; i++) {
+       for (i = 0; i < il->hw_params.max_txq_num; i++) {
 
-               /* TFD circular buffer read/write indexes */
-               iwl_legacy_write_prph(priv, IWL49_SCD_QUEUE_RDPTR(i), 0);
-               iwl_legacy_write_direct32(priv, HBUS_TARG_WRPTR, 0 | (i << 8));
+               /* TFD circular buffer read/write idxes */
+               il_wr_prph(il, IL49_SCD_QUEUE_RDPTR(i), 0);
+               il_wr(il, HBUS_TARG_WRPTR, 0 | (i << 8));
 
                /* Max Tx Window size for Scheduler-ACK mode */
-               iwl_legacy_write_targ_mem(priv, priv->scd_base_addr +
-                               IWL49_SCD_CONTEXT_QUEUE_OFFSET(i),
+               il_write_targ_mem(il, il->scd_base_addr +
+                               IL49_SCD_CONTEXT_QUEUE_OFFSET(i),
                                (SCD_WIN_SIZE <<
-                               IWL49_SCD_QUEUE_CTX_REG1_WIN_SIZE_POS) &
-                               IWL49_SCD_QUEUE_CTX_REG1_WIN_SIZE_MSK);
+                               IL49_SCD_QUEUE_CTX_REG1_WIN_SIZE_POS) &
+                               IL49_SCD_QUEUE_CTX_REG1_WIN_SIZE_MSK);
 
                /* Frame limit */
-               iwl_legacy_write_targ_mem(priv, priv->scd_base_addr +
-                               IWL49_SCD_CONTEXT_QUEUE_OFFSET(i) +
+               il_write_targ_mem(il, il->scd_base_addr +
+                               IL49_SCD_CONTEXT_QUEUE_OFFSET(i) +
                                sizeof(u32),
                                (SCD_FRAME_LIMIT <<
-                               IWL49_SCD_QUEUE_CTX_REG2_FRAME_LIMIT_POS) &
-                               IWL49_SCD_QUEUE_CTX_REG2_FRAME_LIMIT_MSK);
+                               IL49_SCD_QUEUE_CTX_REG2_FRAME_LIMIT_POS) &
+                               IL49_SCD_QUEUE_CTX_REG2_FRAME_LIMIT_MSK);
 
        }
-       iwl_legacy_write_prph(priv, IWL49_SCD_INTERRUPT_MASK,
-                                (1 << priv->hw_params.max_txq_num) - 1);
+       il_wr_prph(il, IL49_SCD_INTERRUPT_MASK,
+                                (1 << il->hw_params.max_txq_num) - 1);
 
        /* Activate all Tx DMA/FIFO channels */
-       iwl4965_txq_set_sched(priv, IWL_MASK(0, 6));
+       il4965_txq_set_sched(il, IL_MASK(0, 6));
 
-       iwl4965_set_wr_ptrs(priv, IWL_DEFAULT_CMD_QUEUE_NUM, 0);
+       il4965_set_wr_ptrs(il, IL_DEFAULT_CMD_QUEUE_NUM, 0);
 
        /* make sure all queue are not stopped */
-       memset(&priv->queue_stopped[0], 0, sizeof(priv->queue_stopped));
+       memset(&il->queue_stopped[0], 0, sizeof(il->queue_stopped));
        for (i = 0; i < 4; i++)
-               atomic_set(&priv->queue_stop_count[i], 0);
+               atomic_set(&il->queue_stop_count[i], 0);
 
        /* reset to 0 to enable all the queue first */
-       priv->txq_ctx_active_msk = 0;
+       il->txq_ctx_active_msk = 0;
        /* Map each Tx/cmd queue to its corresponding fifo */
        BUILD_BUG_ON(ARRAY_SIZE(default_queue_to_tx_fifo) != 7);
 
        for (i = 0; i < ARRAY_SIZE(default_queue_to_tx_fifo); i++) {
                int ac = default_queue_to_tx_fifo[i];
 
-               iwl_txq_ctx_activate(priv, i);
+               il_txq_ctx_activate(il, i);
 
-               if (ac == IWL_TX_FIFO_UNUSED)
+               if (ac == IL_TX_FIFO_UNUSED)
                        continue;
 
-               iwl4965_tx_queue_set_status(priv, &priv->txq[i], ac, 0);
+               il4965_tx_queue_set_status(il, &il->txq[i], ac, 0);
        }
 
-       spin_unlock_irqrestore(&priv->lock, flags);
+       spin_unlock_irqrestore(&il->lock, flags);
 
        return 0;
 }
 
 /**
- * iwl4965_alive_start - called after REPLY_ALIVE notification received
+ * il4965_alive_start - called after REPLY_ALIVE notification received
  *                   from protocol/runtime uCode (initialization uCode's
- *                   Alive gets handled by iwl_init_alive_start()).
+ *                   Alive gets handled by il_init_alive_start()).
  */
-static void iwl4965_alive_start(struct iwl_priv *priv)
+static void il4965_alive_start(struct il_priv *il)
 {
        int ret = 0;
-       struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];
+       struct il_rxon_context *ctx = &il->ctx;
 
-       IWL_DEBUG_INFO(priv, "Runtime Alive received.\n");
+       D_INFO("Runtime Alive received.\n");
 
-       if (priv->card_alive.is_valid != UCODE_VALID_OK) {
+       if (il->card_alive.is_valid != UCODE_VALID_OK) {
                /* We had an error bringing up the hardware, so take it
                 * all the way back down so we can try again */
-               IWL_DEBUG_INFO(priv, "Alive failed.\n");
+               D_INFO("Alive failed.\n");
                goto restart;
        }
 
        /* Initialize uCode has loaded Runtime uCode ... verify inst image.
         * This is a paranoid check, because we would not have gotten the
         * "runtime" alive if code weren't properly loaded.  */
-       if (iwl4965_verify_ucode(priv)) {
+       if (il4965_verify_ucode(il)) {
                /* Runtime instruction load was bad;
                 * take it all the way back down so we can try again */
-               IWL_DEBUG_INFO(priv, "Bad runtime uCode load.\n");
+               D_INFO("Bad runtime uCode load.\n");
                goto restart;
        }
 
-       ret = iwl4965_alive_notify(priv);
+       ret = il4965_alive_notify(il);
        if (ret) {
-               IWL_WARN(priv,
+               IL_WARN(
                        "Could not complete ALIVE transition [ntf]: %d\n", ret);
                goto restart;
        }
 
 
        /* After the ALIVE response, we can send host commands to the uCode */
-       set_bit(STATUS_ALIVE, &priv->status);
+       set_bit(STATUS_ALIVE, &il->status);
 
        /* Enable watchdog to monitor the driver tx queues */
-       iwl_legacy_setup_watchdog(priv);
+       il_setup_watchdog(il);
 
-       if (iwl_legacy_is_rfkill(priv))
+       if (il_is_rfkill(il))
                return;
 
-       ieee80211_wake_queues(priv->hw);
+       ieee80211_wake_queues(il->hw);
 
-       priv->active_rate = IWL_RATES_MASK;
+       il->active_rate = RATES_MASK;
 
-       if (iwl_legacy_is_associated_ctx(ctx)) {
-               struct iwl_legacy_rxon_cmd *active_rxon =
-                               (struct iwl_legacy_rxon_cmd *)&ctx->active;
+       if (il_is_associated_ctx(ctx)) {
+               struct il_rxon_cmd *active_rxon =
+                               (struct il_rxon_cmd *)&ctx->active;
                /* apply any changes in staging */
                ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK;
                active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK;
        } else {
-               struct iwl_rxon_context *tmp;
                /* Initialize our rx_config data */
-               for_each_context(priv, tmp)
-                       iwl_legacy_connection_init_rx_config(priv, tmp);
+               il_connection_init_rx_config(il, &il->ctx);
 
-               if (priv->cfg->ops->hcmd->set_rxon_chain)
-                       priv->cfg->ops->hcmd->set_rxon_chain(priv, ctx);
+               if (il->cfg->ops->hcmd->set_rxon_chain)
+                       il->cfg->ops->hcmd->set_rxon_chain(il, ctx);
        }
 
        /* Configure bluetooth coexistence if enabled */
-       iwl_legacy_send_bt_config(priv);
+       il_send_bt_config(il);
 
-       iwl4965_reset_run_time_calib(priv);
+       il4965_reset_run_time_calib(il);
 
-       set_bit(STATUS_READY, &priv->status);
+       set_bit(STATUS_READY, &il->status);
 
        /* Configure the adapter for unassociated operation */
-       iwl_legacy_commit_rxon(priv, ctx);
+       il_commit_rxon(il, ctx);
 
        /* At this point, the NIC is initialized and operational */
-       iwl4965_rf_kill_ct_config(priv);
+       il4965_rf_kill_ct_config(il);
 
-       IWL_DEBUG_INFO(priv, "ALIVE processing complete.\n");
-       wake_up(&priv->wait_command_queue);
+       D_INFO("ALIVE processing complete.\n");
+       wake_up(&il->wait_command_queue);
 
-       iwl_legacy_power_update_mode(priv, true);
-       IWL_DEBUG_INFO(priv, "Updated power mode\n");
+       il_power_update_mode(il, true);
+       D_INFO("Updated power mode\n");
 
        return;
 
  restart:
-       queue_work(priv->workqueue, &priv->restart);
+       queue_work(il->workqueue, &il->restart);
 }
 
-static void iwl4965_cancel_deferred_work(struct iwl_priv *priv);
+static void il4965_cancel_deferred_work(struct il_priv *il);
 
-static void __iwl4965_down(struct iwl_priv *priv)
+static void __il4965_down(struct il_priv *il)
 {
        unsigned long flags;
        int exit_pending;
 
-       IWL_DEBUG_INFO(priv, DRV_NAME " is going down\n");
+       D_INFO(DRV_NAME " is going down\n");
 
-       iwl_legacy_scan_cancel_timeout(priv, 200);
+       il_scan_cancel_timeout(il, 200);
 
-       exit_pending = test_and_set_bit(STATUS_EXIT_PENDING, &priv->status);
+       exit_pending = test_and_set_bit(STATUS_EXIT_PENDING, &il->status);
 
        /* Stop TX queues watchdog. We need to have STATUS_EXIT_PENDING bit set
         * to prevent rearm timer */
-       del_timer_sync(&priv->watchdog);
+       del_timer_sync(&il->watchdog);
 
-       iwl_legacy_clear_ucode_stations(priv, NULL);
-       iwl_legacy_dealloc_bcast_stations(priv);
-       iwl_legacy_clear_driver_stations(priv);
+       il_clear_ucode_stations(il, NULL);
+       il_dealloc_bcast_stations(il);
+       il_clear_driver_stations(il);
 
        /* Unblock any waiting calls */
-       wake_up_all(&priv->wait_command_queue);
+       wake_up_all(&il->wait_command_queue);
 
        /* Wipe out the EXIT_PENDING status bit if we are not actually
         * exiting the module */
        if (!exit_pending)
-               clear_bit(STATUS_EXIT_PENDING, &priv->status);
+               clear_bit(STATUS_EXIT_PENDING, &il->status);
 
        /* stop and reset the on-board processor */
-       iwl_write32(priv, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET);
+       _il_wr(il, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET);
 
        /* tell the device to stop sending interrupts */
-       spin_lock_irqsave(&priv->lock, flags);
-       iwl_legacy_disable_interrupts(priv);
-       spin_unlock_irqrestore(&priv->lock, flags);
-       iwl4965_synchronize_irq(priv);
+       spin_lock_irqsave(&il->lock, flags);
+       il_disable_interrupts(il);
+       spin_unlock_irqrestore(&il->lock, flags);
+       il4965_synchronize_irq(il);
 
-       if (priv->mac80211_registered)
-               ieee80211_stop_queues(priv->hw);
+       if (il->mac80211_registered)
+               ieee80211_stop_queues(il->hw);
 
-       /* If we have not previously called iwl_init() then
+       /* If we have not previously called il_init() then
         * clear all bits but the RF Kill bit and return */
-       if (!iwl_legacy_is_init(priv)) {
-               priv->status = test_bit(STATUS_RF_KILL_HW, &priv->status) <<
+       if (!il_is_init(il)) {
+               il->status = test_bit(STATUS_RF_KILL_HW, &il->status) <<
                                        STATUS_RF_KILL_HW |
-                              test_bit(STATUS_GEO_CONFIGURED, &priv->status) <<
+                              test_bit(STATUS_GEO_CONFIGURED, &il->status) <<
                                        STATUS_GEO_CONFIGURED |
-                              test_bit(STATUS_EXIT_PENDING, &priv->status) <<
+                              test_bit(STATUS_EXIT_PENDING, &il->status) <<
                                        STATUS_EXIT_PENDING;
                goto exit;
        }
 
        /* ...otherwise clear out all the status bits but the RF Kill
         * bit and continue taking the NIC down. */
-       priv->status &= test_bit(STATUS_RF_KILL_HW, &priv->status) <<
+       il->status &= test_bit(STATUS_RF_KILL_HW, &il->status) <<
                                STATUS_RF_KILL_HW |
-                       test_bit(STATUS_GEO_CONFIGURED, &priv->status) <<
+                       test_bit(STATUS_GEO_CONFIGURED, &il->status) <<
                                STATUS_GEO_CONFIGURED |
-                       test_bit(STATUS_FW_ERROR, &priv->status) <<
+                       test_bit(STATUS_FW_ERROR, &il->status) <<
                                STATUS_FW_ERROR |
-                      test_bit(STATUS_EXIT_PENDING, &priv->status) <<
+                      test_bit(STATUS_EXIT_PENDING, &il->status) <<
                                STATUS_EXIT_PENDING;
 
-       iwl4965_txq_ctx_stop(priv);
-       iwl4965_rxq_stop(priv);
+       il4965_txq_ctx_stop(il);
+       il4965_rxq_stop(il);
 
        /* Power-down device's busmaster DMA clocks */
-       iwl_legacy_write_prph(priv, APMG_CLK_DIS_REG, APMG_CLK_VAL_DMA_CLK_RQT);
+       il_wr_prph(il, APMG_CLK_DIS_REG, APMG_CLK_VAL_DMA_CLK_RQT);
        udelay(5);
 
        /* Make sure (redundant) we've released our request to stay awake */
-       iwl_legacy_clear_bit(priv, CSR_GP_CNTRL,
+       il_clear_bit(il, CSR_GP_CNTRL,
                                CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
 
        /* Stop the device, and put it in low power state */
-       iwl_legacy_apm_stop(priv);
+       il_apm_stop(il);
 
  exit:
-       memset(&priv->card_alive, 0, sizeof(struct iwl_alive_resp));
+       memset(&il->card_alive, 0, sizeof(struct il_alive_resp));
 
-       dev_kfree_skb(priv->beacon_skb);
-       priv->beacon_skb = NULL;
+       dev_kfree_skb(il->beacon_skb);
+       il->beacon_skb = NULL;
 
        /* clear out any free frames */
-       iwl4965_clear_free_frames(priv);
+       il4965_clear_free_frames(il);
 }
 
-static void iwl4965_down(struct iwl_priv *priv)
+static void il4965_down(struct il_priv *il)
 {
-       mutex_lock(&priv->mutex);
-       __iwl4965_down(priv);
-       mutex_unlock(&priv->mutex);
+       mutex_lock(&il->mutex);
+       __il4965_down(il);
+       mutex_unlock(&il->mutex);
 
-       iwl4965_cancel_deferred_work(priv);
+       il4965_cancel_deferred_work(il);
 }
 
 #define HW_READY_TIMEOUT (50)
 
-static int iwl4965_set_hw_ready(struct iwl_priv *priv)
+static int il4965_set_hw_ready(struct il_priv *il)
 {
        int ret = 0;
 
-       iwl_legacy_set_bit(priv, CSR_HW_IF_CONFIG_REG,
+       il_set_bit(il, CSR_HW_IF_CONFIG_REG,
                CSR_HW_IF_CONFIG_REG_BIT_NIC_READY);
 
        /* See if we got it */
-       ret = iwl_poll_bit(priv, CSR_HW_IF_CONFIG_REG,
+       ret = _il_poll_bit(il, CSR_HW_IF_CONFIG_REG,
                                CSR_HW_IF_CONFIG_REG_BIT_NIC_READY,
                                CSR_HW_IF_CONFIG_REG_BIT_NIC_READY,
                                HW_READY_TIMEOUT);
        if (ret != -ETIMEDOUT)
-               priv->hw_ready = true;
+               il->hw_ready = true;
        else
-               priv->hw_ready = false;
+               il->hw_ready = false;
 
-       IWL_DEBUG_INFO(priv, "hardware %s\n",
-                     (priv->hw_ready == 1) ? "ready" : "not ready");
+       D_INFO("hardware %s\n",
+                     (il->hw_ready == 1) ? "ready" : "not ready");
        return ret;
 }
 
-static int iwl4965_prepare_card_hw(struct iwl_priv *priv)
+static int il4965_prepare_card_hw(struct il_priv *il)
 {
        int ret = 0;
 
-       IWL_DEBUG_INFO(priv, "iwl4965_prepare_card_hw enter\n");
+       D_INFO("il4965_prepare_card_hw enter\n");
 
-       ret = iwl4965_set_hw_ready(priv);
-       if (priv->hw_ready)
+       ret = il4965_set_hw_ready(il);
+       if (il->hw_ready)
                return ret;
 
        /* If HW is not ready, prepare the conditions to check again */
-       iwl_legacy_set_bit(priv, CSR_HW_IF_CONFIG_REG,
+       il_set_bit(il, CSR_HW_IF_CONFIG_REG,
                        CSR_HW_IF_CONFIG_REG_PREPARE);
 
-       ret = iwl_poll_bit(priv, CSR_HW_IF_CONFIG_REG,
+       ret = _il_poll_bit(il, CSR_HW_IF_CONFIG_REG,
                        ~CSR_HW_IF_CONFIG_REG_BIT_NIC_PREPARE_DONE,
                        CSR_HW_IF_CONFIG_REG_BIT_NIC_PREPARE_DONE, 150000);
 
        /* HW should be ready by now, check again. */
        if (ret != -ETIMEDOUT)
-               iwl4965_set_hw_ready(priv);
+               il4965_set_hw_ready(il);
 
        return ret;
 }
 
 #define MAX_HW_RESTARTS 5
 
-static int __iwl4965_up(struct iwl_priv *priv)
+static int __il4965_up(struct il_priv *il)
 {
-       struct iwl_rxon_context *ctx;
        int i;
        int ret;
 
-       if (test_bit(STATUS_EXIT_PENDING, &priv->status)) {
-               IWL_WARN(priv, "Exit pending; will not bring the NIC up\n");
+       if (test_bit(STATUS_EXIT_PENDING, &il->status)) {
+               IL_WARN("Exit pending; will not bring the NIC up\n");
                return -EIO;
        }
 
-       if (!priv->ucode_data_backup.v_addr || !priv->ucode_data.v_addr) {
-               IWL_ERR(priv, "ucode not available for device bringup\n");
+       if (!il->ucode_data_backup.v_addr || !il->ucode_data.v_addr) {
+               IL_ERR("ucode not available for device bringup\n");
                return -EIO;
        }
 
-       for_each_context(priv, ctx) {
-               ret = iwl4965_alloc_bcast_station(priv, ctx);
-               if (ret) {
-                       iwl_legacy_dealloc_bcast_stations(priv);
-                       return ret;
-               }
+       ret = il4965_alloc_bcast_station(il, &il->ctx);
+       if (ret) {
+               il_dealloc_bcast_stations(il);
+               return ret;
        }
 
-       iwl4965_prepare_card_hw(priv);
+       il4965_prepare_card_hw(il);
 
-       if (!priv->hw_ready) {
-               IWL_WARN(priv, "Exit HW not ready\n");
+       if (!il->hw_ready) {
+               IL_WARN("Exit HW not ready\n");
                return -EIO;
        }
 
        /* If platform's RF_KILL switch is NOT set to KILL */
-       if (iwl_read32(priv,
+       if (_il_rd(il,
                CSR_GP_CNTRL) & CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW)
-               clear_bit(STATUS_RF_KILL_HW, &priv->status);
+               clear_bit(STATUS_RF_KILL_HW, &il->status);
        else
-               set_bit(STATUS_RF_KILL_HW, &priv->status);
+               set_bit(STATUS_RF_KILL_HW, &il->status);
 
-       if (iwl_legacy_is_rfkill(priv)) {
-               wiphy_rfkill_set_hw_state(priv->hw->wiphy, true);
+       if (il_is_rfkill(il)) {
+               wiphy_rfkill_set_hw_state(il->hw->wiphy, true);
 
-               iwl_legacy_enable_interrupts(priv);
-               IWL_WARN(priv, "Radio disabled by HW RF Kill switch\n");
+               il_enable_interrupts(il);
+               IL_WARN("Radio disabled by HW RF Kill switch\n");
                return 0;
        }
 
-       iwl_write32(priv, CSR_INT, 0xFFFFFFFF);
+       _il_wr(il, CSR_INT, 0xFFFFFFFF);
 
-       /* must be initialised before iwl_hw_nic_init */
-       priv->cmd_queue = IWL_DEFAULT_CMD_QUEUE_NUM;
+       /* must be initialised before il_hw_nic_init */
+       il->cmd_queue = IL_DEFAULT_CMD_QUEUE_NUM;
 
-       ret = iwl4965_hw_nic_init(priv);
+       ret = il4965_hw_nic_init(il);
        if (ret) {
-               IWL_ERR(priv, "Unable to init nic\n");
+               IL_ERR("Unable to init nic\n");
                return ret;
        }
 
        /* make sure rfkill handshake bits are cleared */
-       iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL);
-       iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR,
+       _il_wr(il, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL);
+       _il_wr(il, CSR_UCODE_DRV_GP1_CLR,
                    CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED);
 
        /* clear (again), then enable host interrupts */
-       iwl_write32(priv, CSR_INT, 0xFFFFFFFF);
-       iwl_legacy_enable_interrupts(priv);
+       _il_wr(il, CSR_INT, 0xFFFFFFFF);
+       il_enable_interrupts(il);
 
        /* really make sure rfkill handshake bits are cleared */
-       iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL);
-       iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL);
+       _il_wr(il, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL);
+       _il_wr(il, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL);
 
        /* Copy original ucode data image from disk into backup cache.
         * This will be used to initialize the on-board processor's
         * data SRAM for a clean start when the runtime program first loads. */
-       memcpy(priv->ucode_data_backup.v_addr, priv->ucode_data.v_addr,
-              priv->ucode_data.len);
+       memcpy(il->ucode_data_backup.v_addr, il->ucode_data.v_addr,
+              il->ucode_data.len);
 
        for (i = 0; i < MAX_HW_RESTARTS; i++) {
 
                /* load bootstrap state machine,
                 * load bootstrap program into processor's memory,
                 * prepare to load the "initialize" uCode */
-               ret = priv->cfg->ops->lib->load_ucode(priv);
+               ret = il->cfg->ops->lib->load_ucode(il);
 
                if (ret) {
-                       IWL_ERR(priv, "Unable to set up bootstrap uCode: %d\n",
+                       IL_ERR("Unable to set up bootstrap uCode: %d\n",
                                ret);
                        continue;
                }
 
                /* start card; "initialize" will load runtime ucode */
-               iwl4965_nic_start(priv);
+               il4965_nic_start(il);
 
-               IWL_DEBUG_INFO(priv, DRV_NAME " is coming up\n");
+               D_INFO(DRV_NAME " is coming up\n");
 
                return 0;
        }
 
-       set_bit(STATUS_EXIT_PENDING, &priv->status);
-       __iwl4965_down(priv);
-       clear_bit(STATUS_EXIT_PENDING, &priv->status);
+       set_bit(STATUS_EXIT_PENDING, &il->status);
+       __il4965_down(il);
+       clear_bit(STATUS_EXIT_PENDING, &il->status);
 
        /* tried to restart and config the device for as long as our
         * patience could withstand */
-       IWL_ERR(priv, "Unable to initialize device after %d attempts.\n", i);
+       IL_ERR("Unable to initialize device after %d attempts.\n", i);
        return -EIO;
 }
 
@@ -2067,102 +2053,99 @@ static int __iwl4965_up(struct iwl_priv *priv)
  *
  *****************************************************************************/
 
-static void iwl4965_bg_init_alive_start(struct work_struct *data)
+static void il4965_bg_init_alive_start(struct work_struct *data)
 {
-       struct iwl_priv *priv =
-           container_of(data, struct iwl_priv, init_alive_start.work);
+       struct il_priv *il =
+           container_of(data, struct il_priv, init_alive_start.work);
 
-       mutex_lock(&priv->mutex);
-       if (test_bit(STATUS_EXIT_PENDING, &priv->status))
+       mutex_lock(&il->mutex);
+       if (test_bit(STATUS_EXIT_PENDING, &il->status))
                goto out;
 
-       priv->cfg->ops->lib->init_alive_start(priv);
+       il->cfg->ops->lib->init_alive_start(il);
 out:
-       mutex_unlock(&priv->mutex);
+       mutex_unlock(&il->mutex);
 }
 
-static void iwl4965_bg_alive_start(struct work_struct *data)
+static void il4965_bg_alive_start(struct work_struct *data)
 {
-       struct iwl_priv *priv =
-           container_of(data, struct iwl_priv, alive_start.work);
+       struct il_priv *il =
+           container_of(data, struct il_priv, alive_start.work);
 
-       mutex_lock(&priv->mutex);
-       if (test_bit(STATUS_EXIT_PENDING, &priv->status))
+       mutex_lock(&il->mutex);
+       if (test_bit(STATUS_EXIT_PENDING, &il->status))
                goto out;
 
-       iwl4965_alive_start(priv);
+       il4965_alive_start(il);
 out:
-       mutex_unlock(&priv->mutex);
+       mutex_unlock(&il->mutex);
 }
 
-static void iwl4965_bg_run_time_calib_work(struct work_struct *work)
+static void il4965_bg_run_time_calib_work(struct work_struct *work)
 {
-       struct iwl_priv *priv = container_of(work, struct iwl_priv,
+       struct il_priv *il = container_of(work, struct il_priv,
                        run_time_calib_work);
 
-       mutex_lock(&priv->mutex);
+       mutex_lock(&il->mutex);
 
-       if (test_bit(STATUS_EXIT_PENDING, &priv->status) ||
-           test_bit(STATUS_SCANNING, &priv->status)) {
-               mutex_unlock(&priv->mutex);
+       if (test_bit(STATUS_EXIT_PENDING, &il->status) ||
+           test_bit(STATUS_SCANNING, &il->status)) {
+               mutex_unlock(&il->mutex);
                return;
        }
 
-       if (priv->start_calib) {
-               iwl4965_chain_noise_calibration(priv,
-                               (void *)&priv->_4965.statistics);
-               iwl4965_sensitivity_calibration(priv,
-                               (void *)&priv->_4965.statistics);
+       if (il->start_calib) {
+               il4965_chain_noise_calibration(il,
+                               (void *)&il->_4965.stats);
+               il4965_sensitivity_calibration(il,
+                               (void *)&il->_4965.stats);
        }
 
-       mutex_unlock(&priv->mutex);
+       mutex_unlock(&il->mutex);
 }
 
-static void iwl4965_bg_restart(struct work_struct *data)
+static void il4965_bg_restart(struct work_struct *data)
 {
-       struct iwl_priv *priv = container_of(data, struct iwl_priv, restart);
+       struct il_priv *il = container_of(data, struct il_priv, restart);
 
-       if (test_bit(STATUS_EXIT_PENDING, &priv->status))
+       if (test_bit(STATUS_EXIT_PENDING, &il->status))
                return;
 
-       if (test_and_clear_bit(STATUS_FW_ERROR, &priv->status)) {
-               struct iwl_rxon_context *ctx;
-
-               mutex_lock(&priv->mutex);
-               for_each_context(priv, ctx)
-                       ctx->vif = NULL;
-               priv->is_open = 0;
+       if (test_and_clear_bit(STATUS_FW_ERROR, &il->status)) {
+               mutex_lock(&il->mutex);
+               il->ctx.vif = NULL;
+               il->is_open = 0;
 
-               __iwl4965_down(priv);
+               __il4965_down(il);
 
-               mutex_unlock(&priv->mutex);
-               iwl4965_cancel_deferred_work(priv);
-               ieee80211_restart_hw(priv->hw);
+               mutex_unlock(&il->mutex);
+               il4965_cancel_deferred_work(il);
+               ieee80211_restart_hw(il->hw);
        } else {
-               iwl4965_down(priv);
+               il4965_down(il);
 
-               mutex_lock(&priv->mutex);
-               if (test_bit(STATUS_EXIT_PENDING, &priv->status)) {
-                       mutex_unlock(&priv->mutex);
+               mutex_lock(&il->mutex);
+               if (test_bit(STATUS_EXIT_PENDING, &il->status)) {
+                       mutex_unlock(&il->mutex);
                        return;
                }
 
-               __iwl4965_up(priv);
-               mutex_unlock(&priv->mutex);
+               __il4965_up(il);
+               mutex_unlock(&il->mutex);
        }
 }
 
-static void iwl4965_bg_rx_replenish(struct work_struct *data)
+static void il4965_bg_rx_replenish(struct work_struct *data)
 {
-       struct iwl_priv *priv =
-           container_of(data, struct iwl_priv, rx_replenish);
+       struct il_priv *il =
+           container_of(data, struct il_priv, rx_replenish);
 
-       if (test_bit(STATUS_EXIT_PENDING, &priv->status))
+       if (test_bit(STATUS_EXIT_PENDING, &il->status))
                return;
 
-       mutex_lock(&priv->mutex);
-       iwl4965_rx_replenish(priv);
-       mutex_unlock(&priv->mutex);
+       mutex_lock(&il->mutex);
+       il4965_rx_replenish(il);
+       mutex_unlock(&il->mutex);
 }
 
 /*****************************************************************************
@@ -2177,12 +2160,11 @@ static void iwl4965_bg_rx_replenish(struct work_struct *data)
  * Not a mac80211 entry point function, but it fits in with all the
  * other mac80211 functions grouped here.
  */
-static int iwl4965_mac_setup_register(struct iwl_priv *priv,
+static int il4965_mac_setup_register(struct il_priv *il,
                                  u32 max_probe_length)
 {
        int ret;
-       struct ieee80211_hw *hw = priv->hw;
-       struct iwl_rxon_context *ctx;
+       struct ieee80211_hw *hw = il->hw;
 
        hw->rate_control_algorithm = "iwl-4965-rs";
 
@@ -2193,17 +2175,15 @@ static int iwl4965_mac_setup_register(struct iwl_priv *priv,
                    IEEE80211_HW_SPECTRUM_MGMT |
                    IEEE80211_HW_REPORTS_TX_ACK_STATUS;
 
-       if (priv->cfg->sku & IWL_SKU_N)
+       if (il->cfg->sku & IL_SKU_N)
                hw->flags |= IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS |
                             IEEE80211_HW_SUPPORTS_STATIC_SMPS;
 
-       hw->sta_data_size = sizeof(struct iwl_station_priv);
-       hw->vif_data_size = sizeof(struct iwl_vif_priv);
+       hw->sta_data_size = sizeof(struct il_station_priv);
+       hw->vif_data_size = sizeof(struct il_vif_priv);
 
-       for_each_context(priv, ctx) {
-               hw->wiphy->interface_modes |= ctx->interface_modes;
-               hw->wiphy->interface_modes |= ctx->exclusive_interface_modes;
-       }
+       hw->wiphy->interface_modes |= il->ctx.interface_modes;
+       hw->wiphy->interface_modes |= il->ctx.exclusive_interface_modes;
 
        hw->wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY |
                            WIPHY_FLAG_DISABLE_BEACON_HINTS;
@@ -2221,148 +2201,148 @@ static int iwl4965_mac_setup_register(struct iwl_priv *priv,
        /* Default value; 4 EDCA QOS priorities */
        hw->queues = 4;
 
-       hw->max_listen_interval = IWL_CONN_MAX_LISTEN_INTERVAL;
+       hw->max_listen_interval = IL_CONN_MAX_LISTEN_INTERVAL;
 
-       if (priv->bands[IEEE80211_BAND_2GHZ].n_channels)
-               priv->hw->wiphy->bands[IEEE80211_BAND_2GHZ] =
-                       &priv->bands[IEEE80211_BAND_2GHZ];
-       if (priv->bands[IEEE80211_BAND_5GHZ].n_channels)
-               priv->hw->wiphy->bands[IEEE80211_BAND_5GHZ] =
-                       &priv->bands[IEEE80211_BAND_5GHZ];
+       if (il->bands[IEEE80211_BAND_2GHZ].n_channels)
+               il->hw->wiphy->bands[IEEE80211_BAND_2GHZ] =
+                       &il->bands[IEEE80211_BAND_2GHZ];
+       if (il->bands[IEEE80211_BAND_5GHZ].n_channels)
+               il->hw->wiphy->bands[IEEE80211_BAND_5GHZ] =
+                       &il->bands[IEEE80211_BAND_5GHZ];
 
-       iwl_legacy_leds_init(priv);
+       il_leds_init(il);
 
-       ret = ieee80211_register_hw(priv->hw);
+       ret = ieee80211_register_hw(il->hw);
        if (ret) {
-               IWL_ERR(priv, "Failed to register hw (error %d)\n", ret);
+               IL_ERR("Failed to register hw (error %d)\n", ret);
                return ret;
        }
-       priv->mac80211_registered = 1;
+       il->mac80211_registered = 1;
 
        return 0;
 }
 
 
-int iwl4965_mac_start(struct ieee80211_hw *hw)
+int il4965_mac_start(struct ieee80211_hw *hw)
 {
-       struct iwl_priv *priv = hw->priv;
+       struct il_priv *il = hw->priv;
        int ret;
 
-       IWL_DEBUG_MAC80211(priv, "enter\n");
+       D_MAC80211("enter\n");
 
        /* we should be verifying the device is ready to be opened */
-       mutex_lock(&priv->mutex);
-       ret = __iwl4965_up(priv);
-       mutex_unlock(&priv->mutex);
+       mutex_lock(&il->mutex);
+       ret = __il4965_up(il);
+       mutex_unlock(&il->mutex);
 
        if (ret)
                return ret;
 
-       if (iwl_legacy_is_rfkill(priv))
+       if (il_is_rfkill(il))
                goto out;
 
-       IWL_DEBUG_INFO(priv, "Start UP work done.\n");
+       D_INFO("Start UP work done.\n");
 
        /* Wait for START_ALIVE from Run Time ucode. Otherwise callbacks from
         * mac80211 will not be run successfully. */
-       ret = wait_event_timeout(priv->wait_command_queue,
-                       test_bit(STATUS_READY, &priv->status),
+       ret = wait_event_timeout(il->wait_command_queue,
+                       test_bit(STATUS_READY, &il->status),
                        UCODE_READY_TIMEOUT);
        if (!ret) {
-               if (!test_bit(STATUS_READY, &priv->status)) {
-                       IWL_ERR(priv, "START_ALIVE timeout after %dms.\n",
+               if (!test_bit(STATUS_READY, &il->status)) {
+                       IL_ERR("START_ALIVE timeout after %dms.\n",
                                jiffies_to_msecs(UCODE_READY_TIMEOUT));
                        return -ETIMEDOUT;
                }
        }
 
-       iwl4965_led_enable(priv);
+       il4965_led_enable(il);
 
 out:
-       priv->is_open = 1;
-       IWL_DEBUG_MAC80211(priv, "leave\n");
+       il->is_open = 1;
+       D_MAC80211("leave\n");
        return 0;
 }
 
-void iwl4965_mac_stop(struct ieee80211_hw *hw)
+void il4965_mac_stop(struct ieee80211_hw *hw)
 {
-       struct iwl_priv *priv = hw->priv;
+       struct il_priv *il = hw->priv;
 
-       IWL_DEBUG_MAC80211(priv, "enter\n");
+       D_MAC80211("enter\n");
 
-       if (!priv->is_open)
+       if (!il->is_open)
                return;
 
-       priv->is_open = 0;
+       il->is_open = 0;
 
-       iwl4965_down(priv);
+       il4965_down(il);
 
-       flush_workqueue(priv->workqueue);
+       flush_workqueue(il->workqueue);
 
        /* User space software may expect getting rfkill changes
         * even if interface is down */
-       iwl_write32(priv, CSR_INT, 0xFFFFFFFF);
-       iwl_legacy_enable_rfkill_int(priv);
+       _il_wr(il, CSR_INT, 0xFFFFFFFF);
+       il_enable_rfkill_int(il);
 
-       IWL_DEBUG_MAC80211(priv, "leave\n");
+       D_MAC80211("leave\n");
 }
 
-void iwl4965_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
+void il4965_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
 {
-       struct iwl_priv *priv = hw->priv;
+       struct il_priv *il = hw->priv;
 
-       IWL_DEBUG_MACDUMP(priv, "enter\n");
+       D_MACDUMP("enter\n");
 
-       IWL_DEBUG_TX(priv, "dev->xmit(%d bytes) at rate 0x%02x\n", skb->len,
+       D_TX("dev->xmit(%d bytes) at rate 0x%02x\n", skb->len,
                     ieee80211_get_tx_rate(hw, IEEE80211_SKB_CB(skb))->bitrate);
 
-       if (iwl4965_tx_skb(priv, skb))
+       if (il4965_tx_skb(il, skb))
                dev_kfree_skb_any(skb);
 
-       IWL_DEBUG_MACDUMP(priv, "leave\n");
+       D_MACDUMP("leave\n");
 }
 
-void iwl4965_mac_update_tkip_key(struct ieee80211_hw *hw,
+void il4965_mac_update_tkip_key(struct ieee80211_hw *hw,
                                struct ieee80211_vif *vif,
                                struct ieee80211_key_conf *keyconf,
                                struct ieee80211_sta *sta,
                                u32 iv32, u16 *phase1key)
 {
-       struct iwl_priv *priv = hw->priv;
-       struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv;
+       struct il_priv *il = hw->priv;
+       struct il_vif_priv *vif_priv = (void *)vif->drv_priv;
 
-       IWL_DEBUG_MAC80211(priv, "enter\n");
+       D_MAC80211("enter\n");
 
-       iwl4965_update_tkip_key(priv, vif_priv->ctx, keyconf, sta,
+       il4965_update_tkip_key(il, vif_priv->ctx, keyconf, sta,
                            iv32, phase1key);
 
-       IWL_DEBUG_MAC80211(priv, "leave\n");
+       D_MAC80211("leave\n");
 }
 
-int iwl4965_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
+int il4965_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
                       struct ieee80211_vif *vif, struct ieee80211_sta *sta,
                       struct ieee80211_key_conf *key)
 {
-       struct iwl_priv *priv = hw->priv;
-       struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv;
-       struct iwl_rxon_context *ctx = vif_priv->ctx;
+       struct il_priv *il = hw->priv;
+       struct il_vif_priv *vif_priv = (void *)vif->drv_priv;
+       struct il_rxon_context *ctx = vif_priv->ctx;
        int ret;
        u8 sta_id;
        bool is_default_wep_key = false;
 
-       IWL_DEBUG_MAC80211(priv, "enter\n");
+       D_MAC80211("enter\n");
 
-       if (priv->cfg->mod_params->sw_crypto) {
-               IWL_DEBUG_MAC80211(priv, "leave - hwcrypto disabled\n");
+       if (il->cfg->mod_params->sw_crypto) {
+               D_MAC80211("leave - hwcrypto disabled\n");
                return -EOPNOTSUPP;
        }
 
-       sta_id = iwl_legacy_sta_id_or_broadcast(priv, vif_priv->ctx, sta);
-       if (sta_id == IWL_INVALID_STATION)
+       sta_id = il_sta_id_or_broadcast(il, vif_priv->ctx, sta);
+       if (sta_id == IL_INVALID_STATION)
                return -EINVAL;
 
-       mutex_lock(&priv->mutex);
-       iwl_legacy_scan_cancel_timeout(priv, 100);
+       mutex_lock(&il->mutex);
+       il_scan_cancel_timeout(il, 100);
 
        /*
         * If we are getting WEP group key and we didn't receive any key mapping
@@ -2383,164 +2363,164 @@ int iwl4965_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
        switch (cmd) {
        case SET_KEY:
                if (is_default_wep_key)
-                       ret = iwl4965_set_default_wep_key(priv,
+                       ret = il4965_set_default_wep_key(il,
                                                        vif_priv->ctx, key);
                else
-                       ret = iwl4965_set_dynamic_key(priv, vif_priv->ctx,
+                       ret = il4965_set_dynamic_key(il, vif_priv->ctx,
                                                  key, sta_id);
 
-               IWL_DEBUG_MAC80211(priv, "enable hwcrypto key\n");
+               D_MAC80211("enable hwcrypto key\n");
                break;
        case DISABLE_KEY:
                if (is_default_wep_key)
-                       ret = iwl4965_remove_default_wep_key(priv, ctx, key);
+                       ret = il4965_remove_default_wep_key(il, ctx, key);
                else
-                       ret = iwl4965_remove_dynamic_key(priv, ctx,
+                       ret = il4965_remove_dynamic_key(il, ctx,
                                                        key, sta_id);
 
-               IWL_DEBUG_MAC80211(priv, "disable hwcrypto key\n");
+               D_MAC80211("disable hwcrypto key\n");
                break;
        default:
                ret = -EINVAL;
        }
 
-       mutex_unlock(&priv->mutex);
-       IWL_DEBUG_MAC80211(priv, "leave\n");
+       mutex_unlock(&il->mutex);
+       D_MAC80211("leave\n");
 
        return ret;
 }
 
-int iwl4965_mac_ampdu_action(struct ieee80211_hw *hw,
+int il4965_mac_ampdu_action(struct ieee80211_hw *hw,
                            struct ieee80211_vif *vif,
                            enum ieee80211_ampdu_mlme_action action,
                            struct ieee80211_sta *sta, u16 tid, u16 *ssn,
                            u8 buf_size)
 {
-       struct iwl_priv *priv = hw->priv;
+       struct il_priv *il = hw->priv;
        int ret = -EINVAL;
 
-       IWL_DEBUG_HT(priv, "A-MPDU action on addr %pM tid %d\n",
+       D_HT("A-MPDU action on addr %pM tid %d\n",
                     sta->addr, tid);
 
-       if (!(priv->cfg->sku & IWL_SKU_N))
+       if (!(il->cfg->sku & IL_SKU_N))
                return -EACCES;
 
-       mutex_lock(&priv->mutex);
+       mutex_lock(&il->mutex);
 
        switch (action) {
        case IEEE80211_AMPDU_RX_START:
-               IWL_DEBUG_HT(priv, "start Rx\n");
-               ret = iwl4965_sta_rx_agg_start(priv, sta, tid, *ssn);
+               D_HT("start Rx\n");
+               ret = il4965_sta_rx_agg_start(il, sta, tid, *ssn);
                break;
        case IEEE80211_AMPDU_RX_STOP:
-               IWL_DEBUG_HT(priv, "stop Rx\n");
-               ret = iwl4965_sta_rx_agg_stop(priv, sta, tid);
-               if (test_bit(STATUS_EXIT_PENDING, &priv->status))
+               D_HT("stop Rx\n");
+               ret = il4965_sta_rx_agg_stop(il, sta, tid);
+               if (test_bit(STATUS_EXIT_PENDING, &il->status))
                        ret = 0;
                break;
        case IEEE80211_AMPDU_TX_START:
-               IWL_DEBUG_HT(priv, "start Tx\n");
-               ret = iwl4965_tx_agg_start(priv, vif, sta, tid, ssn);
+               D_HT("start Tx\n");
+               ret = il4965_tx_agg_start(il, vif, sta, tid, ssn);
                break;
        case IEEE80211_AMPDU_TX_STOP:
-               IWL_DEBUG_HT(priv, "stop Tx\n");
-               ret = iwl4965_tx_agg_stop(priv, vif, sta, tid);
-               if (test_bit(STATUS_EXIT_PENDING, &priv->status))
+               D_HT("stop Tx\n");
+               ret = il4965_tx_agg_stop(il, vif, sta, tid);
+               if (test_bit(STATUS_EXIT_PENDING, &il->status))
                        ret = 0;
                break;
        case IEEE80211_AMPDU_TX_OPERATIONAL:
                ret = 0;
                break;
        }
-       mutex_unlock(&priv->mutex);
+       mutex_unlock(&il->mutex);
 
        return ret;
 }
 
-int iwl4965_mac_sta_add(struct ieee80211_hw *hw,
+int il4965_mac_sta_add(struct ieee80211_hw *hw,
                       struct ieee80211_vif *vif,
                       struct ieee80211_sta *sta)
 {
-       struct iwl_priv *priv = hw->priv;
-       struct iwl_station_priv *sta_priv = (void *)sta->drv_priv;
-       struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv;
+       struct il_priv *il = hw->priv;
+       struct il_station_priv *sta_priv = (void *)sta->drv_priv;
+       struct il_vif_priv *vif_priv = (void *)vif->drv_priv;
        bool is_ap = vif->type == NL80211_IFTYPE_STATION;
        int ret;
        u8 sta_id;
 
-       IWL_DEBUG_INFO(priv, "received request to add station %pM\n",
+       D_INFO("received request to add station %pM\n",
                        sta->addr);
-       mutex_lock(&priv->mutex);
-       IWL_DEBUG_INFO(priv, "proceeding to add station %pM\n",
+       mutex_lock(&il->mutex);
+       D_INFO("proceeding to add station %pM\n",
                        sta->addr);
-       sta_priv->common.sta_id = IWL_INVALID_STATION;
+       sta_priv->common.sta_id = IL_INVALID_STATION;
 
        atomic_set(&sta_priv->pending_frames, 0);
 
-       ret = iwl_legacy_add_station_common(priv, vif_priv->ctx, sta->addr,
+       ret = il_add_station_common(il, vif_priv->ctx, sta->addr,
                                     is_ap, sta, &sta_id);
        if (ret) {
-               IWL_ERR(priv, "Unable to add station %pM (%d)\n",
+               IL_ERR("Unable to add station %pM (%d)\n",
                        sta->addr, ret);
                /* Should we return success if return code is EEXIST ? */
-               mutex_unlock(&priv->mutex);
+               mutex_unlock(&il->mutex);
                return ret;
        }
 
        sta_priv->common.sta_id = sta_id;
 
        /* Initialize rate scaling */
-       IWL_DEBUG_INFO(priv, "Initializing rate scaling for station %pM\n",
+       D_INFO("Initializing rate scaling for station %pM\n",
                       sta->addr);
-       iwl4965_rs_rate_init(priv, sta, sta_id);
-       mutex_unlock(&priv->mutex);
+       il4965_rs_rate_init(il, sta, sta_id);
+       mutex_unlock(&il->mutex);
 
        return 0;
 }
 
-void iwl4965_mac_channel_switch(struct ieee80211_hw *hw,
+void il4965_mac_channel_switch(struct ieee80211_hw *hw,
                               struct ieee80211_channel_switch *ch_switch)
 {
-       struct iwl_priv *priv = hw->priv;
-       const struct iwl_channel_info *ch_info;
+       struct il_priv *il = hw->priv;
+       const struct il_channel_info *ch_info;
        struct ieee80211_conf *conf = &hw->conf;
        struct ieee80211_channel *channel = ch_switch->channel;
-       struct iwl_ht_config *ht_conf = &priv->current_ht_config;
+       struct il_ht_config *ht_conf = &il->current_ht_config;
 
-       struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];
+       struct il_rxon_context *ctx = &il->ctx;
        u16 ch;
 
-       IWL_DEBUG_MAC80211(priv, "enter\n");
+       D_MAC80211("enter\n");
 
-       mutex_lock(&priv->mutex);
+       mutex_lock(&il->mutex);
 
-       if (iwl_legacy_is_rfkill(priv))
+       if (il_is_rfkill(il))
                goto out;
 
-       if (test_bit(STATUS_EXIT_PENDING, &priv->status) ||
-           test_bit(STATUS_SCANNING, &priv->status) ||
-           test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status))
+       if (test_bit(STATUS_EXIT_PENDING, &il->status) ||
+           test_bit(STATUS_SCANNING, &il->status) ||
+           test_bit(STATUS_CHANNEL_SWITCH_PENDING, &il->status))
                goto out;
 
-       if (!iwl_legacy_is_associated_ctx(ctx))
+       if (!il_is_associated_ctx(ctx))
                goto out;
 
-       if (!priv->cfg->ops->lib->set_channel_switch)
+       if (!il->cfg->ops->lib->set_channel_switch)
                goto out;
 
        ch = channel->hw_value;
        if (le16_to_cpu(ctx->active.channel) == ch)
                goto out;
 
-       ch_info = iwl_legacy_get_channel_info(priv, channel->band, ch);
-       if (!iwl_legacy_is_channel_valid(ch_info)) {
-               IWL_DEBUG_MAC80211(priv, "invalid channel\n");
+       ch_info = il_get_channel_info(il, channel->band, ch);
+       if (!il_is_channel_valid(ch_info)) {
+               D_MAC80211("invalid channel\n");
                goto out;
        }
 
-       spin_lock_irq(&priv->lock);
+       spin_lock_irq(&il->lock);
 
-       priv->current_ht_config.smps = conf->smps_mode;
+       il->current_ht_config.smps = conf->smps_mode;
 
        /* Configure HT40 channels */
        ctx->ht.enabled = conf_is_ht(conf);
@@ -2564,38 +2544,37 @@ void iwl4965_mac_channel_switch(struct ieee80211_hw *hw,
        if ((le16_to_cpu(ctx->staging.channel) != ch))
                ctx->staging.flags = 0;
 
-       iwl_legacy_set_rxon_channel(priv, channel, ctx);
-       iwl_legacy_set_rxon_ht(priv, ht_conf);
-       iwl_legacy_set_flags_for_band(priv, ctx, channel->band, ctx->vif);
+       il_set_rxon_channel(il, channel, ctx);
+       il_set_rxon_ht(il, ht_conf);
+       il_set_flags_for_band(il, ctx, channel->band, ctx->vif);
 
-       spin_unlock_irq(&priv->lock);
+       spin_unlock_irq(&il->lock);
 
-       iwl_legacy_set_rate(priv);
+       il_set_rate(il);
        /*
         * at this point, staging_rxon has the
         * configuration for channel switch
         */
-       set_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status);
-       priv->switch_channel = cpu_to_le16(ch);
-       if (priv->cfg->ops->lib->set_channel_switch(priv, ch_switch)) {
-               clear_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status);
-               priv->switch_channel = 0;
+       set_bit(STATUS_CHANNEL_SWITCH_PENDING, &il->status);
+       il->switch_channel = cpu_to_le16(ch);
+       if (il->cfg->ops->lib->set_channel_switch(il, ch_switch)) {
+               clear_bit(STATUS_CHANNEL_SWITCH_PENDING, &il->status);
+               il->switch_channel = 0;
                ieee80211_chswitch_done(ctx->vif, false);
        }
 
 out:
-       mutex_unlock(&priv->mutex);
-       IWL_DEBUG_MAC80211(priv, "leave\n");
+       mutex_unlock(&il->mutex);
+       D_MAC80211("leave\n");
 }
 
-void iwl4965_configure_filter(struct ieee80211_hw *hw,
+void il4965_configure_filter(struct ieee80211_hw *hw,
                             unsigned int changed_flags,
                             unsigned int *total_flags,
                             u64 multicast)
 {
-       struct iwl_priv *priv = hw->priv;
+       struct il_priv *il = hw->priv;
        __le32 filter_or = 0, filter_nand = 0;
-       struct iwl_rxon_context *ctx;
 
 #define CHK(test, flag)        do { \
        if (*total_flags & (test))              \
@@ -2604,7 +2583,7 @@ void iwl4965_configure_filter(struct ieee80211_hw *hw,
                filter_nand |= (flag);          \
        } while (0)
 
-       IWL_DEBUG_MAC80211(priv, "Enter: changed: 0x%x, total: 0x%x\n",
+       D_MAC80211("Enter: changed: 0x%x, total: 0x%x\n",
                        changed_flags, *total_flags);
 
        CHK(FIF_OTHER_BSS | FIF_PROMISC_IN_BSS, RXON_FILTER_PROMISC_MSK);
@@ -2614,23 +2593,21 @@ void iwl4965_configure_filter(struct ieee80211_hw *hw,
 
 #undef CHK
 
-       mutex_lock(&priv->mutex);
+       mutex_lock(&il->mutex);
 
-       for_each_context(priv, ctx) {
-               ctx->staging.filter_flags &= ~filter_nand;
-               ctx->staging.filter_flags |= filter_or;
+       il->ctx.staging.filter_flags &= ~filter_nand;
+       il->ctx.staging.filter_flags |= filter_or;
 
-               /*
-                * Not committing directly because hardware can perform a scan,
-                * but we'll eventually commit the filter flags change anyway.
-                */
-       }
+       /*
+        * Not committing directly because hardware can perform a scan,
+        * but we'll eventually commit the filter flags change anyway.
+        */
 
-       mutex_unlock(&priv->mutex);
+       mutex_unlock(&il->mutex);
 
        /*
         * Receiving all multicast frames is always enabled by the
-        * default flags setup in iwl_legacy_connection_init_rx_config()
+        * default flags setup in il_connection_init_rx_config()
         * since we currently do not support programming multicast
         * filters into the device.
         */
@@ -2644,230 +2621,230 @@ void iwl4965_configure_filter(struct ieee80211_hw *hw,
  *
  *****************************************************************************/
 
-static void iwl4965_bg_txpower_work(struct work_struct *work)
+static void il4965_bg_txpower_work(struct work_struct *work)
 {
-       struct iwl_priv *priv = container_of(work, struct iwl_priv,
+       struct il_priv *il = container_of(work, struct il_priv,
                        txpower_work);
 
-       mutex_lock(&priv->mutex);
+       mutex_lock(&il->mutex);
 
        /* If a scan happened to start before we got here
-        * then just return; the statistics notification will
+        * then just return; the stats notification will
         * kick off another scheduled work to compensate for
         * any temperature delta we missed here. */
-       if (test_bit(STATUS_EXIT_PENDING, &priv->status) ||
-           test_bit(STATUS_SCANNING, &priv->status))
+       if (test_bit(STATUS_EXIT_PENDING, &il->status) ||
+           test_bit(STATUS_SCANNING, &il->status))
                goto out;
 
        /* Regardless of if we are associated, we must reconfigure the
         * TX power since frames can be sent on non-radar channels while
         * not associated */
-       priv->cfg->ops->lib->send_tx_power(priv);
+       il->cfg->ops->lib->send_tx_power(il);
 
        /* Update last_temperature to keep is_calib_needed from running
         * when it isn't needed... */
-       priv->last_temperature = priv->temperature;
+       il->last_temperature = il->temperature;
 out:
-       mutex_unlock(&priv->mutex);
+       mutex_unlock(&il->mutex);
 }
 
-static void iwl4965_setup_deferred_work(struct iwl_priv *priv)
+static void il4965_setup_deferred_work(struct il_priv *il)
 {
-       priv->workqueue = create_singlethread_workqueue(DRV_NAME);
+       il->workqueue = create_singlethread_workqueue(DRV_NAME);
 
-       init_waitqueue_head(&priv->wait_command_queue);
+       init_waitqueue_head(&il->wait_command_queue);
 
-       INIT_WORK(&priv->restart, iwl4965_bg_restart);
-       INIT_WORK(&priv->rx_replenish, iwl4965_bg_rx_replenish);
-       INIT_WORK(&priv->run_time_calib_work, iwl4965_bg_run_time_calib_work);
-       INIT_DELAYED_WORK(&priv->init_alive_start, iwl4965_bg_init_alive_start);
-       INIT_DELAYED_WORK(&priv->alive_start, iwl4965_bg_alive_start);
+       INIT_WORK(&il->restart, il4965_bg_restart);
+       INIT_WORK(&il->rx_replenish, il4965_bg_rx_replenish);
+       INIT_WORK(&il->run_time_calib_work, il4965_bg_run_time_calib_work);
+       INIT_DELAYED_WORK(&il->init_alive_start, il4965_bg_init_alive_start);
+       INIT_DELAYED_WORK(&il->alive_start, il4965_bg_alive_start);
 
-       iwl_legacy_setup_scan_deferred_work(priv);
+       il_setup_scan_deferred_work(il);
 
-       INIT_WORK(&priv->txpower_work, iwl4965_bg_txpower_work);
+       INIT_WORK(&il->txpower_work, il4965_bg_txpower_work);
 
-       init_timer(&priv->statistics_periodic);
-       priv->statistics_periodic.data = (unsigned long)priv;
-       priv->statistics_periodic.function = iwl4965_bg_statistics_periodic;
+       init_timer(&il->stats_periodic);
+       il->stats_periodic.data = (unsigned long)il;
+       il->stats_periodic.function = il4965_bg_stats_periodic;
 
-       init_timer(&priv->watchdog);
-       priv->watchdog.data = (unsigned long)priv;
-       priv->watchdog.function = iwl_legacy_bg_watchdog;
+       init_timer(&il->watchdog);
+       il->watchdog.data = (unsigned long)il;
+       il->watchdog.function = il_bg_watchdog;
 
-       tasklet_init(&priv->irq_tasklet, (void (*)(unsigned long))
-               iwl4965_irq_tasklet, (unsigned long)priv);
+       tasklet_init(&il->irq_tasklet, (void (*)(unsigned long))
+               il4965_irq_tasklet, (unsigned long)il);
 }
 
-static void iwl4965_cancel_deferred_work(struct iwl_priv *priv)
+static void il4965_cancel_deferred_work(struct il_priv *il)
 {
-       cancel_work_sync(&priv->txpower_work);
-       cancel_delayed_work_sync(&priv->init_alive_start);
-       cancel_delayed_work(&priv->alive_start);
-       cancel_work_sync(&priv->run_time_calib_work);
+       cancel_work_sync(&il->txpower_work);
+       cancel_delayed_work_sync(&il->init_alive_start);
+       cancel_delayed_work(&il->alive_start);
+       cancel_work_sync(&il->run_time_calib_work);
 
-       iwl_legacy_cancel_scan_deferred_work(priv);
+       il_cancel_scan_deferred_work(il);
 
-       del_timer_sync(&priv->statistics_periodic);
+       del_timer_sync(&il->stats_periodic);
 }
 
-static void iwl4965_init_hw_rates(struct iwl_priv *priv,
+static void il4965_init_hw_rates(struct il_priv *il,
                              struct ieee80211_rate *rates)
 {
        int i;
 
-       for (i = 0; i < IWL_RATE_COUNT_LEGACY; i++) {
-               rates[i].bitrate = iwlegacy_rates[i].ieee * 5;
-               rates[i].hw_value = i; /* Rate scaling will work on indexes */
+       for (i = 0; i < RATE_COUNT_LEGACY; i++) {
+               rates[i].bitrate = il_rates[i].ieee * 5;
+               rates[i].hw_value = i; /* Rate scaling will work on idxes */
                rates[i].hw_value_short = i;
                rates[i].flags = 0;
-               if ((i >= IWL_FIRST_CCK_RATE) && (i <= IWL_LAST_CCK_RATE)) {
+               if ((i >= IL_FIRST_CCK_RATE) && (i <= IL_LAST_CCK_RATE)) {
                        /*
                         * If CCK != 1M then set short preamble rate flag.
                         */
                        rates[i].flags |=
-                               (iwlegacy_rates[i].plcp == IWL_RATE_1M_PLCP) ?
+                               (il_rates[i].plcp == RATE_1M_PLCP) ?
                                        0 : IEEE80211_RATE_SHORT_PREAMBLE;
                }
        }
 }
 /*
- * Acquire priv->lock before calling this function !
+ * Acquire il->lock before calling this function !
  */
-void iwl4965_set_wr_ptrs(struct iwl_priv *priv, int txq_id, u32 index)
+void il4965_set_wr_ptrs(struct il_priv *il, int txq_id, u32 idx)
 {
-       iwl_legacy_write_direct32(priv, HBUS_TARG_WRPTR,
-                            (index & 0xff) | (txq_id << 8));
-       iwl_legacy_write_prph(priv, IWL49_SCD_QUEUE_RDPTR(txq_id), index);
+       il_wr(il, HBUS_TARG_WRPTR,
+                            (idx & 0xff) | (txq_id << 8));
+       il_wr_prph(il, IL49_SCD_QUEUE_RDPTR(txq_id), idx);
 }
 
-void iwl4965_tx_queue_set_status(struct iwl_priv *priv,
-                                       struct iwl_tx_queue *txq,
+void il4965_tx_queue_set_status(struct il_priv *il,
+                                       struct il_tx_queue *txq,
                                        int tx_fifo_id, int scd_retry)
 {
        int txq_id = txq->q.id;
 
        /* Find out whether to activate Tx queue */
-       int active = test_bit(txq_id, &priv->txq_ctx_active_msk) ? 1 : 0;
+       int active = test_bit(txq_id, &il->txq_ctx_active_msk) ? 1 : 0;
 
        /* Set up and activate */
-       iwl_legacy_write_prph(priv, IWL49_SCD_QUEUE_STATUS_BITS(txq_id),
-                        (active << IWL49_SCD_QUEUE_STTS_REG_POS_ACTIVE) |
-                        (tx_fifo_id << IWL49_SCD_QUEUE_STTS_REG_POS_TXF) |
-                        (scd_retry << IWL49_SCD_QUEUE_STTS_REG_POS_WSL) |
-                        (scd_retry << IWL49_SCD_QUEUE_STTS_REG_POS_SCD_ACK) |
-                        IWL49_SCD_QUEUE_STTS_REG_MSK);
+       il_wr_prph(il, IL49_SCD_QUEUE_STATUS_BITS(txq_id),
+                        (active << IL49_SCD_QUEUE_STTS_REG_POS_ACTIVE) |
+                        (tx_fifo_id << IL49_SCD_QUEUE_STTS_REG_POS_TXF) |
+                        (scd_retry << IL49_SCD_QUEUE_STTS_REG_POS_WSL) |
+                        (scd_retry << IL49_SCD_QUEUE_STTS_REG_POS_SCD_ACK) |
+                        IL49_SCD_QUEUE_STTS_REG_MSK);
 
        txq->sched_retry = scd_retry;
 
-       IWL_DEBUG_INFO(priv, "%s %s Queue %d on AC %d\n",
+       D_INFO("%s %s Queue %d on AC %d\n",
                       active ? "Activate" : "Deactivate",
                       scd_retry ? "BA" : "AC", txq_id, tx_fifo_id);
 }
 
 
-static int iwl4965_init_drv(struct iwl_priv *priv)
+static int il4965_init_drv(struct il_priv *il)
 {
        int ret;
 
-       spin_lock_init(&priv->sta_lock);
-       spin_lock_init(&priv->hcmd_lock);
+       spin_lock_init(&il->sta_lock);
+       spin_lock_init(&il->hcmd_lock);
 
-       INIT_LIST_HEAD(&priv->free_frames);
+       INIT_LIST_HEAD(&il->free_frames);
 
-       mutex_init(&priv->mutex);
+       mutex_init(&il->mutex);
 
-       priv->ieee_channels = NULL;
-       priv->ieee_rates = NULL;
-       priv->band = IEEE80211_BAND_2GHZ;
+       il->ieee_channels = NULL;
+       il->ieee_rates = NULL;
+       il->band = IEEE80211_BAND_2GHZ;
 
-       priv->iw_mode = NL80211_IFTYPE_STATION;
-       priv->current_ht_config.smps = IEEE80211_SMPS_STATIC;
-       priv->missed_beacon_threshold = IWL_MISSED_BEACON_THRESHOLD_DEF;
+       il->iw_mode = NL80211_IFTYPE_STATION;
+       il->current_ht_config.smps = IEEE80211_SMPS_STATIC;
+       il->missed_beacon_threshold = IL_MISSED_BEACON_THRESHOLD_DEF;
 
        /* initialize force reset */
-       priv->force_reset.reset_duration = IWL_DELAY_NEXT_FORCE_FW_RELOAD;
+       il->force_reset.reset_duration = IL_DELAY_NEXT_FORCE_FW_RELOAD;
 
        /* Choose which receivers/antennas to use */
-       if (priv->cfg->ops->hcmd->set_rxon_chain)
-               priv->cfg->ops->hcmd->set_rxon_chain(priv,
-                                       &priv->contexts[IWL_RXON_CTX_BSS]);
+       if (il->cfg->ops->hcmd->set_rxon_chain)
+               il->cfg->ops->hcmd->set_rxon_chain(il,
+                                       &il->ctx);
 
-       iwl_legacy_init_scan_params(priv);
+       il_init_scan_params(il);
 
-       ret = iwl_legacy_init_channel_map(priv);
+       ret = il_init_channel_map(il);
        if (ret) {
-               IWL_ERR(priv, "initializing regulatory failed: %d\n", ret);
+               IL_ERR("initializing regulatory failed: %d\n", ret);
                goto err;
        }
 
-       ret = iwl_legacy_init_geos(priv);
+       ret = il_init_geos(il);
        if (ret) {
-               IWL_ERR(priv, "initializing geos failed: %d\n", ret);
+               IL_ERR("initializing geos failed: %d\n", ret);
                goto err_free_channel_map;
        }
-       iwl4965_init_hw_rates(priv, priv->ieee_rates);
+       il4965_init_hw_rates(il, il->ieee_rates);
 
        return 0;
 
 err_free_channel_map:
-       iwl_legacy_free_channel_map(priv);
+       il_free_channel_map(il);
 err:
        return ret;
 }
 
-static void iwl4965_uninit_drv(struct iwl_priv *priv)
+static void il4965_uninit_drv(struct il_priv *il)
 {
-       iwl4965_calib_free_results(priv);
-       iwl_legacy_free_geos(priv);
-       iwl_legacy_free_channel_map(priv);
-       kfree(priv->scan_cmd);
+       il4965_calib_free_results(il);
+       il_free_geos(il);
+       il_free_channel_map(il);
+       kfree(il->scan_cmd);
 }
 
-static void iwl4965_hw_detect(struct iwl_priv *priv)
+static void il4965_hw_detect(struct il_priv *il)
 {
-       priv->hw_rev = _iwl_legacy_read32(priv, CSR_HW_REV);
-       priv->hw_wa_rev = _iwl_legacy_read32(priv, CSR_HW_REV_WA_REG);
-       priv->rev_id = priv->pci_dev->revision;
-       IWL_DEBUG_INFO(priv, "HW Revision ID = 0x%X\n", priv->rev_id);
+       il->hw_rev = _il_rd(il, CSR_HW_REV);
+       il->hw_wa_rev = _il_rd(il, CSR_HW_REV_WA_REG);
+       il->rev_id = il->pci_dev->revision;
+       D_INFO("HW Revision ID = 0x%X\n", il->rev_id);
 }
 
-static int iwl4965_set_hw_params(struct iwl_priv *priv)
+static int il4965_set_hw_params(struct il_priv *il)
 {
-       priv->hw_params.max_rxq_size = RX_QUEUE_SIZE;
-       priv->hw_params.max_rxq_log = RX_QUEUE_SIZE_LOG;
-       if (priv->cfg->mod_params->amsdu_size_8K)
-               priv->hw_params.rx_page_order = get_order(IWL_RX_BUF_SIZE_8K);
+       il->hw_params.max_rxq_size = RX_QUEUE_SIZE;
+       il->hw_params.max_rxq_log = RX_QUEUE_SIZE_LOG;
+       if (il->cfg->mod_params->amsdu_size_8K)
+               il->hw_params.rx_page_order = get_order(IL_RX_BUF_SIZE_8K);
        else
-               priv->hw_params.rx_page_order = get_order(IWL_RX_BUF_SIZE_4K);
+               il->hw_params.rx_page_order = get_order(IL_RX_BUF_SIZE_4K);
 
-       priv->hw_params.max_beacon_itrvl = IWL_MAX_UCODE_BEACON_INTERVAL;
+       il->hw_params.max_beacon_itrvl = IL_MAX_UCODE_BEACON_INTERVAL;
 
-       if (priv->cfg->mod_params->disable_11n)
-               priv->cfg->sku &= ~IWL_SKU_N;
+       if (il->cfg->mod_params->disable_11n)
+               il->cfg->sku &= ~IL_SKU_N;
 
        /* Device-specific setup */
-       return priv->cfg->ops->lib->set_hw_params(priv);
+       return il->cfg->ops->lib->set_hw_params(il);
 }
 
-static const u8 iwl4965_bss_ac_to_fifo[] = {
-       IWL_TX_FIFO_VO,
-       IWL_TX_FIFO_VI,
-       IWL_TX_FIFO_BE,
-       IWL_TX_FIFO_BK,
+static const u8 il4965_bss_ac_to_fifo[] = {
+       IL_TX_FIFO_VO,
+       IL_TX_FIFO_VI,
+       IL_TX_FIFO_BE,
+       IL_TX_FIFO_BK,
 };
 
-static const u8 iwl4965_bss_ac_to_queue[] = {
+static const u8 il4965_bss_ac_to_queue[] = {
        0, 1, 2, 3,
 };
 
 static int
-iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
+il4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 {
-       int err = 0, i;
-       struct iwl_priv *priv;
+       int err = 0;
+       struct il_priv *il;
        struct ieee80211_hw *hw;
-       struct iwl_cfg *cfg = (struct iwl_cfg *)(ent->driver_data);
+       struct il_cfg *cfg = (struct il_cfg *)(ent->driver_data);
        unsigned long flags;
        u16 pci_cmd;
 
@@ -2875,54 +2852,44 @@ iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
         * 1. Allocating HW data
         ************************/
 
-       hw = iwl_legacy_alloc_all(cfg);
+       hw = il_alloc_all(cfg);
        if (!hw) {
                err = -ENOMEM;
                goto out;
        }
-       priv = hw->priv;
-       /* At this point both hw and priv are allocated. */
-
-       /*
-        * The default context is always valid,
-        * more may be discovered when firmware
-        * is loaded.
-        */
-       priv->valid_contexts = BIT(IWL_RXON_CTX_BSS);
-
-       for (i = 0; i < NUM_IWL_RXON_CTX; i++)
-               priv->contexts[i].ctxid = i;
-
-       priv->contexts[IWL_RXON_CTX_BSS].always_active = true;
-       priv->contexts[IWL_RXON_CTX_BSS].is_active = true;
-       priv->contexts[IWL_RXON_CTX_BSS].rxon_cmd = REPLY_RXON;
-       priv->contexts[IWL_RXON_CTX_BSS].rxon_timing_cmd = REPLY_RXON_TIMING;
-       priv->contexts[IWL_RXON_CTX_BSS].rxon_assoc_cmd = REPLY_RXON_ASSOC;
-       priv->contexts[IWL_RXON_CTX_BSS].qos_cmd = REPLY_QOS_PARAM;
-       priv->contexts[IWL_RXON_CTX_BSS].ap_sta_id = IWL_AP_ID;
-       priv->contexts[IWL_RXON_CTX_BSS].wep_key_cmd = REPLY_WEPKEY;
-       priv->contexts[IWL_RXON_CTX_BSS].ac_to_fifo = iwl4965_bss_ac_to_fifo;
-       priv->contexts[IWL_RXON_CTX_BSS].ac_to_queue = iwl4965_bss_ac_to_queue;
-       priv->contexts[IWL_RXON_CTX_BSS].exclusive_interface_modes =
+       il = hw->priv;
+       /* At this point both hw and il are allocated. */
+
+       il->ctx.ctxid = 0;
+
+       il->ctx.always_active = true;
+       il->ctx.is_active = true;
+       il->ctx.rxon_cmd = REPLY_RXON;
+       il->ctx.rxon_timing_cmd = REPLY_RXON_TIMING;
+       il->ctx.rxon_assoc_cmd = REPLY_RXON_ASSOC;
+       il->ctx.qos_cmd = REPLY_QOS_PARAM;
+       il->ctx.ap_sta_id = IL_AP_ID;
+       il->ctx.wep_key_cmd = REPLY_WEPKEY;
+       il->ctx.ac_to_fifo = il4965_bss_ac_to_fifo;
+       il->ctx.ac_to_queue = il4965_bss_ac_to_queue;
+       il->ctx.exclusive_interface_modes =
                BIT(NL80211_IFTYPE_ADHOC);
-       priv->contexts[IWL_RXON_CTX_BSS].interface_modes =
+       il->ctx.interface_modes =
                BIT(NL80211_IFTYPE_STATION);
-       priv->contexts[IWL_RXON_CTX_BSS].ap_devtype = RXON_DEV_TYPE_AP;
-       priv->contexts[IWL_RXON_CTX_BSS].ibss_devtype = RXON_DEV_TYPE_IBSS;
-       priv->contexts[IWL_RXON_CTX_BSS].station_devtype = RXON_DEV_TYPE_ESS;
-       priv->contexts[IWL_RXON_CTX_BSS].unused_devtype = RXON_DEV_TYPE_ESS;
-
-       BUILD_BUG_ON(NUM_IWL_RXON_CTX != 1);
+       il->ctx.ap_devtype = RXON_DEV_TYPE_AP;
+       il->ctx.ibss_devtype = RXON_DEV_TYPE_IBSS;
+       il->ctx.station_devtype = RXON_DEV_TYPE_ESS;
+       il->ctx.unused_devtype = RXON_DEV_TYPE_ESS;
 
        SET_IEEE80211_DEV(hw, &pdev->dev);
 
-       IWL_DEBUG_INFO(priv, "*** LOAD DRIVER ***\n");
-       priv->cfg = cfg;
-       priv->pci_dev = pdev;
-       priv->inta_mask = CSR_INI_SET_MASK;
+       D_INFO("*** LOAD DRIVER ***\n");
+       il->cfg = cfg;
+       il->pci_dev = pdev;
+       il->inta_mask = CSR_INI_SET_MASK;
 
-       if (iwl_legacy_alloc_traffic_mem(priv))
-               IWL_ERR(priv, "Not enough memory to generate traffic log\n");
+       if (il_alloc_traffic_mem(il))
+               IL_ERR("Not enough memory to generate traffic log\n");
 
        /**************************
         * 2. Initializing PCI bus
@@ -2947,7 +2914,7 @@ iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
                                                        DMA_BIT_MASK(32));
                /* both attempts failed: */
                if (err) {
-                       IWL_WARN(priv, "No suitable DMA available.\n");
+                       IL_WARN("No suitable DMA available.\n");
                        goto out_pci_disable_device;
                }
        }
@@ -2956,46 +2923,46 @@ iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
        if (err)
                goto out_pci_disable_device;
 
-       pci_set_drvdata(pdev, priv);
+       pci_set_drvdata(pdev, il);
 
 
        /***********************
         * 3. Read REV register
         ***********************/
-       priv->hw_base = pci_iomap(pdev, 0, 0);
-       if (!priv->hw_base) {
+       il->hw_base = pci_iomap(pdev, 0, 0);
+       if (!il->hw_base) {
                err = -ENODEV;
                goto out_pci_release_regions;
        }
 
-       IWL_DEBUG_INFO(priv, "pci_resource_len = 0x%08llx\n",
+       D_INFO("pci_resource_len = 0x%08llx\n",
                (unsigned long long) pci_resource_len(pdev, 0));
-       IWL_DEBUG_INFO(priv, "pci_resource_base = %p\n", priv->hw_base);
+       D_INFO("pci_resource_base = %p\n", il->hw_base);
 
        /* these spin locks will be used in apm_ops.init and EEPROM access
         * we should init now
         */
-       spin_lock_init(&priv->reg_lock);
-       spin_lock_init(&priv->lock);
+       spin_lock_init(&il->reg_lock);
+       spin_lock_init(&il->lock);
 
        /*
         * stop and reset the on-board processor just in case it is in a
         * strange state ... like being left stranded by a primary kernel
         * and this is now the kdump kernel trying to start up
         */
-       iwl_write32(priv, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET);
+       _il_wr(il, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET);
 
-       iwl4965_hw_detect(priv);
-       IWL_INFO(priv, "Detected %s, REV=0x%X\n",
-               priv->cfg->name, priv->hw_rev);
+       il4965_hw_detect(il);
+       IL_INFO("Detected %s, REV=0x%X\n",
+               il->cfg->name, il->hw_rev);
 
        /* We disable the RETRY_TIMEOUT register (0x41) to keep
         * PCI Tx retries from interfering with C3 CPU state */
        pci_write_config_byte(pdev, PCI_CFG_RETRY_TIMEOUT, 0x00);
 
-       iwl4965_prepare_card_hw(priv);
-       if (!priv->hw_ready) {
-               IWL_WARN(priv, "Failed, HW not ready\n");
+       il4965_prepare_card_hw(il);
+       if (!il->hw_ready) {
+               IL_WARN("Failed, HW not ready\n");
                goto out_iounmap;
        }
 
@@ -3003,12 +2970,12 @@ iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
         * 4. Read EEPROM
         *****************/
        /* Read the EEPROM */
-       err = iwl_legacy_eeprom_init(priv);
+       err = il_eeprom_init(il);
        if (err) {
-               IWL_ERR(priv, "Unable to init EEPROM\n");
+               IL_ERR("Unable to init EEPROM\n");
                goto out_iounmap;
        }
-       err = iwl4965_eeprom_check_version(priv);
+       err = il4965_eeprom_check_version(il);
        if (err)
                goto out_free_eeprom;
 
@@ -3016,191 +2983,191 @@ iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
                goto out_free_eeprom;
 
        /* extract MAC Address */
-       iwl4965_eeprom_get_mac(priv, priv->addresses[0].addr);
-       IWL_DEBUG_INFO(priv, "MAC address: %pM\n", priv->addresses[0].addr);
-       priv->hw->wiphy->addresses = priv->addresses;
-       priv->hw->wiphy->n_addresses = 1;
+       il4965_eeprom_get_mac(il, il->addresses[0].addr);
+       D_INFO("MAC address: %pM\n", il->addresses[0].addr);
+       il->hw->wiphy->addresses = il->addresses;
+       il->hw->wiphy->n_addresses = 1;
 
        /************************
         * 5. Setup HW constants
         ************************/
-       if (iwl4965_set_hw_params(priv)) {
-               IWL_ERR(priv, "failed to set hw parameters\n");
+       if (il4965_set_hw_params(il)) {
+               IL_ERR("failed to set hw parameters\n");
                goto out_free_eeprom;
        }
 
        /*******************
-        * 6. Setup priv
+        * 6. Setup il
         *******************/
 
-       err = iwl4965_init_drv(priv);
+       err = il4965_init_drv(il);
        if (err)
                goto out_free_eeprom;
-       /* At this point both hw and priv are initialized. */
+       /* At this point both hw and il are initialized. */
 
        /********************
         * 7. Setup services
         ********************/
-       spin_lock_irqsave(&priv->lock, flags);
-       iwl_legacy_disable_interrupts(priv);
-       spin_unlock_irqrestore(&priv->lock, flags);
+       spin_lock_irqsave(&il->lock, flags);
+       il_disable_interrupts(il);
+       spin_unlock_irqrestore(&il->lock, flags);
 
-       pci_enable_msi(priv->pci_dev);
+       pci_enable_msi(il->pci_dev);
 
-       err = request_irq(priv->pci_dev->irq, iwl_legacy_isr,
-                         IRQF_SHARED, DRV_NAME, priv);
+       err = request_irq(il->pci_dev->irq, il_isr,
+                         IRQF_SHARED, DRV_NAME, il);
        if (err) {
-               IWL_ERR(priv, "Error allocating IRQ %d\n", priv->pci_dev->irq);
+               IL_ERR("Error allocating IRQ %d\n", il->pci_dev->irq);
                goto out_disable_msi;
        }
 
-       iwl4965_setup_deferred_work(priv);
-       iwl4965_setup_rx_handlers(priv);
+       il4965_setup_deferred_work(il);
+       il4965_setup_rx_handlers(il);
 
        /*********************************************
         * 8. Enable interrupts and read RFKILL state
         *********************************************/
 
        /* enable rfkill interrupt: hw bug w/a */
-       pci_read_config_word(priv->pci_dev, PCI_COMMAND, &pci_cmd);
+       pci_read_config_word(il->pci_dev, PCI_COMMAND, &pci_cmd);
        if (pci_cmd & PCI_COMMAND_INTX_DISABLE) {
                pci_cmd &= ~PCI_COMMAND_INTX_DISABLE;
-               pci_write_config_word(priv->pci_dev, PCI_COMMAND, pci_cmd);
+               pci_write_config_word(il->pci_dev, PCI_COMMAND, pci_cmd);
        }
 
-       iwl_legacy_enable_rfkill_int(priv);
+       il_enable_rfkill_int(il);
 
        /* If platform's RF_KILL switch is NOT set to KILL */
-       if (iwl_read32(priv, CSR_GP_CNTRL) &
+       if (_il_rd(il, CSR_GP_CNTRL) &
                CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW)
-               clear_bit(STATUS_RF_KILL_HW, &priv->status);
+               clear_bit(STATUS_RF_KILL_HW, &il->status);
        else
-               set_bit(STATUS_RF_KILL_HW, &priv->status);
+               set_bit(STATUS_RF_KILL_HW, &il->status);
 
-       wiphy_rfkill_set_hw_state(priv->hw->wiphy,
-               test_bit(STATUS_RF_KILL_HW, &priv->status));
+       wiphy_rfkill_set_hw_state(il->hw->wiphy,
+               test_bit(STATUS_RF_KILL_HW, &il->status));
 
-       iwl_legacy_power_initialize(priv);
+       il_power_initialize(il);
 
-       init_completion(&priv->_4965.firmware_loading_complete);
+       init_completion(&il->_4965.firmware_loading_complete);
 
-       err = iwl4965_request_firmware(priv, true);
+       err = il4965_request_firmware(il, true);
        if (err)
                goto out_destroy_workqueue;
 
        return 0;
 
  out_destroy_workqueue:
-       destroy_workqueue(priv->workqueue);
-       priv->workqueue = NULL;
-       free_irq(priv->pci_dev->irq, priv);
+       destroy_workqueue(il->workqueue);
+       il->workqueue = NULL;
+       free_irq(il->pci_dev->irq, il);
  out_disable_msi:
-       pci_disable_msi(priv->pci_dev);
-       iwl4965_uninit_drv(priv);
+       pci_disable_msi(il->pci_dev);
+       il4965_uninit_drv(il);
  out_free_eeprom:
-       iwl_legacy_eeprom_free(priv);
+       il_eeprom_free(il);
  out_iounmap:
-       pci_iounmap(pdev, priv->hw_base);
+       pci_iounmap(pdev, il->hw_base);
  out_pci_release_regions:
        pci_set_drvdata(pdev, NULL);
        pci_release_regions(pdev);
  out_pci_disable_device:
        pci_disable_device(pdev);
  out_ieee80211_free_hw:
-       iwl_legacy_free_traffic_mem(priv);
-       ieee80211_free_hw(priv->hw);
+       il_free_traffic_mem(il);
+       ieee80211_free_hw(il->hw);
  out:
        return err;
 }
 
-static void __devexit iwl4965_pci_remove(struct pci_dev *pdev)
+static void __devexit il4965_pci_remove(struct pci_dev *pdev)
 {
-       struct iwl_priv *priv = pci_get_drvdata(pdev);
+       struct il_priv *il = pci_get_drvdata(pdev);
        unsigned long flags;
 
-       if (!priv)
+       if (!il)
                return;
 
-       wait_for_completion(&priv->_4965.firmware_loading_complete);
+       wait_for_completion(&il->_4965.firmware_loading_complete);
 
-       IWL_DEBUG_INFO(priv, "*** UNLOAD DRIVER ***\n");
+       D_INFO("*** UNLOAD DRIVER ***\n");
 
-       iwl_legacy_dbgfs_unregister(priv);
-       sysfs_remove_group(&pdev->dev.kobj, &iwl_attribute_group);
+       il_dbgfs_unregister(il);
+       sysfs_remove_group(&pdev->dev.kobj, &il_attribute_group);
 
-       /* ieee80211_unregister_hw call wil cause iwl_mac_stop to
-        * to be called and iwl4965_down since we are removing the device
+       /* ieee80211_unregister_hw call wil cause il_mac_stop to
+        * to be called and il4965_down since we are removing the device
         * we need to set STATUS_EXIT_PENDING bit.
         */
-       set_bit(STATUS_EXIT_PENDING, &priv->status);
+       set_bit(STATUS_EXIT_PENDING, &il->status);
 
-       iwl_legacy_leds_exit(priv);
+       il_leds_exit(il);
 
-       if (priv->mac80211_registered) {
-               ieee80211_unregister_hw(priv->hw);
-               priv->mac80211_registered = 0;
+       if (il->mac80211_registered) {
+               ieee80211_unregister_hw(il->hw);
+               il->mac80211_registered = 0;
        } else {
-               iwl4965_down(priv);
+               il4965_down(il);
        }
 
        /*
         * Make sure device is reset to low power before unloading driver.
-        * This may be redundant with iwl4965_down(), but there are paths to
-        * run iwl4965_down() without calling apm_ops.stop(), and there are
-        * paths to avoid running iwl4965_down() at all before leaving driver.
+        * This may be redundant with il4965_down(), but there are paths to
+        * run il4965_down() without calling apm_ops.stop(), and there are
+        * paths to avoid running il4965_down() at all before leaving driver.
         * This (inexpensive) call *makes sure* device is reset.
         */
-       iwl_legacy_apm_stop(priv);
+       il_apm_stop(il);
 
        /* make sure we flush any pending irq or
         * tasklet for the driver
         */
-       spin_lock_irqsave(&priv->lock, flags);
-       iwl_legacy_disable_interrupts(priv);
-       spin_unlock_irqrestore(&priv->lock, flags);
+       spin_lock_irqsave(&il->lock, flags);
+       il_disable_interrupts(il);
+       spin_unlock_irqrestore(&il->lock, flags);
 
-       iwl4965_synchronize_irq(priv);
+       il4965_synchronize_irq(il);
 
-       iwl4965_dealloc_ucode_pci(priv);
+       il4965_dealloc_ucode_pci(il);
 
-       if (priv->rxq.bd)
-               iwl4965_rx_queue_free(priv, &priv->rxq);
-       iwl4965_hw_txq_ctx_free(priv);
+       if (il->rxq.bd)
+               il4965_rx_queue_free(il, &il->rxq);
+       il4965_hw_txq_ctx_free(il);
 
-       iwl_legacy_eeprom_free(priv);
+       il_eeprom_free(il);
 
 
        /*netif_stop_queue(dev); */
-       flush_workqueue(priv->workqueue);
+       flush_workqueue(il->workqueue);
 
-       /* ieee80211_unregister_hw calls iwl_mac_stop, which flushes
-        * priv->workqueue... so we can't take down the workqueue
+       /* ieee80211_unregister_hw calls il_mac_stop, which flushes
+        * il->workqueue... so we can't take down the workqueue
         * until now... */
-       destroy_workqueue(priv->workqueue);
-       priv->workqueue = NULL;
-       iwl_legacy_free_traffic_mem(priv);
+       destroy_workqueue(il->workqueue);
+       il->workqueue = NULL;
+       il_free_traffic_mem(il);
 
-       free_irq(priv->pci_dev->irq, priv);
-       pci_disable_msi(priv->pci_dev);
-       pci_iounmap(pdev, priv->hw_base);
+       free_irq(il->pci_dev->irq, il);
+       pci_disable_msi(il->pci_dev);
+       pci_iounmap(pdev, il->hw_base);
        pci_release_regions(pdev);
        pci_disable_device(pdev);
        pci_set_drvdata(pdev, NULL);
 
-       iwl4965_uninit_drv(priv);
+       il4965_uninit_drv(il);
 
-       dev_kfree_skb(priv->beacon_skb);
+       dev_kfree_skb(il->beacon_skb);
 
-       ieee80211_free_hw(priv->hw);
+       ieee80211_free_hw(il->hw);
 }
 
 /*
  * Activate/Deactivate Tx DMA/FIFO channels according tx fifos mask
- * must be called under priv->lock and mac access
+ * must be called under il->lock and mac access
  */
-void iwl4965_txq_set_sched(struct iwl_priv *priv, u32 mask)
+void il4965_txq_set_sched(struct il_priv *il, u32 mask)
 {
-       iwl_legacy_write_prph(priv, IWL49_SCD_TXFACT, mask);
+       il_wr_prph(il, IL49_SCD_TXFACT, mask);
 }
 
 /*****************************************************************************
@@ -3210,38 +3177,35 @@ void iwl4965_txq_set_sched(struct iwl_priv *priv, u32 mask)
  *****************************************************************************/
 
 /* Hardware specific file defines the PCI IDs table for that hardware module */
-static DEFINE_PCI_DEVICE_TABLE(iwl4965_hw_card_ids) = {
-#if defined(CONFIG_IWL4965_MODULE) || defined(CONFIG_IWL4965)
-       {IWL_PCI_DEVICE(0x4229, PCI_ANY_ID, iwl4965_cfg)},
-       {IWL_PCI_DEVICE(0x4230, PCI_ANY_ID, iwl4965_cfg)},
-#endif /* CONFIG_IWL4965 */
-
+static DEFINE_PCI_DEVICE_TABLE(il4965_hw_card_ids) = {
+       {IL_PCI_DEVICE(0x4229, PCI_ANY_ID, il4965_cfg)},
+       {IL_PCI_DEVICE(0x4230, PCI_ANY_ID, il4965_cfg)},
        {0}
 };
-MODULE_DEVICE_TABLE(pci, iwl4965_hw_card_ids);
+MODULE_DEVICE_TABLE(pci, il4965_hw_card_ids);
 
-static struct pci_driver iwl4965_driver = {
+static struct pci_driver il4965_driver = {
        .name = DRV_NAME,
-       .id_table = iwl4965_hw_card_ids,
-       .probe = iwl4965_pci_probe,
-       .remove = __devexit_p(iwl4965_pci_remove),
-       .driver.pm = IWL_LEGACY_PM_OPS,
+       .id_table = il4965_hw_card_ids,
+       .probe = il4965_pci_probe,
+       .remove = __devexit_p(il4965_pci_remove),
+       .driver.pm = IL_LEGACY_PM_OPS,
 };
 
-static int __init iwl4965_init(void)
+static int __init il4965_init(void)
 {
 
        int ret;
        pr_info(DRV_DESCRIPTION ", " DRV_VERSION "\n");
        pr_info(DRV_COPYRIGHT "\n");
 
-       ret = iwl4965_rate_control_register();
+       ret = il4965_rate_control_register();
        if (ret) {
                pr_err("Unable to register rate control algorithm: %d\n", ret);
                return ret;
        }
 
-       ret = pci_register_driver(&iwl4965_driver);
+       ret = pci_register_driver(&il4965_driver);
        if (ret) {
                pr_err("Unable to initialize PCI module\n");
                goto error_register;
@@ -3250,32 +3214,32 @@ static int __init iwl4965_init(void)
        return ret;
 
 error_register:
-       iwl4965_rate_control_unregister();
+       il4965_rate_control_unregister();
        return ret;
 }
 
-static void __exit iwl4965_exit(void)
+static void __exit il4965_exit(void)
 {
-       pci_unregister_driver(&iwl4965_driver);
-       iwl4965_rate_control_unregister();
+       pci_unregister_driver(&il4965_driver);
+       il4965_rate_control_unregister();
 }
 
-module_exit(iwl4965_exit);
-module_init(iwl4965_init);
+module_exit(il4965_exit);
+module_init(il4965_init);
 
-#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
-module_param_named(debug, iwlegacy_debug_level, uint, S_IRUGO | S_IWUSR);
+#ifdef CONFIG_IWLEGACY_DEBUG
+module_param_named(debug, il_debug_level, uint, S_IRUGO | S_IWUSR);
 MODULE_PARM_DESC(debug, "debug output mask");
 #endif
 
-module_param_named(swcrypto, iwl4965_mod_params.sw_crypto, int, S_IRUGO);
+module_param_named(swcrypto, il4965_mod_params.sw_crypto, int, S_IRUGO);
 MODULE_PARM_DESC(swcrypto, "using crypto in software (default 0 [hardware])");
-module_param_named(queues_num, iwl4965_mod_params.num_of_queues, int, S_IRUGO);
+module_param_named(queues_num, il4965_mod_params.num_of_queues, int, S_IRUGO);
 MODULE_PARM_DESC(queues_num, "number of hw queues.");
-module_param_named(11n_disable, iwl4965_mod_params.disable_11n, int, S_IRUGO);
+module_param_named(11n_disable, il4965_mod_params.disable_11n, int, S_IRUGO);
 MODULE_PARM_DESC(11n_disable, "disable 11n functionality");
-module_param_named(amsdu_size_8K, iwl4965_mod_params.amsdu_size_8K,
+module_param_named(amsdu_size_8K, il4965_mod_params.amsdu_size_8K,
                   int, S_IRUGO);
 MODULE_PARM_DESC(amsdu_size_8K, "enable 8K amsdu size");
-module_param_named(fw_restart, iwl4965_mod_params.restart_fw, int, S_IRUGO);
+module_param_named(fw_restart, il4965_mod_params.restart_fw, int, S_IRUGO);
 MODULE_PARM_DESC(fw_restart, "restart firmware in case of error");