Merge branch 'hwmon-for-linus' of git://jdelvare.pck.nerim.net/jdelvare-2.6
[pandora-kernel.git] / drivers / ide / pci / alim15x3.c
index d419e4b..4debd18 100644 (file)
@@ -507,17 +507,15 @@ static int config_chipset_for_dma (ide_drive_t *drive)
  *
  *     Configure a drive for DMA operation. If DMA is not possible we
  *     drop the drive into PIO mode instead.
- *
- *     FIXME: exactly what are we trying to return here
  */
+
 static int ali15x3_config_drive_for_dma(ide_drive_t *drive)
 {
        ide_hwif_t *hwif        = HWIF(drive);
        struct hd_driveid *id   = drive->id;
 
        if ((m5229_revision<=0x20) && (drive->media!=ide_disk))
-               return hwif->ide_dma_off_quietly(drive);
+               goto no_dma_set;
 
        drive->init_speed = 0;
 
@@ -552,9 +550,10 @@ try_dma_modes:
 ata_pio:
                hwif->tuneproc(drive, 255);
 no_dma_set:
-               return hwif->ide_dma_off_quietly(drive);
+               return -1;
        }
-       return hwif->ide_dma_on(drive);
+
+       return 0;
 }
 
 /**
@@ -586,11 +585,11 @@ static unsigned int __devinit init_chipset_ali15x3 (struct pci_dev *dev, const c
 {
        unsigned long flags;
        u8 tmpbyte;
-       struct pci_dev *north = pci_find_slot(0, PCI_DEVFN(0,0));
+       struct pci_dev *north = pci_get_slot(dev->bus, PCI_DEVFN(0,0));
 
        pci_read_config_byte(dev, PCI_REVISION_ID, &m5229_revision);
 
-       isa_dev = pci_find_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, NULL);
+       isa_dev = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, NULL);
 
 #if defined(DISPLAY_ALI_TIMINGS) && defined(CONFIG_PROC_FS)
        if (!ali_proc) {
@@ -613,8 +612,7 @@ static unsigned int __devinit init_chipset_ali15x3 (struct pci_dev *dev, const c
                 * clear bit 7
                 */
                pci_write_config_byte(dev, 0x4b, tmpbyte & 0x7F);
-               local_irq_restore(flags);
-               return 0;
+               goto out;
        }
 
        /*
@@ -637,10 +635,8 @@ static unsigned int __devinit init_chipset_ali15x3 (struct pci_dev *dev, const c
         * box without a device at 0:0.0. The ALi bridge will be at
         * 0:0.0 so if we didn't find one we know what is cooking.
         */
-       if (north && north->vendor != PCI_VENDOR_ID_AL) {
-               local_irq_restore(flags);
-               return 0;
-       }
+       if (north && north->vendor != PCI_VENDOR_ID_AL)
+               goto out;
 
        if (m5229_revision < 0xC5 && isa_dev)
        {       
@@ -661,6 +657,9 @@ static unsigned int __devinit init_chipset_ali15x3 (struct pci_dev *dev, const c
                        pci_write_config_byte(isa_dev, 0x79, tmpbyte | 0x02);
                }
        }
+out:
+       pci_dev_put(north);
+       pci_dev_put(isa_dev);
        local_irq_restore(flags);
        return 0;
 }
@@ -852,8 +851,8 @@ static void __devinit init_dma_ali15x3 (ide_hwif_t *hwif, unsigned long dmabase)
 {
        if (m5229_revision < 0x20)
                return;
-       if (!(hwif->channel))
-               hwif->OUTB(hwif->INB(dmabase+2) & 0x60, dmabase+2);
+       if (!hwif->channel)
+               outb(inb(dmabase + 2) & 0x60, dmabase + 2);
        ide_setup_dma(hwif, dmabase, 8);
 }
 
@@ -907,7 +906,7 @@ static struct pci_driver driver = {
        .probe          = alim15x3_init_one,
 };
 
-static int ali15x3_ide_init(void)
+static int __init ali15x3_ide_init(void)
 {
        return ide_pci_register_driver(&driver);
 }