[package] iw: update to 0.9.17
[openwrt.git] / target / linux / olpc / patches-2.6.27 / 300-block2mtd_init.patch
1 --- a/arch/x86/kernel/vmlinux_32.lds.S
2 +++ b/arch/x86/kernel/vmlinux_32.lds.S
3 @@ -135,6 +135,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 @@ -375,12 +375,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 #define PERCPU(align) \
99 . = ALIGN(align); \
100 VMLINUX_SYMBOL(__per_cpu_start) = .; \
101 --- a/init/do_mounts.c
102 +++ b/init/do_mounts.c
103 @@ -174,16 +174,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 @@ -359,18 +351,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 - /* wait for the known devices to complete their probing */
131 - while (driver_probe_done() != 0)
132 - msleep(100);
133 -
134 - md_run_setup();
135 -
136 if (saved_root_name[0]) {
137 root_device_name = saved_root_name;
138 if (!strncmp(root_device_name, "mtd", 3) ||
139 --- a/init/main.c
140 +++ b/init/main.c
141 @@ -70,6 +70,7 @@
142 #ifdef CONFIG_X86_LOCAL_APIC
143 #include <asm/smp.h>
144 #endif
145 +#include "do_mounts.h"
146
147 /*
148 * This is one of the first .c files built. Error out early if we have compiler
149 @@ -745,12 +746,13 @@ int do_one_initcall(initcall_t fn)
150
151
152 extern initcall_t __initcall_start[], __initcall_end[], __early_initcall_end[];
153 +extern initcall_t __root_initcall_start[], __root_initcall_end[];
154
155 -static void __init do_initcalls(void)
156 +static void __init do_initcalls(initcall_t *start, initcall_t *end)
157 {
158 initcall_t *call;
159
160 - for (call = __early_initcall_end; call < __initcall_end; call++)
161 + for (call = start; call < end; call++)
162 do_one_initcall(*call);
163
164 /* Make sure there is no pending stuff from the initcall sequence */
165 @@ -772,7 +774,7 @@ static void __init do_basic_setup(void)
166 usermodehelper_init();
167 driver_init();
168 init_irq_proc();
169 - do_initcalls();
170 + do_initcalls(__early_initcall_end, __initcall_end);
171 }
172
173 static void __init do_pre_smp_initcalls(void)
174 @@ -833,6 +835,13 @@ static int noinline init_post(void)
175 panic("No init found. Try passing init= option to kernel.");
176 }
177
178 +static unsigned int __initdata root_delay;
179 +static int __init root_delay_setup(char *str)
180 +{
181 + root_delay = simple_strtoul(str, NULL, 0);
182 + return 1;
183 +}
184 +__setup("rootdelay=", root_delay_setup);
185 static int __init kernel_init(void * unused)
186 {
187 lock_kernel();
188 @@ -873,7 +882,16 @@ static int __init kernel_init(void * unu
189
190 if (sys_access((const char __user *) ramdisk_execute_command, 0) != 0) {
191 ramdisk_execute_command = NULL;
192 - prepare_namespace();
193 + if (root_delay) {
194 + printk(KERN_INFO "Waiting %desc before mounting root device...\n",
195 + root_delay);
196 + ssleep(root_delay);
197 + }
198 + while (driver_probe_done() != 0)
199 + msleep(100);
200 + md_run_setup();
201 + do_initcalls(__root_initcall_start, __root_initcall_end);
202 + prepare_namespace();
203 }
204
205 /*
This page took 0.056514 seconds and 5 git commands to generate.