Merge commit 'v2.6.26' into x86/core
[pandora-kernel.git] / drivers / message / fusion / mptspi.c
index ed6a778..1effca4 100644 (file)
@@ -537,7 +537,7 @@ static int mptspi_read_spi_device_pg0(struct scsi_target *starget,
 
        spi_dev_pg0 = dma_alloc_coherent(&ioc->pcidev->dev, size, &spi_dev_pg0_dma, GFP_KERNEL);
        if (spi_dev_pg0 == NULL) {
-               starget_printk(MYIOC_s_ERR_FMT, starget,
+               starget_printk(KERN_ERR, starget, MYIOC_s_FMT
                    "dma_alloc_coherent for parameters failed\n", ioc->name);
                return -EINVAL;
        }
@@ -558,7 +558,7 @@ static int mptspi_read_spi_device_pg0(struct scsi_target *starget,
        cfg.pageAddr = starget->id;
 
        if (mpt_config(ioc, &cfg)) {
-               starget_printk(MYIOC_s_ERR_FMT, starget, "mpt_config failed\n", ioc->name);
+               starget_printk(KERN_ERR, starget, MYIOC_s_FMT "mpt_config failed\n", ioc->name);
                goto out_free;
        }
        err = 0;
@@ -681,7 +681,7 @@ static void mptspi_dv_device(struct _MPT_SCSI_HOST *hd,
        /* If this is a piece of a RAID, then quiesce first */
        if (sdev->channel == 1 &&
            mptscsih_quiesce_raid(hd, 1, vtarget->channel, vtarget->id) < 0) {
-               starget_printk(MYIOC_s_ERR_FMT, scsi_target(sdev),
+               starget_printk(KERN_ERR, scsi_target(sdev), MYIOC_s_FMT
                    "Integrated RAID quiesce failed\n", ioc->name);
                return;
        }
@@ -692,7 +692,7 @@ static void mptspi_dv_device(struct _MPT_SCSI_HOST *hd,
 
        if (sdev->channel == 1 &&
            mptscsih_quiesce_raid(hd, 0, vtarget->channel, vtarget->id) < 0)
-               starget_printk(MYIOC_s_ERR_FMT, scsi_target(sdev),
+               starget_printk(KERN_ERR, scsi_target(sdev), MYIOC_s_FMT
                    "Integrated RAID resume failed\n", ioc->name);
 
        mptspi_read_parameters(sdev->sdev_target);
@@ -856,7 +856,7 @@ static int mptspi_write_spi_device_pg1(struct scsi_target *starget,
 
        pg1 = dma_alloc_coherent(&ioc->pcidev->dev, size, &pg1_dma, GFP_KERNEL);
        if (pg1 == NULL) {
-               starget_printk(MYIOC_s_ERR_FMT, starget,
+               starget_printk(KERN_ERR, starget, MYIOC_s_FMT
                    "dma_alloc_coherent for parameters failed\n", ioc->name);
                return -EINVAL;
        }
@@ -886,7 +886,7 @@ static int mptspi_write_spi_device_pg1(struct scsi_target *starget,
        mptspi_print_write_nego(hd, starget, le32_to_cpu(pg1->RequestedParameters));
 
        if (mpt_config(ioc, &cfg)) {
-               starget_printk(MYIOC_s_ERR_FMT, starget,
+               starget_printk(KERN_ERR, starget, MYIOC_s_FMT
                    "mpt_config failed\n", ioc->name);
                goto out_free;
        }
@@ -1104,11 +1104,11 @@ static void mpt_work_wrapper(struct work_struct *work)
                if(vtarget->id != disk)
                        continue;
 
-               starget_printk(MYIOC_s_INFO_FMT, vtarget->starget,
+               starget_printk(KERN_INFO, vtarget->starget, MYIOC_s_FMT
                    "Integrated RAID requests DV of new device\n", ioc->name);
                mptspi_dv_device(hd, sdev);
        }
-       shost_printk(MYIOC_s_INFO_FMT, shost,
+       shost_printk(KERN_INFO, shost, MYIOC_s_FMT
            "Integrated RAID detects new device %d\n", ioc->name, disk);
        scsi_scan_target(&ioc->sh->shost_gendev, 1, disk, 0, 1);
 }
@@ -1120,7 +1120,7 @@ static void mpt_dv_raid(struct _MPT_SCSI_HOST *hd, int disk)
        MPT_ADAPTER *ioc = hd->ioc;
 
        if (!wqw) {
-               shost_printk(MYIOC_s_ERR_FMT, ioc->sh,
+               shost_printk(KERN_ERR, ioc->sh, MYIOC_s_FMT
                    "Failed to act on RAID event for physical disk %d\n",
                    ioc->name, disk);
                return;
@@ -1266,13 +1266,18 @@ mptspi_dv_renegotiate(struct _MPT_SCSI_HOST *hd)
 static int
 mptspi_ioc_reset(MPT_ADAPTER *ioc, int reset_phase)
 {
-       struct _MPT_SCSI_HOST *hd = shost_priv(ioc->sh);
        int rc;
 
        rc = mptscsih_ioc_reset(ioc, reset_phase);
 
-       if (reset_phase == MPT_IOC_POST_RESET)
+       /* only try to do a renegotiation if we're properly set up
+        * if we get an ioc fault on bringup, ioc->sh will be NULL */
+       if (reset_phase == MPT_IOC_POST_RESET &&
+           ioc->sh) {
+               struct _MPT_SCSI_HOST *hd = shost_priv(ioc->sh);
+
                mptspi_dv_renegotiate(hd);
+       }
 
        return rc;
 }
@@ -1446,14 +1451,15 @@ mptspi_probe(struct pci_dev *pdev, const struct pci_device_id *id)
        /* SCSI needs scsi_cmnd lookup table!
         * (with size equal to req_depth*PtrSz!)
         */
-       hd->ScsiLookup = kcalloc(ioc->req_depth, sizeof(void *), GFP_ATOMIC);
-       if (!hd->ScsiLookup) {
+       ioc->ScsiLookup = kcalloc(ioc->req_depth, sizeof(void *), GFP_ATOMIC);
+       if (!ioc->ScsiLookup) {
                error = -ENOMEM;
                goto out_mptspi_probe;
        }
+       spin_lock_init(&ioc->scsi_lookup_lock);
 
        dprintk(ioc, printk(MYIOC_s_DEBUG_FMT "ScsiLookup @ %p\n",
-                ioc->name, hd->ScsiLookup));
+                ioc->name, ioc->ScsiLookup));
 
        /* Clear the TM flags
         */