- Call driver_init() from init/main.c::do_basic_setup().
This ensures that all the driver model subsystems are initialized before
any drivers or devices can be registered.
It nearly frees up the core and postcore initcall levels, making them
available for other kernel code to use freely.
obj-y := core.o sys.o interface.o power.o bus.o \
driver.o class.o intf.o platform.o \
- cpu.o firmware.o
+ cpu.o firmware.o init.o
obj-$(CONFIG_NUMA) += node.o memblk.o
obj-y += fs/
obj-$(CONFIG_HOTPLUG) += hotplug.o
subsystem_unregister(&bus->subsys);
}
-static int __init bus_subsys_init(void)
+int __init buses_init(void)
{
return subsystem_register(&bus_subsys);
}
-core_initcall(bus_subsys_init);
EXPORT_SYMBOL(bus_for_each_dev);
EXPORT_SYMBOL(bus_for_each_drv);
subsystem_unregister(&cls->subsys);
}
-static int __init class_subsys_init(void)
+int __init classes_init(void)
{
return subsystem_register(&class_subsys);
}
-core_initcall(class_subsys_init);
-
EXPORT_SYMBOL(devclass_create_file);
EXPORT_SYMBOL(devclass_remove_file);
EXPORT_SYMBOL(devclass_register);
put_device(dev);
}
-static int __init device_subsys_init(void)
+int __init devices_init(void)
{
return subsystem_register(&devices_subsys);
}
-core_initcall(device_subsys_init);
-
EXPORT_SYMBOL(device_initialize);
EXPORT_SYMBOL(device_add);
EXPORT_SYMBOL(device_register);
}
-static int __init register_cpu_type(void)
+int __init cpu_dev_init(void)
{
devclass_register(&cpu_devclass);
return driver_register(&cpu_driver);
}
-postcore_initcall(register_cpu_type);
subsystem_unregister(s);
}
-static int __init firmware_init(void)
+int __init firmware_init(void)
{
return subsystem_register(&firmware_subsys);
}
-core_initcall(firmware_init);
-
EXPORT_SYMBOL(firmware_register);
EXPORT_SYMBOL(firmware_unregister);
--- /dev/null
+
+#include <linux/device.h>
+#include <linux/init.h>
+
+extern int devices_init(void);
+extern int buses_init(void);
+extern int classes_init(void);
+extern int firmware_init(void);
+extern int sys_bus_init(void);
+extern int cpu_dev_init(void);
+
+/**
+ * driver_init - initialize driver model.
+ *
+ * Call the driver model init functions to initialize their
+ * subsystems. Called early from init/main.c.
+ */
+
+void __init driver_init(void)
+{
+ /* These are the core pieces */
+ devices_init();
+ buses_init();
+ classes_init();
+ firmware_init();
+
+ /* These are also core pieces, but must come after the
+ * core core pieces.
+ */
+ sys_bus_init();
+ cpu_dev_init();
+}
.name = "system",
};
-static int sys_bus_init(void)
+int __init sys_bus_init(void)
{
bus_register(&system_bus_type);
return device_register(&system_bus);
}
-postcore_initcall(sys_bus_init);
EXPORT_SYMBOL(system_bus_type);
EXPORT_SYMBOL(sys_device_register);
EXPORT_SYMBOL(sys_device_unregister);
extern void radix_tree_init(void);
extern void free_initmem(void);
extern void populate_rootfs(void);
+extern void driver_init(void);
#ifdef CONFIG_TC
extern void tc_init(void);
*/
static void __init do_basic_setup(void)
{
+ driver_init();
+
#ifdef CONFIG_SYSCTL
sysctl_init();
#endif