ide: use 'drive->dn & 1' instead of drive->select.b.unit
[safe/jmp/linux-2.6] / drivers / ide / pci / scc_pata.c
index d5e2ba6..0eced0a 100644 (file)
@@ -26,7 +26,6 @@
 #include <linux/module.h>
 #include <linux/pci.h>
 #include <linux/delay.h>
-#include <linux/hdreg.h>
 #include <linux/ide.h>
 #include <linux/init.h>
 
@@ -292,7 +291,7 @@ static void scc_set_dma_mode(ide_drive_t *drive, const u8 speed)
 static void scc_dma_host_set(ide_drive_t *drive, int on)
 {
        ide_hwif_t *hwif = drive->hwif;
-       u8 unit = (drive->select.b.unit & 0x01);
+       u8 unit = drive->dn & 1;
        u8 dma_stat = scc_ide_inb(hwif->dma_base + 4);
 
        if (on)
@@ -354,7 +353,6 @@ static void scc_dma_start(ide_drive_t *drive)
 
        /* start DMA */
        scc_ide_outb(dma_cmd | 1, hwif->dma_base);
-       hwif->dma = 1;
        wmb();
 }
 
@@ -375,7 +373,6 @@ static int __scc_dma_end(ide_drive_t *drive)
        /* purge DMA mappings */
        ide_destroy_dmatable(drive);
        /* verify good DMA status */
-       hwif->dma = 0;
        wmb();
        return (dma_stat & 7) != 4 ? (0x10 | dma_stat) : 0;
 }
@@ -400,7 +397,7 @@ static int scc_dma_end(ide_drive_t *drive)
        /* errata A308 workaround: Step5 (check data loss) */
        /* We don't check non ide_disk because it is limited to UDMA4 */
        if (!(in_be32((void __iomem *)hwif->io_ports.ctl_addr)
-             & ERR_STAT) &&
+             & ATA_ERR) &&
            drive->media == ide_disk && drive->current_speed > XFER_UDMA_4) {
                reg = in_be32((void __iomem *)intsts_port);
                if (!(reg & INTSTS_ACTEINT)) {
@@ -504,7 +501,7 @@ static int scc_dma_test_irq(ide_drive_t *drive)
 
        /* SCC errata A252,A308 workaround: Step4 */
        if ((in_be32((void __iomem *)hwif->io_ports.ctl_addr)
-            & ERR_STAT) &&
+            & ATA_ERR) &&
            (int_stat & INTSTS_INTRQ))
                return 1;
 
@@ -512,9 +509,6 @@ static int scc_dma_test_irq(ide_drive_t *drive)
        if (int_stat & INTSTS_IOIRQS)
                return 1;
 
-       if (!drive->waiting_for_dma)
-               printk(KERN_WARNING "%s: (%s) called while not waiting\n",
-                       drive->name, __func__);
        return 0;
 }
 
@@ -588,7 +582,7 @@ static int scc_ide_setup_pci_device(struct pci_dev *dev,
        struct scc_ports *ports = pci_get_drvdata(dev);
        struct ide_host *host;
        hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL };
-       int i;
+       int i, rc;
 
        memset(&hw, 0, sizeof(hw));
        for (i = 0; i <= 8; i++)
@@ -597,11 +591,9 @@ static int scc_ide_setup_pci_device(struct pci_dev *dev,
        hw.dev = &dev->dev;
        hw.chipset = ide_pci;
 
-       host = ide_host_alloc(d, hws);
-       if (host == NULL)
-               return -ENOMEM;
-
-       ide_host_register(host, d, hws);
+       rc = ide_host_add(d, hws, &host);
+       if (rc)
+               return rc;
 
        ports->host = host;
 
@@ -829,7 +821,7 @@ static void __devinit init_iops_scc(ide_hwif_t *hwif)
        init_mmio_iops_scc(hwif);
 }
 
-static u8 __devinit scc_cable_detect(ide_hwif_t *hwif)
+static u8 scc_cable_detect(ide_hwif_t *hwif)
 {
        return ATA_CBL_PATA80;
 }
@@ -956,7 +948,7 @@ static struct pci_driver driver = {
        .name = "SCC IDE",
        .id_table = scc_pci_tbl,
        .probe = scc_init_one,
-       .remove = scc_remove,
+       .remove = __devexit_p(scc_remove),
 };
 
 static int scc_ide_init(void)