int              max = hd->ioc->req_depth;
        struct scsi_cmnd *sc;
        struct scsi_lun  lun;
+       MPT_ADAPTER *ioc = hd->ioc;
 
-       dsprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT ": search_running channel %d id %d lun %d max %d\n",
-           hd->ioc->name, vdevice->vtarget->channel, vdevice->vtarget->id, vdevice->lun, max));
+       dsprintk(ioc, printk(MYIOC_s_DEBUG_FMT ": search_running channel %d id %d lun %d max %d\n",
+           ioc->name, vdevice->vtarget->channel, vdevice->vtarget->id, vdevice->lun, max));
 
        for (ii=0; ii < max; ii++) {
                if ((sc = hd->ScsiLookup[ii]) != NULL) {
 
-                       mf = (SCSIIORequest_t *)MPT_INDEX_2_MFPTR(hd->ioc, ii);
+                       mf = (SCSIIORequest_t *)MPT_INDEX_2_MFPTR(ioc, ii);
                        if (mf == NULL)
                                continue;
                        /* If the device is a hidden raid component, then its
                        /* Cleanup
                         */
                        hd->ScsiLookup[ii] = NULL;
-                       mptscsih_freeChainBuffers(hd->ioc, ii);
-                       mpt_free_msg_frame(hd->ioc, (MPT_FRAME_HDR *)mf);
+                       mptscsih_freeChainBuffers(ioc, ii);
+                       mpt_free_msg_frame(ioc, (MPT_FRAME_HDR *)mf);
                        if ((unsigned char *)mf != sc->host_scribble)
                                continue;
                        scsi_dma_unmap(sc);
                        sc->host_scribble = NULL;
                        sc->result = DID_NO_CONNECT << 16;
                        sdev_printk(MYIOC_s_INFO_FMT, sc->device, "completing cmds: fw_channel %d,"
-                          "fw_id %d, sc=%p, mf = %p, idx=%x\n", hd->ioc->name, vdevice->vtarget->channel,
+                          "fw_id %d, sc=%p, mf = %p, idx=%x\n", ioc->name, vdevice->vtarget->channel,
                           vdevice->vtarget->id, sc, mf, ii);
                        sc->scsi_done(sc);
                }
 {
        long time = jiffies;
        MPT_SCSI_HOST           *hd;
+       MPT_ADAPTER     *ioc;
 
        if (sc->device == NULL)
                return;
                return;
        if ((hd = (MPT_SCSI_HOST *)sc->device->host->hostdata) == NULL)
                return;
-
+       ioc = hd->ioc;
        if (time - hd->last_queue_full > 10 * HZ) {
-               dprintk(hd->ioc, printk(MYIOC_s_WARN_FMT "Device (%d:%d:%d) reported QUEUE_FULL!\n",
-                               hd->ioc->name, 0, sc->device->id, sc->device->lun));
+               dprintk(ioc, printk(MYIOC_s_WARN_FMT "Device (%d:%d:%d) reported QUEUE_FULL!\n",
+                               ioc->name, 0, sc->device->id, sc->device->lun));
                hd->last_queue_full = time;
        }
 }
        sz1=0;
 
        if (hd->ScsiLookup != NULL) {
-               sz1 = hd->ioc->req_depth * sizeof(void *);
+               sz1 = ioc->req_depth * sizeof(void *);
                kfree(hd->ScsiLookup);
                hd->ScsiLookup = NULL;
        }
 
-       dprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT
+       dprintk(ioc, printk(MYIOC_s_DEBUG_FMT
            "Free'd ScsiLookup (%d) memory\n",
-           hd->ioc->name, sz1));
+           ioc->name, sz1));
 
        kfree(hd->info_kbuf);
 
        /* NULL the Scsi_Host pointer
         */
-       hd->ioc->sh = NULL;
+       ioc->sh = NULL;
 
        scsi_host_put(host);
 
        /*
         *  Put together a MPT SCSI request...
         */
-       if ((mf = mpt_get_msg_frame(hd->ioc->DoneCtx, hd->ioc)) == NULL) {
+       if ((mf = mpt_get_msg_frame(ioc->DoneCtx, ioc)) == NULL) {
                dprintk(ioc, printk(MYIOC_s_WARN_FMT "QueueCmd, no msg frames!!\n",
                                ioc->name));
                return SCSI_MLQUEUE_HOST_BUSY;
        pScsiReq->DataLength = cpu_to_le32(datalen);
 
        /* SenseBuffer low address */
-       pScsiReq->SenseBufferLowAddr = cpu_to_le32(hd->ioc->sense_buf_low_dma
+       pScsiReq->SenseBufferLowAddr = cpu_to_le32(ioc->sense_buf_low_dma
                                           + (my_idx * MPT_SENSE_BUFFER_ALLOC));
 
        /* Now add the SG list
                        (dma_addr_t) -1);
        } else {
                /* Add a 32 or 64 bit SGE */
-               if (mptscsih_AddSGE(hd->ioc, SCpnt, pScsiReq, my_idx) != SUCCESS)
+               if (mptscsih_AddSGE(ioc, SCpnt, pScsiReq, my_idx) != SUCCESS)
                        goto fail;
        }
 
        SCpnt->host_scribble = (unsigned char *)mf;
        hd->ScsiLookup[my_idx] = SCpnt;
 
-       mpt_put_msg_frame(hd->ioc->DoneCtx, hd->ioc, mf);
+       mpt_put_msg_frame(ioc->DoneCtx, ioc, mf);
        dmfprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Issued SCSI cmd (%p) mf=%p idx=%d\n",
                        ioc->name, SCpnt, mf, my_idx));
        DBG_DUMP_REQUEST_FRAME(ioc, (u32 *)mf);
 
  fail:
        hd->ScsiLookup[my_idx] = NULL;
