diff options
author | Luck, Tony <tony.luck@intel.com> | 2008-08-15 18:37:48 -0400 |
---|---|---|
committer | Tony Luck <tony.luck@intel.com> | 2008-08-18 18:41:21 -0400 |
commit | 8a20fd52c663b1796e1f01c0fa21d9b24c2936b6 (patch) | |
tree | cef69a7c5117c3ddd0d9cf75d89232ce78f1eee4 /arch/ia64/pci | |
parent | 97653f92c004d322ef27edb168a1b5f31142c6dc (diff) |
[IA64] pci_acpi_scan_root cleanup
The code walks all the acpi _CRS methods to see how many windows
to allocate. It then scans them all again to insert_resource()
for each *even if the first scan found that there were none*.
Move the second scan inside the "if (windows)" clause.
Signed-off-by: Tony Luck <tony.luck@intel.com>
Diffstat (limited to 'arch/ia64/pci')
-rw-r--r-- | arch/ia64/pci/pci.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c index 77b15f80f101..7545037a8625 100644 --- a/arch/ia64/pci/pci.c +++ b/arch/ia64/pci/pci.c | |||
@@ -324,7 +324,6 @@ pcibios_setup_root_windows(struct pci_bus *bus, struct pci_controller *ctrl) | |||
324 | struct pci_bus * __devinit | 324 | struct pci_bus * __devinit |
325 | pci_acpi_scan_root(struct acpi_device *device, int domain, int bus) | 325 | pci_acpi_scan_root(struct acpi_device *device, int domain, int bus) |
326 | { | 326 | { |
327 | struct pci_root_info info; | ||
328 | struct pci_controller *controller; | 327 | struct pci_controller *controller; |
329 | unsigned int windows = 0; | 328 | unsigned int windows = 0; |
330 | struct pci_bus *pbus; | 329 | struct pci_bus *pbus; |
@@ -346,22 +345,24 @@ pci_acpi_scan_root(struct acpi_device *device, int domain, int bus) | |||
346 | acpi_walk_resources(device->handle, METHOD_NAME__CRS, count_window, | 345 | acpi_walk_resources(device->handle, METHOD_NAME__CRS, count_window, |
347 | &windows); | 346 | &windows); |
348 | if (windows) { | 347 | if (windows) { |
348 | struct pci_root_info info; | ||
349 | |||
349 | controller->window = | 350 | controller->window = |
350 | kmalloc_node(sizeof(*controller->window) * windows, | 351 | kmalloc_node(sizeof(*controller->window) * windows, |
351 | GFP_KERNEL, controller->node); | 352 | GFP_KERNEL, controller->node); |
352 | if (!controller->window) | 353 | if (!controller->window) |
353 | goto out2; | 354 | goto out2; |
354 | } | ||
355 | 355 | ||
356 | name = kmalloc(16, GFP_KERNEL); | 356 | name = kmalloc(16, GFP_KERNEL); |
357 | if (!name) | 357 | if (!name) |
358 | goto out3; | 358 | goto out3; |
359 | 359 | ||
360 | sprintf(name, "PCI Bus %04x:%02x", domain, bus); | 360 | sprintf(name, "PCI Bus %04x:%02x", domain, bus); |
361 | info.controller = controller; | 361 | info.controller = controller; |
362 | info.name = name; | 362 | info.name = name; |
363 | acpi_walk_resources(device->handle, METHOD_NAME__CRS, add_window, | 363 | acpi_walk_resources(device->handle, METHOD_NAME__CRS, |
364 | &info); | 364 | add_window, &info); |
365 | } | ||
365 | /* | 366 | /* |
366 | * See arch/x86/pci/acpi.c. | 367 | * See arch/x86/pci/acpi.c. |
367 | * The desired pci bus might already be scanned in a quirk. We | 368 | * The desired pci bus might already be scanned in a quirk. We |