Skip to content

Commit 1dfc86a

Browse files
committed
x86/pci: Reorder pci_mmcfg_arch_map() definition before calls
The typical style is to define functions before calling them. Move pci_mmcfg_arch_map() and pci_mmcfg_arch_unmap() earlier so they're defined before they're called. No functional change intended. Link: https://lore.kernel.org/r/[email protected] Tested-by: Tomasz Pala <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]>
1 parent f126598 commit 1dfc86a

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

arch/x86/pci/mmconfig_64.c

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,25 @@ static void __iomem *mcfg_ioremap(struct pci_mmcfg_region *cfg)
111111
return addr;
112112
}
113113

114+
int pci_mmcfg_arch_map(struct pci_mmcfg_region *cfg)
115+
{
116+
cfg->virt = mcfg_ioremap(cfg);
117+
if (!cfg->virt) {
118+
pr_err("can't map ECAM at %pR\n", &cfg->res);
119+
return -ENOMEM;
120+
}
121+
122+
return 0;
123+
}
124+
125+
void pci_mmcfg_arch_unmap(struct pci_mmcfg_region *cfg)
126+
{
127+
if (cfg && cfg->virt) {
128+
iounmap(cfg->virt + PCI_MMCFG_BUS_OFFSET(cfg->start_bus));
129+
cfg->virt = NULL;
130+
}
131+
}
132+
114133
int __init pci_mmcfg_arch_init(void)
115134
{
116135
struct pci_mmcfg_region *cfg;
@@ -133,22 +152,3 @@ void __init pci_mmcfg_arch_free(void)
133152
list_for_each_entry(cfg, &pci_mmcfg_list, list)
134153
pci_mmcfg_arch_unmap(cfg);
135154
}
136-
137-
int pci_mmcfg_arch_map(struct pci_mmcfg_region *cfg)
138-
{
139-
cfg->virt = mcfg_ioremap(cfg);
140-
if (!cfg->virt) {
141-
pr_err("can't map ECAM at %pR\n", &cfg->res);
142-
return -ENOMEM;
143-
}
144-
145-
return 0;
146-
}
147-
148-
void pci_mmcfg_arch_unmap(struct pci_mmcfg_region *cfg)
149-
{
150-
if (cfg && cfg->virt) {
151-
iounmap(cfg->virt + PCI_MMCFG_BUS_OFFSET(cfg->start_bus));
152-
cfg->virt = NULL;
153-
}
154-
}

0 commit comments

Comments
 (0)