Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

PCI Hotplug: make cpcihp driver use modern apis

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>

+8 -2
+1 -1
drivers/pci/hotplug/Kconfig
··· 119 119 120 120 config HOTPLUG_PCI_CPCI_GENERIC 121 121 tristate "Generic port I/O CompactPCI Hotplug driver" 122 - depends on HOTPLUG_PCI_CPCI && X86 && PCI_LEGACY 122 + depends on HOTPLUG_PCI_CPCI && X86 123 123 help 124 124 Say Y here if you have a CompactPCI system card that exposes the #ENUM 125 125 hotswap signal as a bit in a system register that can be read through
+7 -1
drivers/pci/hotplug/cpcihp_generic.c
··· 154 154 if(!r) 155 155 return -EBUSY; 156 156 157 - dev = pci_find_slot(bridge_busnr, PCI_DEVFN(bridge_slot, 0)); 157 + bus = pci_find_bus(0, bridge_busnr); 158 + if (!bus) { 159 + err("Invalid bus number %d", bridge_busnr); 160 + return -EINVAL; 161 + } 162 + dev = pci_get_slot(bus, PCI_DEVFN(bridge_slot, 0)); 158 163 if(!dev || dev->hdr_type != PCI_HEADER_TYPE_BRIDGE) { 159 164 err("Invalid bridge device %s", bridge); 160 165 return -EINVAL; 161 166 } 162 167 bus = dev->subordinate; 168 + pci_dev_put(dev); 163 169 164 170 memset(&generic_hpc, 0, sizeof (struct cpci_hp_controller)); 165 171 generic_hpc_ops.query_enum = query_enum;