[PATCH] libata: move err_mask to ata_queued_cmd
[pandora-kernel.git] / drivers / scsi / sata_promise.c
index 63911f1..e2e146a 100644 (file)
 #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 <scsi/scsi_cmnd.h>
 #include <linux/libata.h>
 #include <asm/io.h>
 #include "sata_promise.h"
 
 #define DRV_NAME       "sata_promise"
-#define DRV_VERSION    "1.02"
+#define DRV_VERSION    "1.03"
 
 
 enum {
@@ -93,7 +94,7 @@ static void pdc_irq_clear(struct ata_port *ap);
 static int pdc_qc_issue_prot(struct ata_queued_cmd *qc);
 
 
-static Scsi_Host_Template pdc_ata_sht = {
+static struct scsi_host_template pdc_ata_sht = {
        .module                 = THIS_MODULE,
        .name                   = DRV_NAME,
        .ioctl                  = ata_scsi_ioctl,
@@ -157,7 +158,7 @@ static const struct ata_port_operations pdc_pata_ops = {
        .host_stop              = ata_pci_host_stop,
 };
 
-static struct ata_port_info pdc_port_info[] = {
+static const struct ata_port_info pdc_port_info[] = {
        /* board_2037x */
        {
                .sht            = &pdc_ata_sht,
@@ -192,7 +193,7 @@ static struct ata_port_info pdc_port_info[] = {
        },
 };
 
-static struct pci_device_id pdc_ata_pci_tbl[] = {
+static const struct pci_device_id pdc_ata_pci_tbl[] = {
        { PCI_VENDOR_ID_PROMISE, 0x3371, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
          board_2037x },
        { PCI_VENDOR_ID_PROMISE, 0x3570, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
@@ -399,7 +400,9 @@ static void pdc_eng_timeout(struct ata_port *ap)
        case ATA_PROT_DMA:
        case ATA_PROT_NODATA:
                printk(KERN_ERR "ata%u: command timeout\n", ap->id);
-               ata_qc_complete(qc, ata_wait_idle(ap) | ATA_ERR);
+               drv_stat = ata_wait_idle(ap);
+               qc->err_mask |= __ac_err_mask(drv_stat);
+               ata_qc_complete(qc);
                break;
 
        default:
@@ -408,7 +411,8 @@ static void pdc_eng_timeout(struct ata_port *ap)
                printk(KERN_ERR "ata%u: unknown timeout, cmd 0x%x stat 0x%x\n",
                       ap->id, qc->tf.command, drv_stat);
 
-               ata_qc_complete(qc, drv_stat);
+               qc->err_mask |= ac_err_mask(drv_stat);
+               ata_qc_complete(qc);
                break;
        }
 
@@ -420,24 +424,21 @@ out:
 static inline unsigned int pdc_host_intr( struct ata_port *ap,
                                           struct ata_queued_cmd *qc)
 {
-       u8 status;
-       unsigned int handled = 0, have_err = 0;
+       unsigned int handled = 0;
        u32 tmp;
        void __iomem *mmio = (void __iomem *) ap->ioaddr.cmd_addr + PDC_GLOBAL_CTL;
 
        tmp = readl(mmio);
        if (tmp & PDC_ERR_MASK) {
-               have_err = 1;
+               qc->err_mask |= AC_ERR_DEV;
                pdc_reset_port(ap);
        }
 
        switch (qc->tf.protocol) {
        case ATA_PROT_DMA:
        case ATA_PROT_NODATA:
-               status = ata_wait_idle(ap);
-               if (have_err)
-                       status |= ATA_ERR;
-               ata_qc_complete(qc, status);
+               qc->err_mask |= ac_err_mask(ata_wait_idle(ap));
+               ata_qc_complete(qc);
                handled = 1;
                break;
 
@@ -635,7 +636,7 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e
        int rc;
 
        if (!printed_version++)
-               printk(KERN_DEBUG DRV_NAME " version " DRV_VERSION "\n");
+               dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
 
        /*
         * If this driver happens to only be useful on Apple's K2, then
@@ -704,7 +705,7 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e
                probe_ent->port[3].scr_addr = base + 0x700;
                break;
        case board_2037x:
-                       probe_ent->n_ports = 2;
+               probe_ent->n_ports = 2;
                break;
        case board_20619:
                probe_ent->n_ports = 4;
@@ -714,7 +715,7 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e
 
                probe_ent->port[2].scr_addr = base + 0x600;
                probe_ent->port[3].scr_addr = base + 0x700;
-                break;
+               break;
        default:
                BUG();
                break;