Commit 47ad4279 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

[PATCH] PCI Hotplug: fix up the compaq driver to work properly again.

parent bf4adf9d
...@@ -85,19 +85,20 @@ int cpqhp_configure_device (struct controller* ctrl, struct pci_func* func) ...@@ -85,19 +85,20 @@ int cpqhp_configure_device (struct controller* ctrl, struct pci_func* func)
{ {
unsigned char bus; unsigned char bus;
struct pci_bus *child; struct pci_bus *child;
int rc = 0; int num;
if (func->pci_dev == NULL) if (func->pci_dev == NULL)
func->pci_dev = pci_find_slot(func->bus, (func->device << 3) | (func->function & 0x7)); func->pci_dev = pci_find_slot(func->bus, PCI_DEVFN(func->device, func->function));
//Still NULL ? Well then scan for it ! /* No pci device, we need to create it then */
if (func->pci_dev == NULL) { if (func->pci_dev == NULL) {
dbg("INFO: pci_dev still null\n"); dbg("INFO: pci_dev still null\n");
//this will generate pci_dev structures for all functions, but we will only call this case when lookup fails num = pci_scan_slot(ctrl->pci_dev->bus, PCI_DEVFN(func->device, func->function));
func->pci_dev = pci_scan_slot(ctrl->pci_dev->bus, if (num)
(func->device << 3) + (func->function & 0x7)); pci_bus_add_devices(ctrl->pci_dev->bus);
func->pci_dev = pci_find_slot(func->bus, PCI_DEVFN(func->device, func->function));
if (func->pci_dev == NULL) { if (func->pci_dev == NULL) {
dbg("ERROR: pci_dev still null\n"); dbg("ERROR: pci_dev still null\n");
return 0; return 0;
...@@ -108,10 +109,9 @@ int cpqhp_configure_device (struct controller* ctrl, struct pci_func* func) ...@@ -108,10 +109,9 @@ int cpqhp_configure_device (struct controller* ctrl, struct pci_func* func)
pci_read_config_byte(func->pci_dev, PCI_SECONDARY_BUS, &bus); pci_read_config_byte(func->pci_dev, PCI_SECONDARY_BUS, &bus);
child = (struct pci_bus*) pci_add_new_bus(func->pci_dev->bus, (func->pci_dev), bus); child = (struct pci_bus*) pci_add_new_bus(func->pci_dev->bus, (func->pci_dev), bus);
pci_do_scan_bus(child); pci_do_scan_bus(child);
} }
return rc; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment