Merge x86-64 update from Andi
[powerpc.git] / drivers / scsi / sata_mv.c
index a3ab14c..257c128 100644 (file)
@@ -29,8 +29,9 @@
 #include <linux/interrupt.h>
 #include <linux/sched.h>
 #include <linux/dma-mapping.h>
-#include "scsi.h"
+#include <linux/device.h>
 #include <scsi/scsi_host.h>
+#include <scsi/scsi_cmnd.h>
 #include <linux/libata.h>
 #include <asm/io.h>
 
@@ -269,7 +270,7 @@ static irqreturn_t mv_interrupt(int irq, void *dev_instance,
 static void mv_eng_timeout(struct ata_port *ap);
 static int mv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent);
 
-static Scsi_Host_Template mv_sht = {
+static struct scsi_host_template mv_sht = {
        .module                 = THIS_MODULE,
        .name                   = DRV_NAME,
        .ioctl                  = ata_scsi_ioctl,
@@ -348,7 +349,7 @@ static struct ata_port_info mv_port_info[] = {
        },
 };
 
-static struct pci_device_id mv_pci_tbl[] = {
+static const struct pci_device_id mv_pci_tbl[] = {
        {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x5040), 0, 0, chip_504x},
        {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x5041), 0, 0, chip_504x},
        {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x5080), 0, 0, chip_508x},
@@ -358,6 +359,8 @@ static struct pci_device_id mv_pci_tbl[] = {
        {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x6041), 0, 0, chip_604x},
        {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x6080), 0, 0, chip_608x},
        {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x6081), 0, 0, chip_608x},
+
+       {PCI_DEVICE(PCI_VENDOR_ID_ADAPTEC2, 0x0241), 0, 0, chip_604x},
        {}                      /* terminate list */
 };
 
@@ -669,6 +672,11 @@ static void mv_host_stop(struct ata_host_set *host_set)
        ata_host_stop(host_set);
 }
 
+static inline void mv_priv_free(struct mv_port_priv *pp, struct device *dev)
+{
+       dma_free_coherent(dev, MV_PORT_PRIV_DMA_SZ, pp->crpb, pp->crpb_dma);
+}
+
 /**
  *      mv_port_start - Port specific init/start routine.
  *      @ap: ATA channel to manipulate
@@ -686,21 +694,23 @@ static int mv_port_start(struct ata_port *ap)
        void __iomem *port_mmio = mv_ap_base(ap);
        void *mem;
        dma_addr_t mem_dma;
+       int rc = -ENOMEM;
 
        pp = kmalloc(sizeof(*pp), GFP_KERNEL);
-       if (!pp) {
-               return -ENOMEM;
-       }
+       if (!pp)
+               goto err_out;
        memset(pp, 0, sizeof(*pp));
 
        mem = dma_alloc_coherent(dev, MV_PORT_PRIV_DMA_SZ, &mem_dma, 
                                 GFP_KERNEL);
-       if (!mem) {
-               kfree(pp);
-               return -ENOMEM;
-       }
+       if (!mem)
+               goto err_out_pp;
        memset(mem, 0, MV_PORT_PRIV_DMA_SZ);
 
+       rc = ata_pad_alloc(ap, dev);
+       if (rc)
+               goto err_out_priv;
+
        /* First item in chunk of DMA memory: 
         * 32-slot command request table (CRQB), 32 bytes each in size
         */
@@ -745,6 +755,13 @@ static int mv_port_start(struct ata_port *ap)
         */
        ap->private_data = pp;
        return 0;
+
+err_out_priv:
+       mv_priv_free(pp, dev);
+err_out_pp:
+       kfree(pp);
+err_out:
+       return rc;
 }
 
 /**
@@ -767,7 +784,8 @@ static void mv_port_stop(struct ata_port *ap)
        spin_unlock_irqrestore(&ap->host_set->lock, flags);
 
        ap->private_data = NULL;
-       dma_free_coherent(dev, MV_PORT_PRIV_DMA_SZ, pp->crpb, pp->crpb_dma);
+       ata_pad_free(ap, dev);
+       mv_priv_free(pp, dev);
        kfree(pp);
 }
 
@@ -1438,9 +1456,9 @@ static void mv_print_info(struct ata_probe_ent *probe_ent)
        else
                scc_s = "unknown";
 
-       printk(KERN_INFO DRV_NAME 
-              "(%s) %u slots %u ports %s mode IRQ via %s\n",
-              pci_name(pdev), (unsigned)MV_MAX_Q_DEPTH, probe_ent->n_ports, 
+       dev_printk(KERN_INFO, &pdev->dev,
+              "%u slots %u ports %s mode IRQ via %s\n",
+              (unsigned)MV_MAX_Q_DEPTH, probe_ent->n_ports, 
               scc_s, (MV_HP_FLAG_MSI & hpriv->hp_flags) ? "MSI" : "INTx");
 }
 
@@ -1461,9 +1479,8 @@ static int mv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
        void __iomem *mmio_base;
        int pci_dev_busy = 0, rc;
 
-       if (!printed_version++) {
-               printk(KERN_INFO DRV_NAME " version " DRV_VERSION "\n");
-       }
+       if (!printed_version++)
+               dev_printk(KERN_INFO, &pdev->dev, "version " DRV_VERSION "\n");
 
        rc = pci_enable_device(pdev);
        if (rc) {