-       mptscsih_freeChainBuffers(hd->ioc, my_idx);
-       mpt_free_msg_frame(hd->ioc, mf);
+       mptscsih_freeChainBuffers(ioc, my_idx);
+       mpt_free_msg_frame(ioc, mf);
        return SCSI_MLQUEUE_HOST_BUSY;
 }
 
                        return FAILED;
                }
        } else {
-               spin_lock_irqsave(&hd->ioc->FreeQlock, flags);
+               spin_lock_irqsave(&ioc->FreeQlock, flags);
                hd->tmPending |=  (1 << type);
-               spin_unlock_irqrestore(&hd->ioc->FreeQlock, flags);
+               spin_unlock_irqrestore(&ioc->FreeQlock, flags);
        }
 
-       ioc_raw_state = mpt_GetIocState(hd->ioc, 0);
+       ioc_raw_state = mpt_GetIocState(ioc, 0);
 
        if ((ioc_raw_state & MPI_IOC_STATE_MASK) != MPI_IOC_STATE_OPERATIONAL) {
                printk(MYIOC_s_WARN_FMT
        SCSITaskMgmt_t  *pScsiTm;
        int              ii;
        int              retval;
+       MPT_ADAPTER     *ioc = hd->ioc;
 
        /* Return Fail to calling function if no message frames available.
         */
-       if ((mf = mpt_get_msg_frame(hd->ioc->TaskCtx, hd->ioc)) == NULL) {
-               dfailprintk(hd->ioc, printk(MYIOC_s_ERR_FMT "IssueTaskMgmt, no msg frames!!\n",
-                               hd->ioc->name));
+       if ((mf = mpt_get_msg_frame(ioc->TaskCtx, ioc)) == NULL) {
+               dfailprintk(ioc, printk(MYIOC_s_ERR_FMT "IssueTaskMgmt, no msg frames!!\n",
+                               ioc->name));
                return FAILED;
        }
-       dtmprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT "IssueTaskMgmt request @ %p\n",
-                       hd->ioc->name, mf));
+       dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT "IssueTaskMgmt request @ %p\n",
+                       ioc->name, mf));
 
        /* Format the Request
         */
 
        pScsiTm->TaskMsgContext = ctx2abort;
 
-       dtmprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT "IssueTaskMgmt: ctx2abort (0x%08x) "
-               "type=%d\n", hd->ioc->name, ctx2abort, type));
+       dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT "IssueTaskMgmt: ctx2abort (0x%08x) "
+               "type=%d\n", ioc->name, ctx2abort, type));
 
        DBG_DUMP_TM_REQUEST_FRAME(ioc, (u32 *)pScsiTm);
 
-       if ((hd->ioc->facts.IOCCapabilities & MPI_IOCFACTS_CAPABILITY_HIGH_PRI_Q) &&
-           (hd->ioc->facts.MsgVersion >= MPI_VERSION_01_05))
-               mpt_put_msg_frame_hi_pri(hd->ioc->TaskCtx, hd->ioc, mf);
+       if ((ioc->facts.IOCCapabilities & MPI_IOCFACTS_CAPABILITY_HIGH_PRI_Q) &&
+           (ioc->facts.MsgVersion >= MPI_VERSION_01_05))
+               mpt_put_msg_frame_hi_pri(ioc->TaskCtx, ioc, mf);
        else {
-               retval = mpt_send_handshake_request(hd->ioc->TaskCtx, hd->ioc,
+               retval = mpt_send_handshake_request(ioc->TaskCtx, ioc,
                        sizeof(SCSITaskMgmt_t), (u32*)pScsiTm, CAN_SLEEP);
                if (retval) {
-                       dfailprintk(hd->ioc, printk(MYIOC_s_ERR_FMT "send_handshake FAILED!"
-                       " (hd %p, ioc %p, mf %p, rc=%d) \n", hd->ioc->name, hd,
-                       hd->ioc, mf, retval));
+                       dfailprintk(ioc, printk(MYIOC_s_ERR_FMT "send_handshake FAILED!"
+                       " (hd %p, ioc %p, mf %p, rc=%d) \n", ioc->name, hd,
+                       ioc, mf, retval));
                        goto fail_out;
                }
        }
 
        if(mptscsih_tm_wait_for_completion(hd, timeout) == FAILED) {
-               dfailprintk(hd->ioc, printk(MYIOC_s_ERR_FMT "task management request TIMED OUT!"
-                       " (hd %p, ioc %p, mf %p) \n", hd->ioc->name, hd,
-                       hd->ioc, mf));
-               dtmprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT "Calling HardReset! \n",
-                        hd->ioc->name));
-               retval = mpt_HardResetHandler(hd->ioc, CAN_SLEEP);
-               dtmprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT "rc=%d \n",
-                        hd->ioc->name, retval));
+               dfailprintk(ioc, printk(MYIOC_s_ERR_FMT "task management request TIMED OUT!"
+                       " (hd %p, ioc %p, mf %p) \n", ioc->name, hd,
+                       ioc, mf));
+               dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Calling HardReset! \n",
+                        ioc->name));
+               retval = mpt_HardResetHandler(ioc, CAN_SLEEP);
+               dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT "rc=%d \n",
+                        ioc->name, retval));
                goto fail_out;
        }
 
        /*
         * Free task managment mf, and corresponding tm flags
         */
