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