aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2006-12-11 19:00:47 -0500
committerPaul Mundt <lethal@linux-sh.org>2006-12-11 19:00:47 -0500
commitb641fe016a29fe2c0c7b0d717a5918e3f067a44f (patch)
tree461143f1ed3f43dbbb6c5388020e24add1601ce0 /arch/sh
parente2dfb912d3cea97d8b1d6750abbe9c942b6f73f5 (diff)
sh: Use early_param() for earlyprintk parsing.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh')
-rw-r--r--arch/sh/kernel/early_printk.c20
-rw-r--r--arch/sh/kernel/setup.c27
2 files changed, 16 insertions, 31 deletions
diff --git a/arch/sh/kernel/early_printk.c b/arch/sh/kernel/early_printk.c
index 60340823798a..560b91cdd15c 100644
--- a/arch/sh/kernel/early_printk.c
+++ b/arch/sh/kernel/early_printk.c
@@ -144,16 +144,16 @@ static struct console *early_console =
144 ; 144 ;
145 145
146static int __initdata keep_early; 146static int __initdata keep_early;
147static int early_console_initialized;
147 148
148int __init setup_early_printk(char *opt) 149int __init setup_early_printk(char *buf)
149{ 150{
150 char *space; 151 if (!buf)
151 char buf[256]; 152 return 0;
152 153
153 strlcpy(buf, opt, sizeof(buf)); 154 if (early_console_initialized)
154 space = strchr(buf, ' '); 155 return 0;
155 if (space) 156 early_console_initialized = 1;
156 *space = 0;
157 157
158 if (strstr(buf, "keep")) 158 if (strstr(buf, "keep"))
159 keep_early = 1; 159 keep_early = 1;
@@ -175,12 +175,14 @@ int __init setup_early_printk(char *opt)
175 if (likely(early_console)) 175 if (likely(early_console))
176 register_console(early_console); 176 register_console(early_console);
177 177
178 return 1; 178 return 0;
179} 179}
180__setup("earlyprintk=", setup_early_printk); 180early_param("earlyprintk", setup_early_printk);
181 181
182void __init disable_early_printk(void) 182void __init disable_early_printk(void)
183{ 183{
184 if (!early_console_initialized || !early_console)
185 return;
184 if (!keep_early) { 186 if (!keep_early) {
185 printk("disabling early console\n"); 187 printk("disabling early console\n");
186 unregister_console(early_console); 188 unregister_console(early_console);
diff --git a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c
index fe545bbb1e1f..225f9ea5cdd7 100644
--- a/arch/sh/kernel/setup.c
+++ b/arch/sh/kernel/setup.c
@@ -84,8 +84,7 @@ unsigned long memory_start, memory_end;
84 84
85static inline void parse_cmdline (char ** cmdline_p, char mv_name[MV_NAME_SIZE], 85static inline void parse_cmdline (char ** cmdline_p, char mv_name[MV_NAME_SIZE],
86 struct sh_machine_vector** mvp, 86 struct sh_machine_vector** mvp,
87 unsigned long *mv_io_base, 87 unsigned long *mv_io_base)
88 int *mv_mmio_enable)
89{ 88{
90 char c = ' ', *to = command_line, *from = COMMAND_LINE; 89 char c = ' ', *to = command_line, *from = COMMAND_LINE;
91 int len = 0; 90 int len = 0;
@@ -112,23 +111,6 @@ static inline void parse_cmdline (char ** cmdline_p, char mv_name[MV_NAME_SIZE],
112 } 111 }
113 } 112 }
114 113
115#ifdef CONFIG_EARLY_PRINTK
116 if (c == ' ' && !memcmp(from, "earlyprintk=", 12)) {
117 char *ep_end;
118
119 if (to != command_line)
120 to--;
121
122 from += 12;
123 ep_end = strchr(from, ' ');
124
125 setup_early_printk(from);
126 printk("early console enabled\n");
127
128 from = ep_end;
129 }
130#endif
131
132 if (c == ' ' && !memcmp(from, "sh_mv=", 6)) { 114 if (c == ' ' && !memcmp(from, "sh_mv=", 6)) {
133 char* mv_end; 115 char* mv_end;
134 char* mv_comma; 116 char* mv_comma;
@@ -145,7 +127,6 @@ static inline void parse_cmdline (char ** cmdline_p, char mv_name[MV_NAME_SIZE],
145 int ints[3]; 127 int ints[3];
146 get_options(mv_comma+1, ARRAY_SIZE(ints), ints); 128 get_options(mv_comma+1, ARRAY_SIZE(ints), ints);
147 *mv_io_base = ints[1]; 129 *mv_io_base = ints[1];
148 *mv_mmio_enable = ints[2];
149 mv_len = mv_comma - from; 130 mv_len = mv_comma - from;
150 } else { 131 } else {
151 mv_len = mv_end - from; 132 mv_len = mv_end - from;
@@ -158,6 +139,7 @@ static inline void parse_cmdline (char ** cmdline_p, char mv_name[MV_NAME_SIZE],
158 139
159 *mvp = get_mv_byname(mv_name); 140 *mvp = get_mv_byname(mv_name);
160 } 141 }
142
161 c = *(from++); 143 c = *(from++);
162 if (!c) 144 if (!c)
163 break; 145 break;
@@ -177,9 +159,8 @@ static int __init sh_mv_setup(char **cmdline_p)
177 struct sh_machine_vector *mv = NULL; 159 struct sh_machine_vector *mv = NULL;
178 char mv_name[MV_NAME_SIZE] = ""; 160 char mv_name[MV_NAME_SIZE] = "";
179 unsigned long mv_io_base = 0; 161 unsigned long mv_io_base = 0;
180 int mv_mmio_enable = 0;
181 162
182 parse_cmdline(cmdline_p, mv_name, &mv, &mv_io_base, &mv_mmio_enable); 163 parse_cmdline(cmdline_p, mv_name, &mv, &mv_io_base);
183 164
184#ifdef CONFIG_SH_UNKNOWN 165#ifdef CONFIG_SH_UNKNOWN
185 if (mv == NULL) { 166 if (mv == NULL) {
@@ -258,6 +239,7 @@ void __init setup_arch(char **cmdline_p)
258 239
259 sh_mv_setup(cmdline_p); 240 sh_mv_setup(cmdline_p);
260 241
242
261 /* 243 /*
262 * Find the highest page frame number we have available 244 * Find the highest page frame number we have available
263 */ 245 */
@@ -305,6 +287,7 @@ void __init setup_arch(char **cmdline_p)
305 PFN_PHYS(pages)); 287 PFN_PHYS(pages));
306 } 288 }
307 289
290
308 /* 291 /*
309 * Reserve the kernel text and 292 * Reserve the kernel text and
310 * Reserve the bootmem bitmap. We do this in two steps (first step 293 * Reserve the bootmem bitmap. We do this in two steps (first step