-       mpt_free_msg_frame(hd->ioc, mf);
+       mpt_free_msg_frame(ioc, mf);
        hd->tmPending = 0;
        hd->tmState = TM_STATE_NONE;
        return FAILED;
         *       swap it here either.  It is an opaque cookie to
         *       the controller, so it does not matter. -DaveM
         */
-       mf = MPT_INDEX_2_MFPTR(hd->ioc, scpnt_idx);
+       mf = MPT_INDEX_2_MFPTR(ioc, scpnt_idx);
        ctx2abort = mf->u.frame.hwhdr.msgctxu.MsgContext;
 
        hd->abortSCpnt = SCpnt;
        /*  If our attempts to reset the host failed, then return a failed
         *  status.  The host will be taken off line by the SCSI mid-layer.
         */
-       if (mpt_HardResetHandler(hd->ioc, CAN_SLEEP) < 0) {
+       if (mpt_HardResetHandler(ioc, CAN_SLEEP) < 0) {
                retval = FAILED;
        } else {
                /*  Make sure TM pending is cleared and TM state is set to
        unsigned long  flags;
        int            loop_count = 4 * 10;  /* Wait 10 seconds */
        int            status = FAILED;
+       MPT_ADAPTER     *ioc = hd->ioc;
 
        do {
-               spin_lock_irqsave(&hd->ioc->FreeQlock, flags);
+               spin_lock_irqsave(&ioc->FreeQlock, flags);
                if (hd->tmState == TM_STATE_NONE) {
                        hd->tmState = TM_STATE_IN_PROGRESS;
                        hd->tmPending = 1;
-                       spin_unlock_irqrestore(&hd->ioc->FreeQlock, flags);
+                       spin_unlock_irqrestore(&ioc->FreeQlock, flags);
                        status = SUCCESS;
                        break;
                }
-               spin_unlock_irqrestore(&hd->ioc->FreeQlock, flags);
+               spin_unlock_irqrestore(&ioc->FreeQlock, flags);
                msleep(250);
        } while (--loop_count);
 
        unsigned long  flags;
        int            loop_count = 4 * timeout;
        int            status = FAILED;
+       MPT_ADAPTER     *ioc = hd->ioc;
 
        do {
-               spin_lock_irqsave(&hd->ioc->FreeQlock, flags);
+               spin_lock_irqsave(&ioc->FreeQlock, flags);
                if(hd->tmPending == 0) {
                        status = SUCCESS;
-                       spin_unlock_irqrestore(&hd->ioc->FreeQlock, flags);
+                       spin_unlock_irqrestore(&ioc->FreeQlock, flags);
                        break;
                }
-               spin_unlock_irqrestore(&hd->ioc->FreeQlock, flags);
+               spin_unlock_irqrestore(&ioc->FreeQlock, flags);
                msleep(250);
        } while (--loop_count);
 
        struct scsi_target      *starget;
        int                     max_depth;
        int                     tagged;
+       MPT_ADAPTER             *ioc = hd->ioc;
 
        starget = scsi_target(sdev);
        vtarget = starget->hostdata;
 
-       if (hd->ioc->bus_type == SPI) {
+       if (ioc->bus_type == SPI) {
                if (!(vtarget->tflags & MPT_TARGET_FLAGS_Q_YES))
                        max_depth = 1;
                else if (sdev->type == TYPE_DISK &&
        VirtDevice              *vdevice;
        struct scsi_target      *starget;
        MPT_SCSI_HOST           *hd = (MPT_SCSI_HOST *)sh->hostdata;
+       MPT_ADAPTER             *ioc = hd->ioc;
 
        starget = scsi_target(sdev);
        vtarget = starget->hostdata;
        vdevice = sdev->hostdata;
 
-       dsprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT
+       dsprintk(ioc, printk(MYIOC_s_DEBUG_FMT
                "device @ %p, channel=%d, id=%d, lun=%d\n",
-               hd->ioc->name, sdev, sdev->channel, sdev->id, sdev->lun));
-       if (hd->ioc->bus_type == SPI)
-               dsprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT
+               ioc->name, sdev, sdev->channel, sdev->id, sdev->lun));
+       if (ioc->bus_type == SPI)
+               dsprintk(ioc, printk(MYIOC_s_DEBUG_FMT
                    "sdtr %d wdtr %d ppr %d inq length=%d\n",
-                   hd->ioc->name, sdev->sdtr, sdev->wdtr,
+                   ioc->name, sdev->sdtr, sdev->wdtr,
                    sdev->ppr, sdev->inquiry_len));
 
        if (sdev->id > sh->max_id) {
        vdevice->configured_lun = 1;
        mptscsih_change_queue_depth(sdev, MPT_SCSI_CMD_PER_DEV_HIGH);
 
-       dsprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT
+       dsprintk(ioc, printk(MYIOC_s_DEBUG_FMT
                "Queue depth=%d, tflags=%x\n",
-               hd->ioc->name, sdev->queue_depth, vtarget->tflags));
+               ioc->name, sdev->queue_depth, vtarget->tflags));
 
-       if (hd->ioc->bus_type == SPI)
-               dsprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT
+       if (ioc->bus_type == SPI)
+               dsprintk(ioc, printk(MYIOC_s_DEBUG_FMT
                    "negoFlags=%x, maxOffset=%x, SyncFactor=%x\n",
-                   hd->ioc->name, vtarget->negoFlags, vtarget->maxOffset,
+                   ioc->name, vtarget->negoFlags, vtarget->maxOffset,
                    vtarget->minSyncFactor));
 
 slave_configure_exit:
 
-       dsprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT
+       dsprintk(ioc, printk(MYIOC_s_DEBUG_FMT
                "tagged %d, simple %d, ordered %d\n",
-               hd->ioc->name,sdev->tagged_supported, sdev->simple_tags,
+               ioc->name,sdev->tagged_supported, sdev->simple_tags,
                sdev->ordered_tags));
 
        return 0;
        VirtDevice      *vdevice;
        SCSIIORequest_t *pReq;
        u32              sense_count = le32_to_cpu(pScsiReply->SenseCount);
+       MPT_ADAPTER     *ioc = hd->ioc;
 
        /* Get target structure
         */
 
                /* Copy the sense received into the scsi command block. */
                req_index = le16_to_cpu(mf->u.frame.hwhdr.msgctxu.fld.req_idx);
-               sense_data = ((u8 *)hd->ioc->sense_buf_pool + (req_index * MPT_SENSE_BUFFER_ALLOC));
+               sense_data = ((u8 *)ioc->sense_buf_pool + (req_index * MPT_SENSE_BUFFER_ALLOC));
                memcpy(sc->sense_buffer, sense_data, SNS_LEN(sc));
 
                /* Log SMART data (asc = 0x5D, non-IM case only) if required.
                 */
-               if ((hd->ioc->events) && (hd->ioc->eventTypes & (1 << MPI_EVENT_SCSI_DEVICE_STATUS_CHANGE))) {
+               if ((ioc->events) && (ioc->eventTypes & (1 << MPI_EVENT_SCSI_DEVICE_STATUS_CHANGE))) {
                        if ((sense_data[12] == 0x5D) && (vdevice->vtarget->raidVolume == 0)) {
                                int idx;
-                               MPT_ADAPTER *ioc = hd->ioc;
 
                                idx = ioc->eventContext % MPTCTL_EVENT_LOG_SIZE;
                                ioc->events[idx].event = MPI_EVENT_SCSI_DEVICE_STATUS_CHANGE;
                                ioc->events[idx].data[1] = (sense_data[13] << 8) | sense_data[12];
 
                                ioc->eventContext++;
-                               if (hd->ioc->pcidev->vendor ==
+                               if (ioc->pcidev->vendor ==
                                    PCI_VENDOR_ID_IBM) {
-                                       mptscsih_issue_sep_command(hd->ioc,
+                                       mptscsih_issue_sep_command(ioc,
                                            vdevice->vtarget, MPI_SEP_REQ_SLOTSTATUS_PREDICTED_FAULT);
                                        vdevice->vtarget->tflags |=
                                            MPT_TARGET_FLAGS_LED_ON;
                        }
                }
        } else {
-               dprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT "Hmmm... SenseData len=0! (?)\n",
-                               hd->ioc->name));
+               dprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Hmmm... SenseData len=0! (?)\n",
+                               ioc->name));
        }
 }
 
 
                /* ScsiLookup initialization
                 */
