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/acpi/pci_root.c | |
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/acpi/pci_root.c')
-rw-r--r-- | drivers/acpi/pci_root.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index ca8dba3b40b9..888cb9f5c5fb 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c | |||
@@ -142,6 +142,30 @@ acpi_handle acpi_get_pci_rootbridge_handle(unsigned int seg, unsigned int bus) | |||
142 | 142 | ||
143 | EXPORT_SYMBOL_GPL(acpi_get_pci_rootbridge_handle); | 143 | EXPORT_SYMBOL_GPL(acpi_get_pci_rootbridge_handle); |
144 | 144 | ||
145 | /** | ||
146 | * acpi_is_root_bridge - determine whether an ACPI CA node is a PCI root bridge | ||
147 | * @handle - the ACPI CA node in question. | ||
148 | * | ||
149 | * Note: we could make this API take a struct acpi_device * instead, but | ||
150 | * for now, it's more convenient to operate on an acpi_handle. | ||
151 | */ | ||
152 | int acpi_is_root_bridge(acpi_handle handle) | ||
153 | { | ||
154 | int ret; | ||
155 | struct acpi_device *device; | ||
156 | |||
157 | ret = acpi_bus_get_device(handle, &device); | ||
158 | if (ret) | ||
159 | return 0; | ||
160 | |||
161 | ret = acpi_match_device_ids(device, root_device_ids); | ||
162 | if (ret) | ||
163 | return 0; | ||
164 | else | ||
165 | return 1; | ||
166 | } | ||
167 | EXPORT_SYMBOL_GPL(acpi_is_root_bridge); | ||
168 | |||
145 | static acpi_status | 169 | static acpi_status |
146 | get_root_bridge_busnr_callback(struct acpi_resource *resource, void *data) | 170 | get_root_bridge_busnr_callback(struct acpi_resource *resource, void *data) |
147 | { | 171 | { |