From: Hannes Reinecke <hare@suse.de>

Currently most driver events are not sent out when using initramfs as
driver_init() (which triggers the events) is called before init_workqueues.

This patch rearranges the init calls so that the hotplug event queue is
enabled prior to calling driver_init(), hence we're getting all hotplug
events again.

Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/include/linux/kmod.h |    1 +
 25-akpm/init/main.c          |    6 +++++-
 25-akpm/kernel/kmod.c        |    4 +---
 3 files changed, 7 insertions(+), 4 deletions(-)

diff -puN init/main.c~enable-all-events-for-initramfs init/main.c
--- 25/init/main.c~enable-all-events-for-initramfs	2004-08-15 01:46:50.179285688 -0700
+++ 25-akpm/init/main.c	2004-08-15 01:48:49.422158016 -0700
@@ -31,6 +31,7 @@
 #include <linux/tty.h>
 #include <linux/gfp.h>
 #include <linux/percpu.h>
+#include <linux/kmod.h>
 #include <linux/kernel_stat.h>
 #include <linux/security.h>
 #include <linux/workqueue.h>
@@ -628,6 +629,10 @@ static void __init do_initcalls(void)
  */
 static void __init do_basic_setup(void)
 {
+	/* drivers will send hotplug events */
+	init_workqueues();
+	usermodehelper_init();
+
 	driver_init();
 
 #ifdef CONFIG_SYSCTL
@@ -637,7 +642,6 @@ static void __init do_basic_setup(void)
 	/* Networking initialization needs a process context */ 
 	sock_init();
 
-	init_workqueues();
 	do_initcalls();
 }
 
diff -puN kernel/kmod.c~enable-all-events-for-initramfs kernel/kmod.c
--- 25/kernel/kmod.c~enable-all-events-for-initramfs	2004-08-15 01:46:50.180285536 -0700
+++ 25-akpm/kernel/kmod.c	2004-08-15 01:46:50.185284776 -0700
@@ -272,10 +272,8 @@ int call_usermodehelper(char *path, char
 }
 EXPORT_SYMBOL(call_usermodehelper);
 
-static __init int usermodehelper_init(void)
+void __init usermodehelper_init(void)
 {
 	khelper_wq = create_singlethread_workqueue("khelper");
 	BUG_ON(!khelper_wq);
-	return 0;
 }
-core_initcall(usermodehelper_init);
diff -puN include/linux/kmod.h~enable-all-events-for-initramfs include/linux/kmod.h
--- 25/include/linux/kmod.h~enable-all-events-for-initramfs	2004-08-15 01:47:26.064830256 -0700
+++ 25-akpm/include/linux/kmod.h	2004-08-15 01:47:56.538197600 -0700
@@ -35,6 +35,7 @@ static inline int request_module(const c
 
 #define try_then_request_module(x, mod...) ((x) ?: (request_module(mod), (x)))
 extern int call_usermodehelper(char *path, char *argv[], char *envp[], int wait);
+extern void usermodehelper_init(void);
 
 #ifdef CONFIG_HOTPLUG
 extern char hotplug_path [];
_