aboutsummaryrefslogtreecommitdiff
path: root/drivers/pci/hotplug/acpiphp_glue.c
diff options
context:
space:
mode:
authorAlex Chiang <achiang@hp.com>2009-09-10 12:34:09 -0600
committerJesse Barnes <jbarnes@virtuousgeek.org>2009-09-14 08:46:58 -0700
commit7f53866932fd08add06ee2f93ead129949158490 (patch)
treef01520afe3708a3c79233fa67d50124f0dac6335 /drivers/pci/hotplug/acpiphp_glue.c
parent6edd7679db92376ca54f328d6b0f12291c2dab35 (diff)
PCI Hotplug: convert acpi_pci_detect_ejectable() to take an acpi_handle
acpi_pci_detect_ejectable() goes through effort to convert its struct pci_bus arg to an acpi_handle, but every time we use this interface, we already have the handle available. So let's just use the handle instead of converting back and forth. Reviewed-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> Tested-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> Signed-off-by: Alex Chiang <achiang@hp.com> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/pci/hotplug/acpiphp_glue.c')
-rw-r--r--drivers/pci/hotplug/acpiphp_glue.c33
1 files changed, 11 insertions, 22 deletions
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
index e72e0adc068..680c33635b6 100644
--- a/drivers/pci/hotplug/acpiphp_glue.c
+++ b/drivers/pci/hotplug/acpiphp_glue.c
@@ -62,22 +62,6 @@ static void acpiphp_sanitize_bus(struct pci_bus *bus);
static void acpiphp_set_hpp_values(acpi_handle handle, struct pci_bus *bus);
static void handle_hotplug_event_func(acpi_handle handle, u32 type, void *context);
-static struct pci_bus *pci_bus_from_handle(acpi_handle handle)
-{
- struct pci_bus *pbus;
- struct acpi_pci_root *root;
-
- root = acpi_pci_find_root(handle);
- if (root)
- pbus = root->bus;
- else {
- struct pci_dev *pdev = acpi_get_pci_dev(handle);
- pbus = pdev->subordinate;
- pci_dev_put(pdev);
- }
- return pbus;
-}
-
/* callback routine to check for the existence of a pci dock device */
static acpi_status
is_pci_dock_device(acpi_handle handle, u32 lvl, void *context, void **rv)
@@ -279,11 +263,7 @@ register_slot(acpi_handle handle, u32 lvl, void *context, void **rv)
/* see if it's worth looking at this bridge */
static int detect_ejectable_slots(acpi_handle handle)
{
- int found;
- struct pci_bus *pbus;
-
- pbus = pci_bus_from_handle(handle);
- found = acpi_pci_detect_ejectable(pbus);
+ int found = acpi_pci_detect_ejectable(handle);
if (!found) {
acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, (u32)1,
is_pci_dock_device, (void *)&found, NULL);
@@ -1364,7 +1344,16 @@ static void acpiphp_sanitize_bus(struct pci_bus *bus)
/* Program resources in newly inserted bridge */
static int acpiphp_configure_bridge (acpi_handle handle)
{
- struct pci_bus *bus = pci_bus_from_handle(handle);
+ struct pci_bus *bus;
+
+ if (acpi_is_root_bridge(handle)) {
+ struct acpi_pci_root *root = acpi_pci_find_root(handle);
+ bus = root->bus;
+ } else {
+ struct pci_dev *pdev = acpi_get_pci_dev(handle);
+ bus = pdev->subordinate;
+ pci_dev_put(pdev);
+ }
pci_bus_size_bridges(bus);
pci_bus_assign_resources(bus);