svwks: small cleanup
[pandora-kernel.git] / drivers / ide / pci / serverworks.c
index 5100b82..81a0742 100644 (file)
@@ -29,7 +29,6 @@
  *
  */
 
-#include <linux/config.h>
 #include <linux/types.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
@@ -340,13 +339,6 @@ fast_ata_pio:
        return 0;
 }
 
-/* This can go soon */
-
-static int svwks_ide_dma_end (ide_drive_t *drive)
-{
-       return __ide_dma_end(drive);
-}
-
 static unsigned int __devinit init_chipset_svwks (struct pci_dev *dev, const char *name)
 {
        unsigned int reg;
@@ -360,7 +352,7 @@ static unsigned int __devinit init_chipset_svwks (struct pci_dev *dev, const cha
 
        /* OSB4 : South Bridge and IDE */
        if (dev->device == PCI_DEVICE_ID_SERVERWORKS_OSB4IDE) {
-               isa_dev = pci_find_device(PCI_VENDOR_ID_SERVERWORKS,
+               isa_dev = pci_get_device(PCI_VENDOR_ID_SERVERWORKS,
                          PCI_DEVICE_ID_SERVERWORKS_OSB4, NULL);
                if (isa_dev) {
                        pci_read_config_dword(isa_dev, 0x64, &reg);
@@ -381,7 +373,7 @@ static unsigned int __devinit init_chipset_svwks (struct pci_dev *dev, const cha
                if (!(PCI_FUNC(dev->devfn) & 1)) {
                        struct pci_dev * findev = NULL;
                        u32 reg4c = 0;
-                       findev = pci_find_device(PCI_VENDOR_ID_SERVERWORKS,
+                       findev = pci_get_device(PCI_VENDOR_ID_SERVERWORKS,
                                PCI_DEVICE_ID_SERVERWORKS_CSB5, NULL);
                        if (findev) {
                                pci_read_config_dword(findev, 0x4C, &reg4c);
@@ -389,6 +381,7 @@ static unsigned int __devinit init_chipset_svwks (struct pci_dev *dev, const cha
                                reg4c |=  0x00000040;
                                reg4c |=  0x00000020;
                                pci_write_config_dword(findev, 0x4C, reg4c);
+                               pci_dev_put(findev);
                        }
                        outb_p(0x06, 0x0c00);
                        dev->irq = inb_p(0x0c01);
@@ -396,12 +389,13 @@ static unsigned int __devinit init_chipset_svwks (struct pci_dev *dev, const cha
                        struct pci_dev * findev = NULL;
                        u8 reg41 = 0;
 
-                       findev = pci_find_device(PCI_VENDOR_ID_SERVERWORKS,
+                       findev = pci_get_device(PCI_VENDOR_ID_SERVERWORKS,
                                        PCI_DEVICE_ID_SERVERWORKS_CSB6, NULL);
                        if (findev) {
                                pci_read_config_byte(findev, 0x41, &reg41);
                                reg41 &= ~0x40;
                                pci_write_config_byte(findev, 0x41, reg41);
+                               pci_dev_put(findev);
                        }
                        /*
                         * This is a device pin issue on CSB6.
@@ -536,10 +530,10 @@ static void __devinit init_hwif_svwks (ide_hwif_t *hwif)
        }
 
        hwif->ide_dma_check = &svwks_config_drive_xfer_rate;
-       if (hwif->pci_dev->device == PCI_DEVICE_ID_SERVERWORKS_OSB4IDE)
-               hwif->ide_dma_end = &svwks_ide_dma_end;
-       else if (!(hwif->udma_four))
-               hwif->udma_four = ata66_svwks(hwif);
+       if (hwif->pci_dev->device != PCI_DEVICE_ID_SERVERWORKS_OSB4IDE) {
+               if (!hwif->udma_four)
+                       hwif->udma_four = ata66_svwks(hwif);
+       }
        if (!noautodma)
                hwif->autodma = 1;
 
@@ -550,21 +544,6 @@ static void __devinit init_hwif_svwks (ide_hwif_t *hwif)
        hwif->drives[1].autotune = (!(dma_stat & 0x40));
 }
 
-/*
- * We allow the BM-DMA driver to only work on enabled interfaces.
- */
-static void __devinit init_dma_svwks (ide_hwif_t *hwif, unsigned long dmabase)
-{
-       struct pci_dev *dev = hwif->pci_dev;
-
-       if (((dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE) ||
-            (dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2)) &&
-           (!(PCI_FUNC(dev->devfn) & 1)) && (hwif->channel))
-               return;
-
-       ide_setup_dma(hwif, dmabase, 8);
-}
-
 static int __devinit init_setup_svwks (struct pci_dev *dev, ide_pci_device_t *d)
 {
        return ide_setup_pci_device(dev, d);
@@ -599,7 +578,6 @@ static ide_pci_device_t serverworks_chipsets[] __devinitdata = {
                .init_setup     = init_setup_svwks,
                .init_chipset   = init_chipset_svwks,
                .init_hwif      = init_hwif_svwks,
-               .init_dma       = init_dma_svwks,
                .channels       = 2,
                .autodma        = AUTODMA,
                .bootable       = ON_BOARD,
@@ -608,7 +586,6 @@ static ide_pci_device_t serverworks_chipsets[] __devinitdata = {
                .init_setup     = init_setup_csb6,
                .init_chipset   = init_chipset_svwks,
                .init_hwif      = init_hwif_svwks,
-               .init_dma       = init_dma_svwks,
                .channels       = 2,
                .autodma        = AUTODMA,
                .bootable       = ON_BOARD,
@@ -617,7 +594,6 @@ static ide_pci_device_t serverworks_chipsets[] __devinitdata = {
                .init_setup     = init_setup_csb6,
                .init_chipset   = init_chipset_svwks,
                .init_hwif      = init_hwif_svwks,
-               .init_dma       = init_dma_svwks,
                .channels       = 1,    /* 2 */
                .autodma        = AUTODMA,
                .bootable       = ON_BOARD,
@@ -626,7 +602,6 @@ static ide_pci_device_t serverworks_chipsets[] __devinitdata = {
                .init_setup     = init_setup_svwks,
                .init_chipset   = init_chipset_svwks,
                .init_hwif      = init_hwif_svwks,
-               .init_dma       = init_dma_svwks,
                .channels       = 1,    /* 2 */
                .autodma        = AUTODMA,
                .bootable       = ON_BOARD,
@@ -650,11 +625,11 @@ static int __devinit svwks_init_one(struct pci_dev *dev, const struct pci_device
 }
 
 static struct pci_device_id svwks_pci_tbl[] = {
-       { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_OSB4IDE), 0},
-       { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB5IDE), 1},
-       { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB6IDE), 2},
-       { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2), 3},
-       { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_HT1000IDE), 4},
+       { PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_OSB4IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
+       { PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB5IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1},
+       { PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB6IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 2},
+       { PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 3},
+       { PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_HT1000IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 4},
        { 0, },
 };
 MODULE_DEVICE_TABLE(pci, svwks_pci_tbl);
@@ -665,7 +640,7 @@ static struct pci_driver driver = {
        .probe          = svwks_init_one,
 };
 
-static int svwks_ide_init(void)
+static int __init svwks_ide_init(void)
 {
        return ide_pci_register_driver(&driver);
 }