PCI Hotplug: make cpcihp driver use modern apis
authorGreg Kroah-Hartman <gregkh@suse.de>
Wed, 13 Feb 2008 21:32:24 +0000 (13:32 -0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 21 Apr 2008 04:46:56 +0000 (21:46 -0700)
This removes the depandancy of the cpcihp driver from the PCI_LEGACY
config option by removing its usage of the pci_find_bus() function.

Cc: Kristen Carlson Accardi <kristen.c.accardi@intel.com>
Signed-off-by: Scott Murray <scottm@somanetworks.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/pci/hotplug/Kconfig
drivers/pci/hotplug/cpcihp_generic.c

index 2cdd8326f1363d5916db000f1af7f2f6a5b22a2a..17fb3d6b7c73992f4f96b4690c153209f77d28e5 100644 (file)
@@ -119,7 +119,7 @@ config HOTPLUG_PCI_CPCI_ZT5550
 
 config HOTPLUG_PCI_CPCI_GENERIC
        tristate "Generic port I/O CompactPCI Hotplug driver"
-       depends on HOTPLUG_PCI_CPCI && X86 && PCI_LEGACY
+       depends on HOTPLUG_PCI_CPCI && X86
        help
          Say Y here if you have a CompactPCI system card that exposes the #ENUM
          hotswap signal as a bit in a system register that can be read through
index f3852a6b74eada8b19bc732faf27b383897a9075..148fb463b81ccc522ad76be7b48b75b369d89390 100644 (file)
@@ -154,12 +154,18 @@ static int __init cpcihp_generic_init(void)
        if(!r)
                return -EBUSY;
 
-       dev = pci_find_slot(bridge_busnr, PCI_DEVFN(bridge_slot, 0));
+       bus = pci_find_bus(0, bridge_busnr);
+       if (!bus) {
+               err("Invalid bus number %d", bridge_busnr);
+               return -EINVAL;
+       }
+       dev = pci_get_slot(bus, PCI_DEVFN(bridge_slot, 0));
        if(!dev || dev->hdr_type != PCI_HEADER_TYPE_BRIDGE) {
                err("Invalid bridge device %s", bridge);
                return -EINVAL;
        }
        bus = dev->subordinate;
+       pci_dev_put(dev);
 
        memset(&generic_hpc, 0, sizeof (struct cpci_hp_controller));
        generic_hpc_ops.query_enum = query_enum;