-               for (ii=0; ii < hd->ioc->req_depth; ii++)
+               for (ii=0; ii < ioc->req_depth; ii++)
                        hd->ScsiLookup[ii] = NULL;
 
                /* 2. Chain Buffer initialization
 
        if (mf != hd->cmdPtr) {
                printk(MYIOC_s_WARN_FMT "ScanDvComplete (mf=%p, cmdPtr=%p, idx=%d)\n",
-                               hd->ioc->name, (void *)mf, (void *) hd->cmdPtr, req_idx);
+                               ioc->name, (void *)mf, (void *) hd->cmdPtr, req_idx);
        }
        hd->cmdPtr = NULL;
 
        ddvprintk(ioc, printk(MYIOC_s_DEBUG_FMT "ScanDvComplete (mf=%p,mr=%p,idx=%d)\n",
-                       hd->ioc->name, mf, mr, req_idx));
+                       ioc->name, mf, mr, req_idx));
 
        hd->pLocal = &hd->localReply;
        hd->pLocal->scsiStatus = 0;
                                 */
                                completionCode = MPT_SCANDV_SENSE;
                                hd->pLocal->scsiStatus = scsi_status;
-                               sense_data = ((u8 *)hd->ioc->sense_buf_pool +
+                               sense_data = ((u8 *)ioc->sense_buf_pool +
                                        (req_idx * MPT_SENSE_BUFFER_ALLOC));
 
                                sz = min_t(int, pReq->SenseBufferLength,
 mptscsih_timer_expired(unsigned long data)
 {
        MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *) data;
+       MPT_ADAPTER     *ioc = hd->ioc;
 
-       ddvprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT "Timer Expired! Cmd %p\n", hd->ioc->name, hd->cmdPtr));
+       ddvprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Timer Expired! Cmd %p\n", ioc->name, hd->cmdPtr));
 
        if (hd->cmdPtr) {
                MPIHeader_t *cmd = (MPIHeader_t *)hd->cmdPtr;
                         */
                } else {
                        /* Perform a FW reload */
-                       if (mpt_HardResetHandler(hd->ioc, NO_SLEEP) < 0) {
-                               printk(MYIOC_s_WARN_FMT "Firmware Reload FAILED!\n", hd->ioc->name);
+                       if (mpt_HardResetHandler(ioc, NO_SLEEP) < 0) {
+                               printk(MYIOC_s_WARN_FMT "Firmware Reload FAILED!\n", ioc->name);
                        }
                }
        } else {
                /* This should NEVER happen */
-               printk(MYIOC_s_WARN_FMT "Null cmdPtr!!!!\n", hd->ioc->name);
+               printk(MYIOC_s_WARN_FMT "Null cmdPtr!!!!\n", ioc->name);
        }
 
        /* No more processing.
         * The FW will reply to all outstanding commands, callback will finish cleanup.
         * Hard reset clean-up will free all resources.
         */
