]> Pileus Git - ~andy/linux/blobdiff - drivers/ide/setup-pci.c
drivers/edac: i5000 code tidying
[~andy/linux] / drivers / ide / setup-pci.c
index 462ed3006c3082124a0a9622dfa9e7448116cc09..c88d33225cf91542cc490c00d9e37d026bdf5895 100644 (file)
@@ -18,7 +18,6 @@
  *  configuration of all PCI IDE interfaces present in a system.  
  */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
@@ -102,7 +101,7 @@ static ide_hwif_t *ide_match_hwif(unsigned long io_base, u8 bootable, const char
                                return hwif;    /* pick an unused entry */
                }
        }
-       for (h = 0; h < 2; ++h) {
+       for (h = 0; h < 2 && h < MAX_HWIFS; ++h) {
                hwif = ide_hwifs + h;
                if (hwif->chipset == ide_unknown)
                        return hwif;    /* pick an unused entry */
@@ -506,11 +505,6 @@ static void ide_hwif_setup_dma(struct pci_dev *dev, ide_pci_device_t *d, ide_hwi
                }
        }
 }
-
-#ifndef CONFIG_IDEDMA_PCI_AUTO
-#warning CONFIG_IDEDMA_PCI_AUTO=n support is obsolete, and will be removed soon.
-#endif
-
 #endif /* CONFIG_BLK_DEV_IDEDMA_PCI*/
 
 /**
@@ -694,13 +688,8 @@ static int do_ide_setup_pci_device(struct pci_dev *dev, ide_pci_device_t *d,
                                goto out;
                }
                if (noisy)
-#ifdef __sparc__
-                       printk(KERN_INFO "%s: 100%% native mode on irq %s\n",
-                              d->name, __irq_itoa(pciirq));
-#else
                        printk(KERN_INFO "%s: 100%% native mode on irq %d\n",
                                d->name, pciirq);
-#endif
        }
 
        /* FIXME: silent failure can happen */
@@ -713,6 +702,7 @@ out:
 
 int ide_setup_pci_device(struct pci_dev *dev, ide_pci_device_t *d)
 {
+       ide_hwif_t *hwif = NULL, *mate = NULL;
        ata_index_t index_list;
        int ret;
 
@@ -721,11 +711,19 @@ int ide_setup_pci_device(struct pci_dev *dev, ide_pci_device_t *d)
                goto out;
 
        if ((index_list.b.low & 0xf0) != 0xf0)
-               probe_hwif_init_with_fixup(&ide_hwifs[index_list.b.low], d->fixup);
+               hwif = &ide_hwifs[index_list.b.low];
        if ((index_list.b.high & 0xf0) != 0xf0)
-               probe_hwif_init_with_fixup(&ide_hwifs[index_list.b.high], d->fixup);
+               mate = &ide_hwifs[index_list.b.high];
+
+       if (hwif)
+               probe_hwif_init_with_fixup(hwif, d->fixup);
+       if (mate)
+               probe_hwif_init_with_fixup(mate, d->fixup);
 
-       create_proc_ide_interfaces();
+       if (hwif)
+               ide_proc_register_port(hwif);
+       if (mate)
+               ide_proc_register_port(mate);
 out:
        return ret;
 }
@@ -759,13 +757,22 @@ int ide_setup_pci_devices(struct pci_dev *dev1, struct pci_dev *dev2,
                }
        }
 
-       create_proc_ide_interfaces();
+       for (i = 0; i < 2; i++) {
+               u8 idx[2] = { index_list[i].b.low, index_list[i].b.high };
+               int j;
+
+               for (j = 0; j < 2; j++) {
+                       if ((idx[j] & 0xf0) != 0xf0)
+                               ide_proc_register_port(ide_hwifs + idx[j]);
+               }
+       }
 out:
        return ret;
 }
 
 EXPORT_SYMBOL_GPL(ide_setup_pci_devices);
 
+#ifdef CONFIG_IDEPCI_PCIBUS_ORDER
 /*
  *     Module interfaces
  */
@@ -789,10 +796,11 @@ static LIST_HEAD(ide_pci_drivers);
  *     Returns are the same as for pci_register_driver
  */
 
-int __ide_pci_register_driver(struct pci_driver *driver, struct module *module)
+int __ide_pci_register_driver(struct pci_driver *driver, struct module *module,
+                             const char *mod_name)
 {
        if(!pre_init)
-               return __pci_register_driver(driver, module);
+               return __pci_register_driver(driver, module, mod_name);
        driver->driver.owner = module;
        list_add_tail(&driver->node, &ide_pci_drivers);
        return 0;
@@ -800,24 +808,6 @@ int __ide_pci_register_driver(struct pci_driver *driver, struct module *module)
 
 EXPORT_SYMBOL_GPL(__ide_pci_register_driver);
 
-/**
- *     ide_unregister_pci_driver       -       unregister an IDE driver
- *     @driver: driver to remove
- *
- *     Unregister a currently installed IDE driver. Returns are the same
- *     as for pci_unregister_driver
- */
-void ide_pci_unregister_driver(struct pci_driver *driver)
-{
-       if(!pre_init)
-               pci_unregister_driver(driver);
-       else
-               list_del(&driver->node);
-}
-
-EXPORT_SYMBOL_GPL(ide_pci_unregister_driver);
-
 /**
  *     ide_scan_pcidev         -       find an IDE driver for a device
  *     @dev: PCI device to check
@@ -868,11 +858,11 @@ void __init ide_scan_pcibus (int scan_direction)
 
        pre_init = 0;
        if (!scan_direction) {
-               while ((dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
+               while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
                        ide_scan_pcidev(dev);
                }
        } else {
-               while ((dev = pci_find_device_reverse(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
+               while ((dev = pci_get_device_reverse(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
                        ide_scan_pcidev(dev);
                }
        }
@@ -882,10 +872,15 @@ void __init ide_scan_pcibus (int scan_direction)
         *      are post init.
         */
 
-       list_for_each_safe(l, n, &ide_pci_drivers)
-       {
+       list_for_each_safe(l, n, &ide_pci_drivers) {
                list_del(l);
                d = list_entry(l, struct pci_driver, node);
-               __pci_register_driver(d, d->driver.owner);
+               if (__pci_register_driver(d, d->driver.owner,
+                                       d->driver.mod_name)) {
+                       printk(KERN_ERR "%s: failed to register driver "
+                                       "for %s\n", __FUNCTION__,
+                                        d->driver.mod_name);
+               }
        }
 }
+#endif