]> err.no Git - linux-2.6/blobdiff - drivers/scsi/pdc_adma.c
Merge branch 'master'
[linux-2.6] / drivers / scsi / pdc_adma.c
index 7999817915c39610e4e91968fba517055483976a..e254f1e1bb1c19d234fe479d56a67dc4e6d150db 100644 (file)
@@ -40,7 +40,7 @@
 #include <linux/delay.h>
 #include <linux/interrupt.h>
 #include <linux/sched.h>
-#include "scsi.h"
+#include <linux/device.h>
 #include <scsi/scsi_host.h>
 #include <asm/io.h>
 #include <linux/libata.h>
@@ -138,7 +138,7 @@ static u8 adma_bmdma_status(struct ata_port *ap);
 static void adma_irq_clear(struct ata_port *ap);
 static void adma_eng_timeout(struct ata_port *ap);
 
-static Scsi_Host_Template adma_ata_sht = {
+static struct scsi_host_template adma_ata_sht = {
        .module                 = THIS_MODULE,
        .name                   = DRV_NAME,
        .ioctl                  = ata_scsi_ioctl,
@@ -190,7 +190,7 @@ static struct ata_port_info adma_port_info[] = {
        },
 };
 
-static struct pci_device_id adma_ata_pci_tbl[] = {
+static const struct pci_device_id adma_ata_pci_tbl[] = {
        { PCI_VENDOR_ID_PDC, 0x1841, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
          board_1841_idx },
 
@@ -292,14 +292,14 @@ static void adma_eng_timeout(struct ata_port *ap)
 
 static int adma_fill_sg(struct ata_queued_cmd *qc)
 {
-       struct scatterlist *sg = qc->sg;
+       struct scatterlist *sg;
        struct ata_port *ap = qc->ap;
        struct adma_port_priv *pp = ap->private_data;
        u8  *buf = pp->pkt;
-       int nelem, i = (2 + buf[3]) * 8;
+       int i = (2 + buf[3]) * 8;
        u8 pFLAGS = pORD | ((qc->tf.flags & ATA_TFLAG_WRITE) ? pDIRO : 0);
 
-       for (nelem = 0; nelem < qc->n_elem; nelem++,sg++) {
+       ata_for_each_sg(sg, qc) {
                u32 addr;
                u32 len;
 
@@ -311,7 +311,7 @@ static int adma_fill_sg(struct ata_queued_cmd *qc)
                *(__le32 *)(buf + i) = cpu_to_le32(len);
                i += 4;
 
-               if ((nelem + 1) == qc->n_elem)
+               if (ata_sg_is_last(sg, qc))
                        pFLAGS |= pEND;
                buf[i++] = pFLAGS;
                buf[i++] = qc->dev->dma_mode & 0xf;
@@ -451,24 +451,27 @@ static inline unsigned int adma_intr_pkt(struct ata_host_set *host_set)
                struct adma_port_priv *pp;
                struct ata_queued_cmd *qc;
                void __iomem *chan = ADMA_REGS(mmio_base, port_no);
-               u8 drv_stat = 0, status = readb(chan + ADMA_STATUS);
+               u8 status = readb(chan + ADMA_STATUS);
 
                if (status == 0)
                        continue;
                handled = 1;
                adma_enter_reg_mode(ap);
-               if (ap->flags & (ATA_FLAG_PORT_DISABLED | ATA_FLAG_NOINTR))
+               if (ap->flags & ATA_FLAG_PORT_DISABLED)
                        continue;
                pp = ap->private_data;
                if (!pp || pp->state != adma_state_pkt)
                        continue;
                qc = ata_qc_from_tag(ap, ap->active_tag);
-               if (qc && (!(qc->tf.ctl & ATA_NIEN))) {
+               if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING))) {
+                       unsigned int err_mask = 0;
+
                        if ((status & (aPERR | aPSD | aUIRQ)))
-                               drv_stat = ATA_ERR;
+                               err_mask = AC_ERR_OTHER;
                        else if (pp->pkt[0] != cDONE)
-                               drv_stat = ATA_ERR;
-                       ata_qc_complete(qc, drv_stat);
+                               err_mask = AC_ERR_OTHER;
+
+                       ata_qc_complete(qc, err_mask);
                }
        }
        return handled;
@@ -481,16 +484,16 @@ static inline unsigned int adma_intr_mmio(struct ata_host_set *host_set)
        for (port_no = 0; port_no < host_set->n_ports; ++port_no) {
                struct ata_port *ap;
                ap = host_set->ports[port_no];
-               if (ap && (!(ap->flags & (ATA_FLAG_PORT_DISABLED | ATA_FLAG_NOINTR)))) {
+               if (ap && (!(ap->flags & ATA_FLAG_PORT_DISABLED))) {
                        struct ata_queued_cmd *qc;
                        struct adma_port_priv *pp = ap->private_data;
                        if (!pp || pp->state != adma_state_mmio)
                                continue;
                        qc = ata_qc_from_tag(ap, ap->active_tag);
-                       if (qc && (!(qc->tf.ctl & ATA_NIEN))) {
+                       if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING))) {
 
                                /* check main status, clearing INTRQ */
-                               u8 status = ata_chk_status(ap);
+                               u8 status = ata_check_status(ap);
                                if ((status & ATA_BUSY))
                                        continue;
                                DPRINTK("ata%u: protocol %d (dev_stat 0x%X)\n",
@@ -498,7 +501,7 @@ static inline unsigned int adma_intr_mmio(struct ata_host_set *host_set)
                
                                /* complete taskfile transaction */
                                pp->state = adma_state_idle;
-                               ata_qc_complete(qc, status);
+                               ata_qc_complete(qc, ac_err_mask(status));
                                handled = 1;
                        }
                }
@@ -623,16 +626,14 @@ static int adma_set_dma_masks(struct pci_dev *pdev, void __iomem *mmio_base)
 
        rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK);
        if (rc) {
-               printk(KERN_ERR DRV_NAME
-                       "(%s): 32-bit DMA enable failed\n",
-                       pci_name(pdev));
+               dev_printk(KERN_ERR, &pdev->dev,
+                       "32-bit DMA enable failed\n");
                return rc;
        }
        rc = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK);
        if (rc) {
-               printk(KERN_ERR DRV_NAME
-                       "(%s): 32-bit consistent DMA enable failed\n",
-                       pci_name(pdev));
+               dev_printk(KERN_ERR, &pdev->dev,
+                       "32-bit consistent DMA enable failed\n");
                return rc;
        }
        return 0;
@@ -648,7 +649,7 @@ static int adma_ata_init_one(struct pci_dev *pdev,
        int rc, port_no;
 
        if (!printed_version++)
-               printk(KERN_DEBUG DRV_NAME " version " DRV_VERSION "\n");
+               dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
 
        rc = pci_enable_device(pdev);
        if (rc)