summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuck, Tony <tony.luck@intel.com>2008-08-15 15:37:48 -0700
committerTony Luck <tony.luck@intel.com>2008-08-18 15:41:21 -0700
commit8a20fd52c663b1796e1f01c0fa21d9b24c2936b6 (patch)
treecef69a7c5117c3ddd0d9cf75d89232ce78f1eee4
parent97653f92c004d322ef27edb168a1b5f31142c6dc (diff)
downloadop-kernel-dev-8a20fd52c663b1796e1f01c0fa21d9b24c2936b6.zip
op-kernel-dev-8a20fd52c663b1796e1f01c0fa21d9b24c2936b6.tar.gz
[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>
-rw-r--r--arch/ia64/pci/pci.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c
index 77b15f8..7545037 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)
struct pci_bus * __devinit
pci_acpi_scan_root(struct acpi_device *device, int domain, int bus)
{
- struct pci_root_info info;
struct pci_controller *controller;
unsigned int windows = 0;
struct pci_bus *pbus;
@@ -346,22 +345,24 @@ pci_acpi_scan_root(struct acpi_device *device, int domain, int bus)
acpi_walk_resources(device->handle, METHOD_NAME__CRS, count_window,
&windows);
if (windows) {
+ struct pci_root_info info;
+
controller->window =
kmalloc_node(sizeof(*controller->window) * windows,
GFP_KERNEL, controller->node);
if (!controller->window)
goto out2;
- }
- name = kmalloc(16, GFP_KERNEL);
- if (!name)
- goto out3;
+ name = kmalloc(16, GFP_KERNEL);
+ if (!name)
+ goto out3;
- sprintf(name, "PCI Bus %04x:%02x", domain, bus);
- info.controller = controller;
- info.name = name;
- acpi_walk_resources(device->handle, METHOD_NAME__CRS, add_window,
- &info);
+ sprintf(name, "PCI Bus %04x:%02x", domain, bus);
+ info.controller = controller;
+ info.name = name;
+ acpi_walk_resources(device->handle, METHOD_NAME__CRS,
+ add_window, &info);
+ }
/*
* See arch/x86/pci/acpi.c.
* The desired pci bus might already be scanned in a quirk. We
OpenPOWER on IntegriCloud