Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 28250
b: refs/heads/master
c: 92c9be9
h: refs/heads/master
v: v3
  • Loading branch information
MUNEDA Takahiro authored and Greg Kroah-Hartman committed Jun 19, 2006
1 parent f7589f9 commit 29ff9ea
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 39 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e55dea58c5609aece6156a6cd2306b820a7794ef
refs/heads/master: 92c9be95549632da09088320f202fa5c05b21ddf
71 changes: 33 additions & 38 deletions trunk/drivers/pci/hotplug/acpiphp_glue.c
Original file line number Diff line number Diff line change
Expand Up @@ -797,36 +797,6 @@ static unsigned char acpiphp_max_busnr(struct pci_bus *bus)
}



/**
* get_func - get a pointer to acpiphp_func given a slot, device
* @slot: slot to search
* @dev: pci_dev struct to match.
*
* This function will increase the reference count of pci_dev,
* so callers should call pci_dev_put when complete.
*
*/
static struct acpiphp_func *
get_func(struct acpiphp_slot *slot, struct pci_dev *dev)
{
struct acpiphp_func *func = NULL;
struct pci_bus *bus = slot->bridge->pci_bus;
struct pci_dev *pdev;

list_for_each_entry(func, &slot->funcs, sibling) {
pdev = pci_get_slot(bus, PCI_DEVFN(slot->device,
func->function));
if (pdev) {
if (pdev == dev)
break;
pci_dev_put(pdev);
}
}
return func;
}


/**
* acpiphp_bus_add - add a new bus to acpi subsystem
* @func: acpiphp_func of the bridge
Expand Down Expand Up @@ -872,6 +842,28 @@ static int acpiphp_bus_add(struct acpiphp_func *func)
}


/**
* acpiphp_bus_trim - trim a bus from acpi subsystem
* @handle: handle to acpi namespace
*
*/
int acpiphp_bus_trim(acpi_handle handle)
{
struct acpi_device *device;
int retval;

retval = acpi_bus_get_device(handle, &device);
if (retval) {
dbg("acpi_device not found\n");
return retval;
}

retval = acpi_bus_trim(device, 1);
if (retval)
err("cannot remove from acpi list\n");

return retval;
}

/**
* enable_device - enable, configure a slot
Expand Down Expand Up @@ -918,19 +910,17 @@ static int enable_device(struct acpiphp_slot *slot)
if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE ||
dev->hdr_type == PCI_HEADER_TYPE_CARDBUS) {
max = pci_scan_bridge(bus, dev, max, pass);
if (pass && dev->subordinate) {
if (pass && dev->subordinate)
pci_bus_size_bridges(dev->subordinate);
func = get_func(slot, dev);
if (func) {
acpiphp_bus_add(func);
/* side effect of get_func */
pci_dev_put(dev);
}
}
}
}
}

list_for_each (l, &slot->funcs) {
func = list_entry(l, struct acpiphp_func, sibling);
acpiphp_bus_add(func);
}

pci_bus_assign_resources(bus);
acpiphp_sanitize_bus(bus);
pci_enable_bridges(bus);
Expand Down Expand Up @@ -967,6 +957,11 @@ static int disable_device(struct acpiphp_slot *slot)

list_for_each (l, &slot->funcs) {
func = list_entry(l, struct acpiphp_func, sibling);

acpiphp_bus_trim(func->handle);
/* try to remove anyway.
* acpiphp_bus_add might have been failed */

if (!func->pci_dev)
continue;

Expand Down

0 comments on commit 29ff9ea

Please sign in to comment.