}
 
 static int iwlagn_load_given_ucode(struct iwl_priv *priv,
-                                  struct fw_desc *inst_image,
-                                  struct fw_desc *data_image)
+                                  struct fw_img *image)
 {
        int ret = 0;
 
-       ret = iwlagn_load_section(priv, "INST", inst_image,
+       ret = iwlagn_load_section(priv, "INST", &image->code,
                                   IWLAGN_RTC_INST_LOWER_BOUND);
        if (ret)
                return ret;
 
-       return iwlagn_load_section(priv, "DATA", data_image,
+       return iwlagn_load_section(priv, "DATA", &image->data,
                                    IWLAGN_RTC_DATA_LOWER_BOUND);
 }
 
  * iwl_verify_ucode - determine which instruction image is in SRAM,
  *    and verify its contents
  */
-static int iwl_verify_ucode(struct iwl_priv *priv, struct fw_desc *fw_desc)
+static int iwl_verify_ucode(struct iwl_priv *priv, struct fw_img *img)
 {
-       if (!iwlcore_verify_inst_sparse(priv, fw_desc)) {
+       if (!iwlcore_verify_inst_sparse(priv, &img->code)) {
                IWL_DEBUG_INFO(priv, "uCode is good in inst SRAM\n");
                return 0;
        }
 
        IWL_ERR(priv, "UCODE IMAGE IN INSTRUCTION SRAM NOT VALID!!\n");
 
-       iwl_print_mismatch_inst(priv, fw_desc);
+       iwl_print_mismatch_inst(priv, &img->code);
        return -EIO;
 }
 
 #define UCODE_CALIB_TIMEOUT    (2*HZ)
 
 int iwlagn_load_ucode_wait_alive(struct iwl_priv *priv,
-                                struct fw_desc *inst_image,
-                                struct fw_desc *data_image,
+                                struct fw_img *image,
                                 int subtype, int alternate_subtype)
 {
        struct iwl_notification_wait alive_wait;
        old_type = priv->ucode_type;
        priv->ucode_type = subtype;
 
-       ret = iwlagn_load_given_ucode(priv, inst_image, data_image);
+       ret = iwlagn_load_given_ucode(priv, image);
        if (ret) {
                priv->ucode_type = old_type;
                iwlagn_remove_notification(priv, &alive_wait);
                return -EIO;
        }
 
-       ret = iwl_verify_ucode(priv, inst_image);
+       ret = iwl_verify_ucode(priv, image);
        if (ret) {
                priv->ucode_type = old_type;
                return ret;
        lockdep_assert_held(&priv->mutex);
 
        /* No init ucode required? Curious, but maybe ok */
-       if (!priv->ucode_init.len)
+       if (!priv->ucode_init.code.len)
                return 0;
 
        if (priv->ucode_type != UCODE_SUBTYPE_NONE_LOADED)
 
        /* Will also start the device */
        ret = iwlagn_load_ucode_wait_alive(priv, &priv->ucode_init,
-                                          &priv->ucode_init_data,
                                           UCODE_SUBTYPE_INIT, -1);
        if (ret)
                goto error;
 
  *
  ******************************************************************************/
 
+static void iwl_free_fw_desc(struct pci_dev *pci_dev, struct fw_desc *desc)
+{
+       if (desc->v_addr)
+               dma_free_coherent(&pci_dev->dev, desc->len,
+                                 desc->v_addr, desc->p_addr);
+       desc->v_addr = NULL;
+       desc->len = 0;
+}
+
+static void iwl_free_fw_img(struct pci_dev *pci_dev, struct fw_img *img)
+{
+       iwl_free_fw_desc(pci_dev, &img->code);
+       iwl_free_fw_desc(pci_dev, &img->data);
+}
+
+static int iwl_alloc_fw_desc(struct pci_dev *pci_dev, struct fw_desc *desc,
+                            const void *data, size_t len)
+{
+       if (!len) {
+               desc->v_addr = NULL;
+               return -EINVAL;
+       }
+
+       desc->v_addr = dma_alloc_coherent(&pci_dev->dev, len,
+                                         &desc->p_addr, GFP_KERNEL);
+       if (!desc->v_addr)
+               return -ENOMEM;
+       desc->len = len;
+       memcpy(desc->v_addr, data, len);
+       return 0;
+}
+
 static void iwl_dealloc_ucode_pci(struct iwl_priv *priv)
 {
-       iwl_free_fw_desc(priv->pci_dev, &priv->ucode_code);
-       iwl_free_fw_desc(priv->pci_dev, &priv->ucode_data);
-       iwl_free_fw_desc(priv->pci_dev, &priv->ucode_init);
-       iwl_free_fw_desc(priv->pci_dev, &priv->ucode_init_data);
+       iwl_free_fw_img(priv->pci_dev, &priv->ucode_rt);
+       iwl_free_fw_img(priv->pci_dev, &priv->ucode_init);
 }
 
 struct iwlagn_ucode_capabilities {
        /* 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_alloc_fw_desc(priv->pci_dev, &priv->ucode_code);
-
-       priv->ucode_data.len = pieces.data_size;
-       iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_data);
-
-       if (!priv->ucode_code.v_addr || !priv->ucode_data.v_addr)
+       if (iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_rt.code,
+                             pieces.inst, pieces.inst_size))
+               goto err_pci_alloc;
+       if (iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_rt.data,
+                             pieces.data, pieces.data_size))
                goto err_pci_alloc;
 
        /* Initialization instructions and data */
        if (pieces.init_size && pieces.init_data_size) {
-               priv->ucode_init.len = pieces.init_size;
-               iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_init);
-
-               priv->ucode_init_data.len = pieces.init_data_size;
-               iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_init_data);
-
-               if (!priv->ucode_init.v_addr || !priv->ucode_init_data.v_addr)
+               if (iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_init.code,
+                                     pieces.init, pieces.init_size))
+                       goto err_pci_alloc;
+               if (iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_init.data,
+                                     pieces.init_data, pieces.init_data_size))
                        goto err_pci_alloc;
        }
 
        else
                priv->cmd_queue = IWL_DEFAULT_CMD_QUEUE_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",
-                       pieces.inst_size);
-       memcpy(priv->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);
-
-       /*
-        * Runtime data
-        * NOTE:  Copy into backup buffer will be done in iwl_up()
-        */
-       IWL_DEBUG_INFO(priv, "Copying (but not loading) uCode data len %Zd\n",
-                       pieces.data_size);
-       memcpy(priv->ucode_data.v_addr, pieces.data, pieces.data_size);
-
-       /* Initialization instructions */
-       if (pieces.init_size) {
-               IWL_DEBUG_INFO(priv, "Copying (but not loading) init instr len %Zd\n",
-                               pieces.init_size);
-               memcpy(priv->ucode_init.v_addr, pieces.init, pieces.init_size);
-       }
-
-       /* Initialization data */
-       if (pieces.init_data_size) {
-               IWL_DEBUG_INFO(priv, "Copying (but not loading) init data len %Zd\n",
-                              pieces.init_data_size);
-               memcpy(priv->ucode_init_data.v_addr, pieces.init_data,
-                      pieces.init_data_size);
-       }
-
        /*
         * figure out the offset of chain noise reset and gain commands
         * base on the size of standard phy calibration commands table size
        }
 
        ret = iwlagn_load_ucode_wait_alive(priv,
-                                          &priv->ucode_code,
-                                          &priv->ucode_data,
+                                          &priv->ucode_rt,
                                           UCODE_SUBTYPE_REGULAR,
                                           UCODE_SUBTYPE_REGULAR_NEW);
        if (ret) {
 
 void iwlagn_send_prio_tbl(struct iwl_priv *priv);
 int iwlagn_run_init_ucode(struct iwl_priv *priv);
 int iwlagn_load_ucode_wait_alive(struct iwl_priv *priv,
-                                struct fw_desc *inst_image,
-                                struct fw_desc *data_image,
+                                struct fw_img *image,
                                 int subtype, int alternate_subtype);
 
 /* lib */
 
        if (!priv->dbgfs_sram_offset && !priv->dbgfs_sram_len) {
                priv->dbgfs_sram_offset = 0x800000;
                if (priv->ucode_type == UCODE_SUBTYPE_INIT)
-                       priv->dbgfs_sram_len = priv->ucode_init_data.len;
+                       priv->dbgfs_sram_len = priv->ucode_init.data.len;
                else
-                       priv->dbgfs_sram_len = priv->ucode_data.len;
+                       priv->dbgfs_sram_len = priv->ucode_rt.data.len;
        }
        len = priv->dbgfs_sram_len;
 
 
        u32 len;                /* bytes */
 };
 
+struct fw_img {
+       struct fw_desc code, data;
+};
+
 /* v1/v2 uCode file layout */
 struct iwl_ucode_header {
        __le32 ver;     /* major/minor/API/serial */
        int fw_index;                   /* firmware we're trying to load */
        u32 ucode_ver;                  /* version of ucode, copy of
                                           iwl_ucode.ver */
-       struct fw_desc ucode_code;      /* runtime inst */
-       struct fw_desc ucode_data;      /* runtime data original */
-       struct fw_desc ucode_init;      /* initialization inst */
-       struct fw_desc ucode_init_data; /* initialization data */
+       struct fw_img ucode_rt;
+       struct fw_img ucode_init;
+
        enum iwlagn_ucode_subtype ucode_type;
        u8 ucode_write_complete;        /* the image write is complete */
        char firmware_name[25];
 
        return --index & (n_bd - 1);
 }
 
-/* TODO: Move fw_desc functions to iwl-pci.ko */
-static inline void iwl_free_fw_desc(struct pci_dev *pci_dev,
-                                   struct fw_desc *desc)
-{
-       if (desc->v_addr)
-               dma_free_coherent(&pci_dev->dev, desc->len,
-                                 desc->v_addr, desc->p_addr);
-       desc->v_addr = NULL;
-       desc->len = 0;
-}
-
-static inline int iwl_alloc_fw_desc(struct pci_dev *pci_dev,
-                                   struct fw_desc *desc)
-{
-       if (!desc->len) {
-               desc->v_addr = NULL;
-               return -EINVAL;
-       }
-
-       desc->v_addr = dma_alloc_coherent(&pci_dev->dev, desc->len,
-                                         &desc->p_addr, GFP_KERNEL);
-       return (desc->v_addr != NULL) ? 0 : -ENOMEM;
-}
-
 /*
  * we have 8 bits used like this:
  *