-       ddvprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT "Timer Expired Complete!\n", hd->ioc->name));
+       ddvprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Timer Expired Complete!\n", ioc->name));
 
        return;
 }
        char             cmdLen;
        char             CDB[]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
        char             cmd = io->cmd;
+       MPT_ADAPTER     *ioc = hd->ioc;
 
        in_isr = in_interrupt();
        if (in_isr) {
-               dprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT "Internal SCSI IO request not allowed in ISR context!\n",
-                                       hd->ioc->name));
+               dprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Internal SCSI IO request not allowed in ISR context!\n",
+                                       ioc->name));
                return -EPERM;
        }
 
 
        /* Get and Populate a free Frame
         */
-       if ((mf = mpt_get_msg_frame(hd->ioc->InternalCtx, hd->ioc)) == NULL) {
-               dfailprintk(hd->ioc, printk(MYIOC_s_WARN_FMT "No msg frames!\n",
-                   hd->ioc->name));
+       if ((mf = mpt_get_msg_frame(ioc->InternalCtx, ioc)) == NULL) {
+               dfailprintk(ioc, printk(MYIOC_s_WARN_FMT "No msg frames!\n",
+                   ioc->name));
                return -EBUSY;
        }
 
 
        if (cmd == REQUEST_SENSE) {
                pScsiReq->Control = cpu_to_le32(dir | MPI_SCSIIO_CONTROL_UNTAGGED);
-               ddvprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT "Untagged! 0x%2x\n",
-                       hd->ioc->name, cmd));
+               ddvprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Untagged! 0x%2x\n",
+                       ioc->name, cmd));
        }
 
        for (ii=0; ii < 16; ii++)
                pScsiReq->CDB[ii] = CDB[ii];
 
        pScsiReq->DataLength = cpu_to_le32(io->size);
