diff options
| author | Alexander Chiang <achiang@hp.com> | 2009-06-10 15:55:14 -0400 |
|---|---|---|
| committer | Len Brown <len.brown@intel.com> | 2009-06-17 23:22:15 -0400 |
| commit | 275582031f9b3597a1b973f3ff617adfe639faa2 (patch) | |
| tree | 7f4e2c43709758108042e5dcf9b89d756e5bf8e5 /drivers/pci | |
| parent | ce597bb42aa84bc73db80509b7c37e7fbc0b75c4 (diff) | |
ACPI: Introduce acpi_is_root_bridge()
Returns whether an ACPI CA node is a PCI root bridge or not.
This API is generically useful, and shouldn't just be a hotplug function.
The implementation becomes much simpler as well.
Signed-off-by: Alex Chiang <achiang@hp.com>
Acked-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/pci')
| -rw-r--r-- | drivers/pci/hotplug/acpi_pcihp.c | 40 | ||||
| -rw-r--r-- | drivers/pci/hotplug/acpiphp_glue.c | 2 |
2 files changed, 3 insertions, 39 deletions
diff --git a/drivers/pci/hotplug/acpi_pcihp.c b/drivers/pci/hotplug/acpi_pcihp.c index fbc63d5e459f..eb159587d0bf 100644 --- a/drivers/pci/hotplug/acpi_pcihp.c +++ b/drivers/pci/hotplug/acpi_pcihp.c | |||
| @@ -354,7 +354,7 @@ acpi_status acpi_get_hp_params_from_firmware(struct pci_bus *bus, | |||
| 354 | status = acpi_run_hpp(handle, hpp); | 354 | status = acpi_run_hpp(handle, hpp); |
| 355 | if (ACPI_SUCCESS(status)) | 355 | if (ACPI_SUCCESS(status)) |
| 356 | break; | 356 | break; |
| 357 | if (acpi_root_bridge(handle)) | 357 | if (acpi_is_root_bridge(handle)) |
| 358 | break; | 358 | break; |
| 359 | status = acpi_get_parent(handle, &phandle); | 359 | status = acpi_get_parent(handle, &phandle); |
| 360 | if (ACPI_FAILURE(status)) | 360 | if (ACPI_FAILURE(status)) |
| @@ -428,7 +428,7 @@ int acpi_get_hp_hw_control_from_firmware(struct pci_dev *pdev, u32 flags) | |||
| 428 | status = acpi_run_oshp(handle); | 428 | status = acpi_run_oshp(handle); |
| 429 | if (ACPI_SUCCESS(status)) | 429 | if (ACPI_SUCCESS(status)) |
| 430 | goto got_one; | 430 | goto got_one; |
| 431 | if (acpi_root_bridge(handle)) | 431 | if (acpi_is_root_bridge(handle)) |
| 432 | break; | 432 | break; |
| 433 | chandle = handle; | 433 | chandle = handle; |
| 434 | status = acpi_get_parent(chandle, &handle); | 434 | status = acpi_get_parent(chandle, &handle); |
| @@ -449,42 +449,6 @@ got_one: | |||
| 449 | } | 449 | } |
| 450 | EXPORT_SYMBOL(acpi_get_hp_hw_control_from_firmware); | 450 | EXPORT_SYMBOL(acpi_get_hp_hw_control_from_firmware); |
| 451 | 451 | ||
| 452 | /* acpi_root_bridge - check to see if this acpi object is a root bridge | ||
| 453 | * | ||
| 454 | * @handle - the acpi object in question. | ||
| 455 | */ | ||
| 456 | int acpi_root_bridge(acpi_handle handle) | ||
| 457 | { | ||
| 458 | acpi_status status; | ||
| 459 | struct acpi_device_info *info; | ||
| 460 | struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; | ||
| 461 | int i; | ||
| 462 | |||
| 463 | status = acpi_get_object_info(handle, &buffer); | ||
| 464 | if (ACPI_SUCCESS(status)) { | ||
| 465 | info = buffer.pointer; | ||
| 466 | if ((info->valid & ACPI_VALID_HID) && | ||
| 467 | !strcmp(PCI_ROOT_HID_STRING, | ||
| 468 | info->hardware_id.value)) { | ||
| 469 | kfree(buffer.pointer); | ||
| 470 | return 1; | ||
| 471 | } | ||
| 472 | if (info->valid & ACPI_VALID_CID) { | ||
| 473 | for (i=0; i < info->compatibility_id.count; i++) { | ||
| 474 | if (!strcmp(PCI_ROOT_HID_STRING, | ||
| 475 | info->compatibility_id.id[i].value)) { | ||
| 476 | kfree(buffer.pointer); | ||
| 477 | return 1; | ||
| 478 | } | ||
| 479 | } | ||
| 480 | } | ||
| 481 | kfree(buffer.pointer); | ||
| 482 | } | ||
| 483 | return 0; | ||
| 484 | } | ||
| 485 | EXPORT_SYMBOL_GPL(acpi_root_bridge); | ||
| 486 | |||
| 487 | |||
| 488 | static int is_ejectable(acpi_handle handle) | 452 | static int is_ejectable(acpi_handle handle) |
| 489 | { | 453 | { |
| 490 | acpi_status status; | 454 | acpi_status status; |
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c index 3a6064bce561..fc6636e3300b 100644 --- a/drivers/pci/hotplug/acpiphp_glue.c +++ b/drivers/pci/hotplug/acpiphp_glue.c | |||
| @@ -1631,7 +1631,7 @@ find_root_bridges(acpi_handle handle, u32 lvl, void *context, void **rv) | |||
| 1631 | { | 1631 | { |
| 1632 | int *count = (int *)context; | 1632 | int *count = (int *)context; |
| 1633 | 1633 | ||
| 1634 | if (acpi_root_bridge(handle)) { | 1634 | if (acpi_is_root_bridge(handle)) { |
| 1635 | acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY, | 1635 | acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY, |
| 1636 | handle_hotplug_event_bridge, NULL); | 1636 | handle_hotplug_event_bridge, NULL); |
| 1637 | (*count)++; | 1637 | (*count)++; |
