浏览代码

x86/pci: removing subsys_initcall ordering dependencies

So far subsys_initcalls has been executed in this order depending on
the object order in the Makefile:

arch/x86/pci/visws.c:subsys_initcall(pcibios_init);
arch/x86/pci/numa.c:subsys_initcall(pci_numa_init);
arch/x86/pci/acpi.c:subsys_initcall(pci_acpi_init);
arch/x86/pci/legacy.c:subsys_initcall(pci_legacy_init);
arch/x86/pci/irq.c:subsys_initcall(pcibios_irq_init);
arch/x86/pci/common.c:subsys_initcall(pcibios_init);

This patch removes the ordering dependency. There is now only one
subsys_initcall function that contains subsystem initialization code
with a defined order.

Signed-off-by: Robert Richter <robert.richter@amd.com>
Acked-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Robert Richter 17 年之前
父节点
当前提交
8dd779b19c
共有 9 个文件被更改,包括 36 次插入21 次删除
  1. 0 4
      arch/x86/pci/Makefile
  2. 1 2
      arch/x86/pci/acpi.c
  3. 1 3
      arch/x86/pci/common.c
  4. 2 2
      arch/x86/pci/init.c
  5. 1 4
      arch/x86/pci/irq.c
  6. 10 1
      arch/x86/pci/legacy.c
  7. 7 1
      arch/x86/pci/numa.c
  8. 8 3
      arch/x86/pci/pci.h
  9. 6 1
      arch/x86/pci/visws.c

+ 0 - 4
arch/x86/pci/Makefile

@@ -6,10 +6,6 @@ obj-$(CONFIG_PCI_DIRECT)	+= direct.o
 obj-$(CONFIG_PCI_OLPC)		+= olpc.o
 obj-$(CONFIG_PCI_OLPC)		+= olpc.o
 
 
 pci-y				:= fixup.o
 pci-y				:= fixup.o
-
-# Do not change the ordering here. There is a nasty init function
-# ordering dependency which breaks when you move acpi.o below
-# legacy/irq.o
 pci-$(CONFIG_ACPI)		+= acpi.o
 pci-$(CONFIG_ACPI)		+= acpi.o
 pci-y				+= legacy.o irq.o
 pci-y				+= legacy.o irq.o
 
 

+ 1 - 2
arch/x86/pci/acpi.c

@@ -223,7 +223,7 @@ struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_device *device, int do
 	return bus;
 	return bus;
 }
 }
 
 
-static int __init pci_acpi_init(void)
+int __init pci_acpi_init(void)
 {
 {
 	struct pci_dev *dev = NULL;
 	struct pci_dev *dev = NULL;
 
 
@@ -257,4 +257,3 @@ static int __init pci_acpi_init(void)
 
 
 	return 0;
 	return 0;
 }
 }
-subsys_initcall(pci_acpi_init);

+ 1 - 3
arch/x86/pci/common.c

@@ -384,7 +384,7 @@ struct pci_bus * __devinit pcibios_scan_root(int busnum)
 
 
 extern u8 pci_cache_line_size;
 extern u8 pci_cache_line_size;
 
 
-static int __init pcibios_init(void)
+int __init pcibios_init(void)
 {
 {
 	struct cpuinfo_x86 *c = &boot_cpu_data;
 	struct cpuinfo_x86 *c = &boot_cpu_data;
 
 
@@ -411,8 +411,6 @@ static int __init pcibios_init(void)
 	return 0;
 	return 0;
 }
 }
 
 
