1 --- a/drivers/mtd/devices/block2mtd.c
2 +++ b/drivers/mtd/devices/block2mtd.c
4 #include <linux/buffer_head.h>
5 #include <linux/mutex.h>
6 #include <linux/mount.h>
7 +#include <linux/list.h>
8 +#include <linux/delay.h>
10 #define ERROR(fmt, args...) printk(KERN_ERR "block2mtd: " fmt "\n" , ## args)
11 #define INFO(fmt, args...) printk(KERN_INFO "block2mtd: " fmt "\n" , ## args)
14 + struct list_head list;
18 +static LIST_HEAD(retry_list);
20 /* Info for the block device */
21 struct block2mtd_dev {
26 +static int block2mtd_setup2(const char *val);
28 /* Static info about the MTD, used in cleanup_module */
29 static LIST_HEAD(blkmtd_device_list);
31 +static int add_retry(const char *val) {
32 + struct retry *r = kmalloc(sizeof(struct retry), GFP_KERNEL);
34 + INIT_LIST_HEAD(&r->list);
36 + list_add(&r->list, &retry_list);
41 +static int __init process_retries(void) {
42 + struct list_head *p, *tmp;
44 + list_for_each_safe(p, tmp, &retry_list) {
45 + struct retry *r = list_entry(p, struct retry, list);
46 + block2mtd_setup2(r->val);
53 +rootfs_initcall(process_retries);
55 static struct page *page_read(struct address_space *mapping, int index)
58 if (token[2] && (strlen(token[2]) + 1 > 80))
59 parse_err("mtd device name too long");
61 - add_device(name, erase_size, token[2]);
62 + if (add_device(name, erase_size, token[2]) == NULL) {
68 --- a/include/asm-generic/vmlinux.lds.h
69 +++ b/include/asm-generic/vmlinux.lds.h
74 - *(.initcallrootfs.init) \
80 +#define INITCALLS_ROOT \
81 + *(.initcallrootfs.init)
84 VMLINUX_SYMBOL(__initcall_start) = .; \
86 VMLINUX_SYMBOL(__initcall_end) = .;
88 +#define INIT_CALLS_ROOT \
89 + VMLINUX_SYMBOL(__root_initcall_start) = .; \
91 + VMLINUX_SYMBOL(__root_initcall_end) = .;
93 #define CON_INITCALL \
94 VMLINUX_SYMBOL(__con_initcall_start) = .; \
95 *(.con_initcall.init) \
98 INIT_SETUP(initsetup_align) \
104 --- a/init/do_mounts.c
105 +++ b/init/do_mounts.c
110 -static unsigned int __initdata root_delay;
111 -static int __init root_delay_setup(char *str)
113 - root_delay = simple_strtoul(str, NULL, 0);
117 __setup("rootflags=", root_data_setup);
118 __setup("rootfstype=", fs_names_setup);
119 -__setup("rootdelay=", root_delay_setup);
121 static void __init get_fs_names(char *page)
128 - printk(KERN_INFO "Waiting %dsec before mounting root device...\n",
130 - ssleep(root_delay);
134 - * wait for the known devices to complete their probing
136 - * Note: this is a potential source of long boot delays.
137 - * For example, it is not atypical to wait 5 seconds here
138 - * for the touchpad of a laptop to initialize.
140 - wait_for_device_probe();
144 if (saved_root_name[0]) {
145 root_device_name = saved_root_name;
146 if (!strncmp(root_device_name, "mtd", 3) ||
150 #ifdef CONFIG_X86_LOCAL_APIC
153 +#include "do_mounts.h"
155 static int kernel_init(void *);
157 @@ -752,12 +753,13 @@
160 extern initcall_t __initcall_start[], __initcall_end[], __early_initcall_end[];
161 +extern initcall_t __root_initcall_start[], __root_initcall_end[];
163 -static void __init do_initcalls(void)
164 +static void __init do_initcalls(initcall_t *start, initcall_t *end)
168 - for (call = __early_initcall_end; call < __initcall_end; call++)
169 + for (call = start; call < end; call++)
170 do_one_initcall(*call);
172 /* Make sure there is no pending stuff from the initcall sequence */
178 + do_initcalls(__early_initcall_end, __initcall_end);
181 static void __init do_pre_smp_initcalls(void)
183 panic("No init found. Try passing init= option to kernel.");
186 +static unsigned int __initdata root_delay;
187 +static int __init root_delay_setup(char *str)
189 + root_delay = simple_strtoul(str, NULL, 0);
192 +__setup("rootdelay=", root_delay_setup);
193 static int __init kernel_init(void * unused)
198 if (sys_access((const char __user *) ramdisk_execute_command, 0) != 0) {
199 ramdisk_execute_command = NULL;
200 - prepare_namespace();
202 + printk(KERN_INFO "Waiting %desc before mounting root device...\n",
204 + ssleep(root_delay);
206 + while (driver_probe_done() != 0)
208 + do_initcalls(__root_initcall_start, __root_initcall_end);
210 + prepare_namespace();