ar71xx: add driver for the USB LED on the WNDR3700
[openwrt.git] / target / linux / olpc / patches-2.6.30 / 300-block2mtd_init.patch
1 --- a/arch/x86/kernel/vmlinux_32.lds.S
2 +++ b/arch/x86/kernel/vmlinux_32.lds.S
3 @@ -136,6 +136,12 @@ SECTIONS
4 INITCALLS
5 __initcall_end = .;
6 }
7 + .root_initcall.init : AT(ADDR(.root_initcall.init) - LOAD_OFFSET) {
8 + __root_initcall_start = .;
9 + INITCALLS_ROOT
10 + __root_initcall_end = .;
11 + }
12 +
13 .con_initcall.init : AT(ADDR(.con_initcall.init) - LOAD_OFFSET) {
14 __con_initcall_start = .;
15 *(.con_initcall.init)
16 --- a/drivers/mtd/devices/block2mtd.c
17 +++ b/drivers/mtd/devices/block2mtd.c
18 @@ -18,10 +18,18 @@
19 #include <linux/buffer_head.h>
20 #include <linux/mutex.h>
21 #include <linux/mount.h>
22 +#include <linux/list.h>
23 +#include <linux/delay.h>
24
25 #define ERROR(fmt, args...) printk(KERN_ERR "block2mtd: " fmt "\n" , ## args)
26 #define INFO(fmt, args...) printk(KERN_INFO "block2mtd: " fmt "\n" , ## args)
27
28 +struct retry {
29 + struct list_head list;
30 + const char *val;
31 +};
32 +
33 +static LIST_HEAD(retry_list);
34
35 /* Info for the block device */
36 struct block2mtd_dev {
37 @@ -33,10 +41,34 @@ struct block2mtd_dev {
38 char devname[0];
39 };
40
41 +static int block2mtd_setup2(const char *val);
42
43 /* Static info about the MTD, used in cleanup_module */
44 static LIST_HEAD(blkmtd_device_list);
45
46 +static int add_retry(const char *val) {
47 + struct retry *r = kmalloc(sizeof(struct retry), GFP_KERNEL);
48 +
49 + INIT_LIST_HEAD(&r->list);
50 + r->val = val;
51 + list_add(&r->list, &retry_list);
52 +
53 + return 0;
54 +}
55 +
56 +static int __init process_retries(void) {
57 + struct list_head *p, *tmp;
58 +
59 + list_for_each_safe(p, tmp, &retry_list) {
60 + struct retry *r = list_entry(p, struct retry, list);
61 + block2mtd_setup2(r->val);
62 + msleep(100);
63 + list_del(p);
64 + kfree(r);
65 + }
66 + return 0;
67 +}
68 +rootfs_initcall(process_retries);
69
70 static struct page *page_read(struct address_space *mapping, int index)
71 {
72 @@ -510,7 +542,9 @@ static int block2mtd_setup2(const char *
73 if (token[2] && (strlen(token[2]) + 1 > 80))
74 parse_err("mtd device name too long");
75
76 - add_device(name, erase_size, token[2]);
77 + if (add_device(name, erase_size, token[2]) == NULL) {
78 + add_retry(val);
79 + }
80
81 return 0;
82 }
83 --- a/include/asm-generic/vmlinux.lds.h
84 +++ b/include/asm-generic/vmlinux.lds.h
85 @@ -447,12 +447,14 @@
86 *(.initcall4s.init) \
87 *(.initcall5.init) \
88 *(.initcall5s.init) \
89 - *(.initcallrootfs.init) \
90 *(.initcall6.init) \
91 *(.initcall6s.init) \
92 *(.initcall7.init) \
93 *(.initcall7s.init)
94
95 +#define INITCALLS_ROOT \
96 + *(.initcallrootfs.init)
97 +
98 /**
99 * PERCPU_VADDR - define output section for percpu area
100 * @vaddr: explicit base address (optional)
101 --- a/init/do_mounts.c
102 +++ b/init/do_mounts.c
103 @@ -176,16 +176,8 @@ static int __init fs_names_setup(char *s
104 return 1;
105 }
106
107 -static unsigned int __initdata root_delay;
108 -static int __init root_delay_setup(char *str)
109 -{
110 - root_delay = simple_strtoul(str, NULL, 0);
111 - return 1;
112 -}
113 -
114 __setup("rootflags=", root_data_setup);
115 __setup("rootfstype=", fs_names_setup);
116 -__setup("rootdelay=", root_delay_setup);
117
118 static void __init get_fs_names(char *page)
119 {
120 @@ -365,23 +357,6 @@ void __init prepare_namespace(void)
121 {
122 int is_floppy;
123
124 - if (root_delay) {
125 - printk(KERN_INFO "Waiting %dsec before mounting root device...\n",
126 - root_delay);
127 - ssleep(root_delay);
128 - }
129 -
130 - /*
131 - * wait for the known devices to complete their probing
132 - *
133 - * Note: this is a potential source of long boot delays.
134 - * For example, it is not atypical to wait 5 seconds here
135 - * for the touchpad of a laptop to initialize.
136 - */
137 - wait_for_device_probe();
138 -
139 - md_run_setup();
140 -
141 if (saved_root_name[0]) {
142 root_device_name = saved_root_name;
143 if (!strncmp(root_device_name, "mtd", 3) ||
144 --- a/init/main.c
145 +++ b/init/main.c
146 @@ -76,6 +76,7 @@
147 #ifdef CONFIG_X86_LOCAL_APIC
148 #include <asm/smp.h>
149 #endif
150 +#include "do_mounts.h"
151
152 static int kernel_init(void *);
153
154 @@ -752,12 +753,13 @@ int do_one_initcall(initcall_t fn)
155
156
157 extern initcall_t __initcall_start[], __initcall_end[], __early_initcall_end[];
158 +extern initcall_t __root_initcall_start[], __root_initcall_end[];
159
160 -static void __init do_initcalls(void)
161 +static void __init do_initcalls(initcall_t *start, initcall_t *end)
162 {
163 initcall_t *call;
164
165 - for (call = __early_initcall_end; call < __initcall_end; call++)
166 + for (call = start; call < end; call++)
167 do_one_initcall(*call);
168
169 /* Make sure there is no pending stuff from the initcall sequence */
170 @@ -779,7 +781,7 @@ static void __init do_basic_setup(void)
171 usermodehelper_init();
172 driver_init();
173 init_irq_proc();
174 - do_initcalls();
175 + do_initcalls(__early_initcall_end, __initcall_end);
176 }
177
178 static void __init do_pre_smp_initcalls(void)
179 @@ -840,6 +842,13 @@ static noinline int init_post(void)
180 panic("No init found. Try passing init= option to kernel.");
181 }
182
183 +static unsigned int __initdata root_delay;
184 +static int __init root_delay_setup(char *str)
185 +{
186 + root_delay = simple_strtoul(str, NULL, 0);
187 + return 1;
188 +}
189 +__setup("rootdelay=", root_delay_setup);
190 static int __init kernel_init(void * unused)
191 {
192 lock_kernel();
193 @@ -879,7 +888,16 @@ static int __init kernel_init(void * unu
194
195 if (sys_access((const char __user *) ramdisk_execute_command, 0) != 0) {
196 ramdisk_execute_command = NULL;
197 - prepare_namespace();
198 + if (root_delay) {
199 + printk(KERN_INFO "Waiting %desc before mounting root device...\n",
200 + root_delay);
201 + ssleep(root_delay);
202 + }
203 + while (driver_probe_done() != 0)
204 + msleep(100);
205 + md_run_setup();
206 + do_initcalls(__root_initcall_start, __root_initcall_end);
207 + prepare_namespace();
208 }
209
210 /*
This page took 0.069996 seconds and 5 git commands to generate.