-subsys_initcall(pcibios_init);
-
 char * __devinit  pcibios_setup(char *str)
 char * __devinit  pcibios_setup(char *str)
 {
 {
 	if (!strcmp(str, "off")) {
 	if (!strcmp(str, "off")) {

+ 2 - 2
arch/x86/pci/init.c

@@ -4,7 +4,7 @@
 
 
 /* arch_initcall has too random ordering, so call the initializers
 /* arch_initcall has too random ordering, so call the initializers
    in the right sequence from here. */
    in the right sequence from here. */
-static __init int pci_access_init(void)
+static __init int pci_arch_init(void)
 {
 {
 #ifdef CONFIG_PCI_DIRECT
 #ifdef CONFIG_PCI_DIRECT
 	int type = 0;
 	int type = 0;
@@ -40,4 +40,4 @@ static __init int pci_access_init(void)
 
 
 	return 0;
 	return 0;
 }
 }
-arch_initcall(pci_access_init);
+arch_initcall(pci_arch_init);

+ 1 - 4
arch/x86/pci/irq.c

@@ -1107,7 +1107,7 @@ static struct dmi_system_id __initdata pciirq_dmi_table[] = {
 	{ }
 	{ }
 };
 };
 
 
-static int __init pcibios_irq_init(void)
+int __init pcibios_irq_init(void)
 {
 {
 	DBG(KERN_DEBUG "PCI: IRQ init\n");
 	DBG(KERN_DEBUG "PCI: IRQ init\n");
 
 
@@ -1142,9 +1142,6 @@ static int __init pcibios_irq_init(void)
 	return 0;
 	return 0;
 }
 }
 
 
-subsys_initcall(pcibios_irq_init);
-
-
 static void pirq_penalize_isa_irq(int irq, int active)
 static void pirq_penalize_isa_irq(int irq, int active)
 {
 {
 	/*
 	/*

+ 10 - 1
arch/x86/pci/legacy.c

@@ -55,4 +55,13 @@ static int __init pci_legacy_init(void)
 	return 0;
 	return 0;
 }
 }
 
 
-subsys_initcall(pci_legacy_init);
+int __init pci_subsys_init(void)
+{
+#ifdef CONFIG_ACPI
+	pci_acpi_init();
+#endif
+	pci_legacy_init();
+	pcibios_irq_init();
+	pcibios_init();
+}
+subsys_initcall(pci_subsys_init);

+ 7 - 1
arch/x86/pci/numa.c

@@ -177,4 +177,10 @@ static int __init pci_numa_init(void)
 	return 0;
 	return 0;
 }
 }
 
 
-subsys_initcall(pci_numa_init);
+static __init int pci_subsys_init(void)
+{
+	pci_numa_init();
+	pcibios_irq_init();
+	pcibios_init();
+}
+subsys_initcall(pci_subsys_init);

+ 8 - 3
arch/x86/pci/pci.h

@@ -39,9 +39,6 @@ enum pci_bf_sort_state {
 	pci_dmi_bf,
 	pci_dmi_bf,
 };
 };
 
 
-extern void __init dmi_check_pciprobe(void);
-extern void __init dmi_check_skip_isa_align(void);
-
 /* pci-i386.c */
 /* pci-i386.c */
 
 
 extern unsigned int pcibios_max_latency;
 extern unsigned int pcibios_max_latency;
@@ -99,10 +96,18 @@ extern struct pci_raw_ops *raw_pci_ext_ops;
 
 
 extern struct pci_raw_ops pci_direct_conf1;
 extern struct pci_raw_ops pci_direct_conf1;
 
 
+/* arch_initcall level */
 extern int pci_direct_probe(void);
 extern int pci_direct_probe(void);
 extern void pci_direct_init(int type);
 extern void pci_direct_init(int type);
 extern void pci_pcbios_init(void);
 extern void pci_pcbios_init(void);
 extern int pci_olpc_init(void);
 extern int pci_olpc_init(void);
+extern void __init dmi_check_pciprobe(void);
+extern void __init dmi_check_skip_isa_align(void);
+
+/* some common used subsys_initcalls */
+extern int __init pci_acpi_init(void);
+extern int __init pcibios_irq_init(void);
+extern int __init pcibios_init(void);
 
 
 /* pci-mmconfig.c */
 /* pci-mmconfig.c */
 
 

+ 6 - 1
arch/x86/pci/visws.c

@@ -105,4 +105,9 @@ static int __init pci_visws_init(void)
 	return 0;
 	return 0;
 }
 }
 
 
-subsys_initcall(pci_visws_init);
+static __init int pci_subsys_init(void)
+{
+	pci_visws_init();
+	pcibios_init();
+}
+subsys_initcall(pci_subsys_init);