aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorTaku Izumi <izumi.taku@jp.fujitsu.com>2012-09-21 03:03:58 -0400
committerBjorn Helgaas <bhelgaas@google.com>2012-09-24 17:29:40 -0400
commit0f2bdfedcb8f1aaf54a0ab4934f33b3710692a19 (patch)
treee2b9d8c64f8cdcc81d1ad7b01ee9c208b2a5513b /drivers/acpi
parent55bfe3c0c561783655a8ff2f6f3f19ac1362b132 (diff)
PCI/ACPI: Use acpi_pci_root info rather than looking it up again
This patch changes the function signature of walk_root_bridge(). We can omit _STA, _SEG, and _BBN evaluation by passing not acpi_handle but acpi_pci_root. Now that acpi_pci_slot_add() which is the only caller of walk_root_bridge() gets acpi_pci_root structure, changing signature of walk_root_bridge() is reasonable. [bhelgaas: changelog] Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/pci_slot.c35
1 files changed, 5 insertions, 30 deletions
diff --git a/drivers/acpi/pci_slot.c b/drivers/acpi/pci_slot.c
index 8051ffa7609..d22585f21ae 100644
--- a/drivers/acpi/pci_slot.c
+++ b/drivers/acpi/pci_slot.c
@@ -233,45 +233,20 @@ out:
233 233
234/* 234/*
235 * walk_root_bridge - generic root bridge walker 235 * walk_root_bridge - generic root bridge walker
236 * @handle: points to an acpi_pci_root 236 * @root: poiner of an acpi_pci_root
237 * @user_function: user callback for slot objects 237 * @user_function: user callback for slot objects
238 * 238 *
239 * Call user_function for all objects underneath this root bridge. 239 * Call user_function for all objects underneath this root bridge.
240 * Walk p2p bridges underneath us and call user_function on those too. 240 * Walk p2p bridges underneath us and call user_function on those too.
241 */ 241 */
242static int 242static int
243walk_root_bridge(acpi_handle handle, acpi_walk_callback user_function) 243walk_root_bridge(struct acpi_pci_root *root, acpi_walk_callback user_function)
244{ 244{
245 int seg, bus;
246 unsigned long long tmp;
247 acpi_status status; 245 acpi_status status;
248 acpi_handle dummy_handle; 246 acpi_handle handle = root->device->handle;
249 struct pci_bus *pci_bus; 247 struct pci_bus *pci_bus = root->bus;
250 struct callback_args context; 248 struct callback_args context;
251 249
252 /* If the bridge doesn't have _STA, we assume it is always there */
253 status = acpi_get_handle(handle, "_STA", &dummy_handle);
254 if (ACPI_SUCCESS(status)) {
255 status = acpi_evaluate_integer(handle, "_STA", NULL, &tmp);
256 if (ACPI_FAILURE(status)) {
257 info("%s: _STA evaluation failure\n", __func__);
258 return 0;
259 }
260 if ((tmp & ACPI_STA_DEVICE_FUNCTIONING) == 0)
261 /* don't register this object */
262 return 0;
263 }
264
265 status = acpi_evaluate_integer(handle, "_SEG", NULL, &tmp);
266 seg = ACPI_SUCCESS(status) ? tmp : 0;
267
268 status = acpi_evaluate_integer(handle, "_BBN", NULL, &tmp);
269 bus = ACPI_SUCCESS(status) ? tmp : 0;
270
271 pci_bus = pci_find_bus(seg, bus);
272 if (!pci_bus)
273 return 0;
274
275 context.pci_bus = pci_bus; 250 context.pci_bus = pci_bus;
276 context.user_function = user_function; 251 context.user_function = user_function;
277 context.root_handle = handle; 252 context.root_handle = handle;
@@ -299,7 +274,7 @@ acpi_pci_slot_add(struct acpi_pci_root *root)
299{ 274{
300 acpi_status status; 275 acpi_status status;
301 276
302 status = walk_root_bridge(root->device->handle, register_slot); 277 status = walk_root_bridge(root, register_slot);
303 if (ACPI_FAILURE(status)) 278 if (ACPI_FAILURE(status))
304 err("%s: register_slot failure - %d\n", __func__, status); 279 err("%s: register_slot failure - %d\n", __func__, status);
305 280