diff options
Diffstat (limited to 'arch/x86/pci/mmconfig_64.c')
-rw-r--r-- | arch/x86/pci/mmconfig_64.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/arch/x86/pci/mmconfig_64.c b/arch/x86/pci/mmconfig_64.c index 78fa05c6c04d..ed1f479b4d0e 100644 --- a/arch/x86/pci/mmconfig_64.c +++ b/arch/x86/pci/mmconfig_64.c | |||
@@ -14,16 +14,13 @@ | |||
14 | 14 | ||
15 | static char __iomem *get_virt(unsigned int seg, unsigned bus) | 15 | static char __iomem *get_virt(unsigned int seg, unsigned bus) |
16 | { | 16 | { |
17 | int i; | ||
18 | struct pci_mmcfg_region *cfg; | 17 | struct pci_mmcfg_region *cfg; |
19 | 18 | ||
20 | for (i = 0; i < pci_mmcfg_config_num; ++i) { | 19 | list_for_each_entry(cfg, &pci_mmcfg_list, list) |
21 | cfg = &pci_mmcfg_config[i]; | ||
22 | if (cfg->segment == seg && | 20 | if (cfg->segment == seg && |
23 | (cfg->start_bus <= bus) && | 21 | (cfg->start_bus <= bus) && |
24 | (cfg->end_bus >= bus)) | 22 | (cfg->end_bus >= bus)) |
25 | return cfg->virt; | 23 | return cfg->virt; |
26 | } | ||
27 | 24 | ||
28 | /* Fall back to type 0 */ | 25 | /* Fall back to type 0 */ |
29 | return NULL; | 26 | return NULL; |
@@ -122,11 +119,9 @@ static void __iomem * __init mcfg_ioremap(struct pci_mmcfg_region *cfg) | |||
122 | 119 | ||
123 | int __init pci_mmcfg_arch_init(void) | 120 | int __init pci_mmcfg_arch_init(void) |
124 | { | 121 | { |
125 | int i; | ||
126 | struct pci_mmcfg_region *cfg; | 122 | struct pci_mmcfg_region *cfg; |
127 | 123 | ||
128 | for (i = 0; i < pci_mmcfg_config_num; ++i) { | 124 | list_for_each_entry(cfg, &pci_mmcfg_list, list) { |
129 | cfg = &pci_mmcfg_config[i]; | ||
130 | cfg->virt = mcfg_ioremap(cfg); | 125 | cfg->virt = mcfg_ioremap(cfg); |
131 | if (!cfg->virt) { | 126 | if (!cfg->virt) { |
132 | printk(KERN_ERR "PCI: Cannot map mmconfig aperture for " | 127 | printk(KERN_ERR "PCI: Cannot map mmconfig aperture for " |
@@ -142,11 +137,9 @@ int __init pci_mmcfg_arch_init(void) | |||
142 | 137 | ||
143 | void __init pci_mmcfg_arch_free(void) | 138 | void __init pci_mmcfg_arch_free(void) |
144 | { | 139 | { |
145 | int i; | ||
146 | struct pci_mmcfg_region *cfg; | 140 | struct pci_mmcfg_region *cfg; |
147 | 141 | ||
148 | for (i = 0; i < pci_mmcfg_config_num; ++i) { | 142 | list_for_each_entry(cfg, &pci_mmcfg_list, list) { |
149 | cfg = &pci_mmcfg_config[i]; | ||
150 | if (cfg->virt) { | 143 | if (cfg->virt) { |
151 | iounmap(cfg->virt + PCI_MMCFG_BUS_OFFSET(cfg->start_bus)); | 144 | iounmap(cfg->virt + PCI_MMCFG_BUS_OFFSET(cfg->start_bus)); |
152 | cfg->virt = NULL; | 145 | cfg->virt = NULL; |