- 2.6.17 port work build breaks, but the patch set is relativly stable
[linux-flexiantxendom0-3.2.10.git] / arch / x86_64 / pci / mmconfig.c
index 992ac91..a2060e4 100644 (file)
@@ -75,8 +75,10 @@ static int pci_mmcfg_read(unsigned int seg, unsigned int bus,
        char __iomem *addr;
 
        /* Why do we have this when nobody checks it. How about a BUG()!? -AK */
-       if (unlikely(!value || (bus > 255) || (devfn > 255) || (reg > 4095)))
+       if (unlikely((bus > 255) || (devfn > 255) || (reg > 4095))) {
+               *value = -1;
                return -EINVAL;
+       }
 
        addr = pci_dev_base(seg, bus, devfn);
        if (!addr)
@@ -159,18 +161,18 @@ static __init void unreachable_devices(void)
        }
 }
 
-static int __init pci_mmcfg_init(void)
+void __init pci_mmcfg_init(void)
 {
        int i;
 
        if ((pci_probe & PCI_PROBE_MMCONF) == 0)
-               return 0;
+               return;
 
        acpi_table_parse(ACPI_MCFG, acpi_parse_mcfg);
        if ((pci_mmcfg_config_num == 0) ||
            (pci_mmcfg_config == NULL) ||
            (pci_mmcfg_config[0].base_address == 0))
-               return 0;
+               return;
 
        if (!e820_all_mapped(pci_mmcfg_config[0].base_address,
                        pci_mmcfg_config[0].base_address + MMCONFIG_APER_SIZE,
@@ -184,7 +186,7 @@ static int __init pci_mmcfg_init(void)
        pci_mmcfg_virt = kmalloc(sizeof(*pci_mmcfg_virt) * pci_mmcfg_config_num, GFP_KERNEL);
        if (pci_mmcfg_virt == NULL) {
                printk("PCI: Can not allocate memory for mmconfig structures\n");
-               return 0;
+               return;
        }
        for (i = 0; i < pci_mmcfg_config_num; ++i) {
                pci_mmcfg_virt[i].cfg = &pci_mmcfg_config[i];
@@ -192,7 +194,7 @@ static int __init pci_mmcfg_init(void)
                if (!pci_mmcfg_virt[i].virt) {
                        printk("PCI: Cannot map mmconfig aperture for segment %d\n",
                               pci_mmcfg_config[i].pci_segment_group_number);
-                       return 0;
+                       return;
                }
                printk(KERN_INFO "PCI: Using MMCONFIG at %x\n", pci_mmcfg_config[i].base_address);
        }
@@ -201,8 +203,4 @@ static int __init pci_mmcfg_init(void)
 
        raw_pci_ops = &pci_mmcfg;
        pci_probe = (pci_probe & ~PCI_PROBE_MASK) | PCI_PROBE_MMCONF;
-
-       return 0;
 }
-
-arch_initcall(pci_mmcfg_init);