-       pScsiReq->SenseBufferLowAddr = cpu_to_le32(hd->ioc->sense_buf_low_dma
+       pScsiReq->SenseBufferLowAddr = cpu_to_le32(ioc->sense_buf_low_dma
                                           + (my_idx * MPT_SENSE_BUFFER_ALLOC));
 
-       ddvprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT "Sending Command 0x%x for (%d:%d:%d)\n",
-                       hd->ioc->name, cmd, io->channel, io->id, io->lun));
+       ddvprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Sending Command 0x%x for (%d:%d:%d)\n",
+                       ioc->name, cmd, io->channel, io->id, io->lun));
 
        if (dir == MPI_SCSIIO_CONTROL_READ) {
                mpt_add_sge((char *) &pScsiReq->SGL,
        hd->cmdPtr = mf;
 
        add_timer(&hd->timer);
-       mpt_put_msg_frame(hd->ioc->InternalCtx, hd->ioc, mf);
+       mpt_put_msg_frame(ioc->InternalCtx, ioc, mf);
        wait_event(hd->scandv_waitq, hd->scandv_wait_done);
 
        if (hd->pLocal) {
        } else {
                rc = -EFAULT;
                /* This should never happen. */
-               ddvprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT "_do_cmd: Null pLocal!!!\n",
-                               hd->ioc->name));
+               ddvprintk(ioc, printk(MYIOC_s_DEBUG_FMT "_do_cmd: Null pLocal!!!\n",
+                               ioc->name));
        }
 
        return rc;
 
 mptspi_setTargetNegoParms(MPT_SCSI_HOST *hd, VirtTarget *target,
                            struct scsi_device *sdev)
 {
-       SpiCfgData *pspi_data = &hd->ioc->spi_data;
+       MPT_ADAPTER *ioc = hd->ioc;
+       SpiCfgData *pspi_data = &ioc->spi_data;
        int  id = (int) target->id;
        int  nvram;
        u8 width = MPT_NARROW;
                                else {
                                        factor = MPT_ULTRA320;
                                        if (scsi_device_qas(sdev)) {
-                                               ddvprintk(hd->ioc,
+                                               ddvprintk(ioc,
                                                printk(MYIOC_s_DEBUG_FMT "Enabling QAS due to "
-                                               "byte56=%02x on id=%d!\n", hd->ioc->name,
+                                               "byte56=%02x on id=%d!\n", ioc->name,
                                                scsi_device_qas(sdev), id));
                                                noQas = 0;
                                        }
                /* Disable QAS in a mixed configuration case
                 */
 
-               ddvprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT
-                       "Disabling QAS due to noQas=%02x on id=%d!\n", hd->ioc->name, noQas, id));
+               ddvprintk(ioc, printk(MYIOC_s_DEBUG_FMT
+                       "Disabling QAS due to noQas=%02x on id=%d!\n", ioc->name, noQas, id));
        }
 }
 
 mptspi_is_raid(struct _MPT_SCSI_HOST *hd, u32 id)
 {
        int i, rc = 0;
+       MPT_ADAPTER *ioc = hd->ioc;
 
-       if (!hd->ioc->raid_data.pIocPg2)
+       if (!ioc->raid_data.pIocPg2)
                goto out;
 
-       if (!hd->ioc->raid_data.pIocPg2->NumActiveVolumes)
+       if (!ioc->raid_data.pIocPg2->NumActiveVolumes)
                goto out;
-       for (i=0; i < hd->ioc->raid_data.pIocPg2->NumActiveVolumes; i++) {
-               if (hd->ioc->raid_data.pIocPg2->RaidVolume[i].VolumeID == id) {
+       for (i=0; i < ioc->raid_data.pIocPg2->NumActiveVolumes; i++) {
+               if (ioc->raid_data.pIocPg2->RaidVolume[i].VolumeID == id) {
                        rc = 1;
                        goto out;
                }
        struct Scsi_Host *shost = dev_to_shost(&starget->dev);
        struct _MPT_SCSI_HOST *hd = (struct _MPT_SCSI_HOST *)shost->hostdata;
        VirtTarget              *vtarget;
+       MPT_ADAPTER *ioc;
 
        if (hd == NULL)
                return -ENODEV;
 
+       ioc = hd->ioc;
        vtarget = kzalloc(sizeof(VirtTarget), GFP_KERNEL);
        if (!vtarget)
                return -ENOMEM;
 
-       vtarget->ioc_id = hd->ioc->id;
+       vtarget->ioc_id = ioc->id;
        vtarget->tflags = MPT_TARGET_FLAGS_Q_YES;
        vtarget->id = (u8)starget->id;
        vtarget->channel = (u8)starget->channel;
        starget->hostdata = vtarget;
 
        if (starget->channel == 1) {
-               if (mptscsih_is_phys_disk(hd->ioc, 0, starget->id) == 0)
+               if (mptscsih_is_phys_disk(ioc, 0, starget->id) == 0)
                        return 0;
                vtarget->tflags |= MPT_TARGET_FLAGS_RAID_COMPONENT;
                /* The real channel for this device is zero */
                vtarget->channel = 0;
                /* The actual physdisknum (for RAID passthrough) */
-               vtarget->id = mptscsih_raid_id_to_num(hd->ioc, 0,
+               vtarget->id = mptscsih_raid_id_to_num(ioc, 0,
                    starget->id);
        }
 
        if (starget->channel == 0 &&
            mptspi_is_raid(hd, starget->id)) {
                vtarget->raidVolume = 1;
-               ddvprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT
-                   "RAID Volume @ channel=%d id=%d\n", hd->ioc->name, starget->channel,
+               ddvprintk(ioc, printk(MYIOC_s_DEBUG_FMT
+                   "RAID Volume @ channel=%d id=%d\n", ioc->name, starget->channel,
                    starget->id));
        }
 
-       if (hd->ioc->spi_data.nvram &&
-           hd->ioc->spi_data.nvram[starget->id] != MPT_HOST_NVRAM_INVALID) {
-               u32 nvram = hd->ioc->spi_data.nvram[starget->id];
+       if (ioc->spi_data.nvram &&
+           ioc->spi_data.nvram[starget->id] != MPT_HOST_NVRAM_INVALID) {
+               u32 nvram = ioc->spi_data.nvram[starget->id];
                spi_min_period(starget) = (nvram & MPT_NVRAM_SYNC_MASK) >> MPT_NVRAM_SYNC_SHIFT;
                spi_max_width(starget) = nvram & MPT_NVRAM_WIDE_DISABLE ? 0 : 1;
        } else {
-               spi_min_period(starget) = hd->ioc->spi_data.minSyncFactor;
-               spi_max_width(starget) = hd->ioc->spi_data.maxBusWidth;
+               spi_min_period(starget) = ioc->spi_data.minSyncFactor;
+               spi_max_width(starget) = ioc->spi_data.maxBusWidth;
        }
-       spi_max_offset(starget) = hd->ioc->spi_data.maxSyncOffset;
+       spi_max_offset(starget) = ioc->spi_data.maxSyncOffset;
 
        spi_offset(starget) = 0;
        mptspi_write_width(starget, 0);
 {
        MpiRaidActionRequest_t  *pReq;
        MPT_FRAME_HDR           *mf;
+       MPT_ADAPTER *ioc = hd->ioc;
 
        /* Get and Populate a free Frame
         */
-       if ((mf = mpt_get_msg_frame(hd->ioc->InternalCtx, hd->ioc)) == NULL) {
-               ddvprintk(hd->ioc, printk(MYIOC_s_WARN_FMT "_do_raid: no msg frames!\n",
-                                       hd->ioc->name));
+       if ((mf = mpt_get_msg_frame(ioc->InternalCtx, ioc)) == NULL) {
+               ddvprintk(ioc, printk(MYIOC_s_WARN_FMT "_do_raid: no msg frames!\n",
+                                       ioc->name));
                return -EAGAIN;
        }
        pReq = (MpiRaidActionRequest_t *)mf;
        mpt_add_sge((char *)&pReq->ActionDataSGE,
                MPT_SGE_FLAGS_SSIMPLE_READ | 0, (dma_addr_t) -1);
 
-       ddvprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT "RAID Volume action=%x channel=%d id=%d\n",
-                       hd->ioc->name, pReq->Action, channel, id));
+       ddvprintk(ioc, printk(MYIOC_s_DEBUG_FMT "RAID Volume action=%x channel=%d id=%d\n",
+                       ioc->name, pReq->Action, channel, id));
 
        hd->pLocal = NULL;
        hd->timer.expires = jiffies + HZ*10; /* 10 second timeout */
        hd->cmdPtr = mf;
 
        add_timer(&hd->timer);
-       mpt_put_msg_frame(hd->ioc->InternalCtx, hd->ioc, mf);
+       mpt_put_msg_frame(ioc->InternalCtx, ioc, mf);
        wait_event(hd->scandv_waitq, hd->scandv_wait_done);
 
        if ((hd->pLocal == NULL) || (hd->pLocal->completion != 0))
                             struct scsi_device *sdev)
 {
        VirtTarget *vtarget = scsi_target(sdev)->hostdata;
+       MPT_ADAPTER *ioc = hd->ioc;
 
        /* no DV on RAID devices */
        if (sdev->channel == 0 &&
        if (sdev->channel == 1 &&
            mptscsih_quiesce_raid(hd, 1, vtarget->channel, vtarget->id) < 0) {
                starget_printk(MYIOC_s_ERR_FMT, scsi_target(sdev),
-                   "Integrated RAID quiesce failed\n", hd->ioc->name);
+                   "Integrated RAID quiesce failed\n", ioc->name);
                return;
        }
 
        if (sdev->channel == 1 &&
            mptscsih_quiesce_raid(hd, 0, vtarget->channel, vtarget->id) < 0)
                starget_printk(MYIOC_s_ERR_FMT, scsi_target(sdev),
-                   "Integrated RAID resume failed\n", hd->ioc->name);
+                   "Integrated RAID resume failed\n", ioc->name);
 
        mptspi_read_parameters(sdev->sdev_target);
        spi_display_xfer_agreement(sdev->sdev_target);
        VirtTarget              *vtarget;
        VirtDevice              *vdevice;
        struct scsi_target      *starget;
+       MPT_ADAPTER *ioc = hd->ioc;
 
        if (sdev->channel == 1 &&
-               mptscsih_is_phys_disk(hd->ioc, 0, sdev->id) == 0)
+               mptscsih_is_phys_disk(ioc, 0, sdev->id) == 0)
                        return -ENXIO;
 
        vdevice = kzalloc(sizeof(VirtDevice), GFP_KERNEL);
        if (!vdevice) {
                printk(MYIOC_s_ERR_FMT "slave_alloc kmalloc(%zd) FAILED!\n",
-                               hd->ioc->name, sizeof(VirtDevice));
+                               ioc->name, sizeof(VirtDevice));
                return -ENOMEM;
        }
 
 {
        struct _MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata;
        VirtDevice      *vdevice = SCpnt->device->hostdata;
+       MPT_ADAPTER *ioc = hd->ioc;
 
        if (!vdevice || !vdevice->vtarget) {
                SCpnt->result = DID_NO_CONNECT << 16;
        }
 
        if (SCpnt->device->channel == 1 &&
-               mptscsih_is_phys_disk(hd->ioc, 0, SCpnt->device->id) == 0) {
+               mptscsih_is_phys_disk(ioc, 0, SCpnt->device->id) == 0) {
                SCpnt->result = DID_NO_CONNECT << 16;
                done(SCpnt);
                return 0;
        }
 
        if (spi_dv_pending(scsi_target(SCpnt->device)))
-               ddvprintk(hd->ioc, scsi_print_command(SCpnt));
+               ddvprintk(ioc, scsi_print_command(SCpnt));
 
        return mptscsih_qcmd(SCpnt,done);
 }
        struct work_queue_wrapper *wqw =
                container_of(work, struct work_queue_wrapper, work);
        struct _MPT_SCSI_HOST *hd = wqw->hd;
-       struct Scsi_Host *shost = hd->ioc->sh;
+       MPT_ADAPTER *ioc = hd->ioc;
+       struct Scsi_Host *shost = ioc->sh;
        struct scsi_device *sdev;
        int disk = wqw->disk;
        struct _CONFIG_PAGE_IOC_3 *pg3;
 
        kfree(wqw);
 
-       mpt_findImVolumes(hd->ioc);
-       pg3 = hd->ioc->raid_data.pIocPg3;
+       mpt_findImVolumes(ioc);
+       pg3 = ioc->raid_data.pIocPg3;
        if (!pg3)
                return;
 
                        continue;
 
                starget_printk(MYIOC_s_INFO_FMT, vtarget->starget,
-                   "Integrated RAID requests DV of new device\n", hd->ioc->name);
+                   "Integrated RAID requests DV of new device\n", ioc->name);
                mptspi_dv_device(hd, sdev);
        }
        shost_printk(MYIOC_s_INFO_FMT, shost,
-           "Integrated RAID detects new device %d\n", hd->ioc->name, disk);
-       scsi_scan_target(&hd->ioc->sh->shost_gendev, 1, disk, 0, 1);
+           "Integrated RAID detects new device %d\n", ioc->name, disk);
+       scsi_scan_target(&ioc->sh->shost_gendev, 1, disk, 0, 1);
 }
 
 
 static void mpt_dv_raid(struct _MPT_SCSI_HOST *hd, int disk)
 {
        struct work_queue_wrapper *wqw = kmalloc(sizeof(*wqw), GFP_ATOMIC);
+       MPT_ADAPTER *ioc = hd->ioc;
 
        if (!wqw) {
-               shost_printk(MYIOC_s_ERR_FMT, hd->ioc->sh,
+               shost_printk(MYIOC_s_ERR_FMT, ioc->sh,
                    "Failed to act on RAID event for physical disk %d\n",
-                   hd->ioc->name, disk);
+                   ioc->name, disk);
                return;
        }
        INIT_WORK(&wqw->work, mpt_work_wrapper);
        struct scsi_target *starget;
        struct _CONFIG_PAGE_SCSI_DEVICE_1 pg1;
        u32 nego;
+       MPT_ADAPTER *ioc = hd->ioc;
 
        kfree(wqw);
 
        if (hd->spi_pending) {
-               shost_for_each_device(sdev, hd->ioc->sh) {
+               shost_for_each_device(sdev, ioc->sh) {
                        if  (hd->spi_pending & (1 << sdev->id))
                                continue;
                        starget = scsi_target(sdev);
                        mptspi_write_spi_device_pg1(starget, &pg1);
                }
        } else {
-               shost_for_each_device(sdev, hd->ioc->sh)
+               shost_for_each_device(sdev, ioc->sh)
                        mptspi_dv_device(hd, sdev);
        }
 }
 
        /* Some versions of the firmware don't support page 0; without
         * that we can't get the parameters */
-       if (hd->ioc->spi_data.sdp0length != 0)
+       if (ioc->spi_data.sdp0length != 0)
                sh->transportt = mptspi_transport_template;
 
        error = scsi_add_host (sh, &ioc->pcidev->dev);