sh: Use early_param() for earlyprintk parsing.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
This commit is contained in:
parent
e2dfb912d3
commit
b641fe016a
2 changed files with 16 additions and 31 deletions
|
@ -144,16 +144,16 @@ static struct console *early_console =
|
||||||
;
|
;
|
||||||
|
|
||||||
static int __initdata keep_early;
|
static int __initdata keep_early;
|
||||||
|
static int early_console_initialized;
|
||||||
|
|
||||||
int __init setup_early_printk(char *opt)
|
int __init setup_early_printk(char *buf)
|
||||||
{
|
{
|
||||||
char *space;
|
if (!buf)
|
||||||
char buf[256];
|
return 0;
|
||||||
|
|
||||||
strlcpy(buf, opt, sizeof(buf));
|
if (early_console_initialized)
|
||||||
space = strchr(buf, ' ');
|
return 0;
|
||||||
if (space)
|
early_console_initialized = 1;
|
||||||
*space = 0;
|
|
||||||
|
|
||||||
if (strstr(buf, "keep"))
|
if (strstr(buf, "keep"))
|
||||||
keep_early = 1;
|
keep_early = 1;
|
||||||
|
@ -175,12 +175,14 @@ int __init setup_early_printk(char *opt)
|
||||||
if (likely(early_console))
|
if (likely(early_console))
|
||||||
register_console(early_console);
|
register_console(early_console);
|
||||||
|
|
||||||
return 1;
|
return 0;
|
||||||
}
|
}
|
||||||
__setup("earlyprintk=", setup_early_printk);
|
early_param("earlyprintk", setup_early_printk);
|
||||||
|
|
||||||
void __init disable_early_printk(void)
|
void __init disable_early_printk(void)
|
||||||
{
|
{
|
||||||
|
if (!early_console_initialized || !early_console)
|
||||||
|
return;
|
||||||
if (!keep_early) {
|
if (!keep_early) {
|
||||||
printk("disabling early console\n");
|
printk("disabling early console\n");
|
||||||
unregister_console(early_console);
|
unregister_console(early_console);
|
||||||
|
|
|
@ -84,8 +84,7 @@ unsigned long memory_start, memory_end;
|
||||||
|
|
||||||
static inline void parse_cmdline (char ** cmdline_p, char mv_name[MV_NAME_SIZE],
|
static inline void parse_cmdline (char ** cmdline_p, char mv_name[MV_NAME_SIZE],
|
||||||
struct sh_machine_vector** mvp,
|
struct sh_machine_vector** mvp,
|
||||||
unsigned long *mv_io_base,
|
unsigned long *mv_io_base)
|
||||||
int *mv_mmio_enable)
|
|
||||||
{
|
{
|
||||||
char c = ' ', *to = command_line, *from = COMMAND_LINE;
|
char c = ' ', *to = command_line, *from = COMMAND_LINE;
|
||||||
int len = 0;
|
int len = 0;
|
||||||
|
@ -112,23 +111,6 @@ static inline void parse_cmdline (char ** cmdline_p, char mv_name[MV_NAME_SIZE],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_EARLY_PRINTK
|
|
||||||
if (c == ' ' && !memcmp(from, "earlyprintk=", 12)) {
|
|
||||||
char *ep_end;
|
|
||||||
|
|
||||||
if (to != command_line)
|
|
||||||
to--;
|
|
||||||
|
|
||||||
from += 12;
|
|
||||||
ep_end = strchr(from, ' ');
|
|
||||||
|
|
||||||
setup_early_printk(from);
|
|
||||||
printk("early console enabled\n");
|
|
||||||
|
|
||||||
from = ep_end;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (c == ' ' && !memcmp(from, "sh_mv=", 6)) {
|
if (c == ' ' && !memcmp(from, "sh_mv=", 6)) {
|
||||||
char* mv_end;
|
char* mv_end;
|
||||||
char* mv_comma;
|
char* mv_comma;
|
||||||
|
@ -145,7 +127,6 @@ static inline void parse_cmdline (char ** cmdline_p, char mv_name[MV_NAME_SIZE],
|
||||||
int ints[3];
|
int ints[3];
|
||||||
get_options(mv_comma+1, ARRAY_SIZE(ints), ints);
|
get_options(mv_comma+1, ARRAY_SIZE(ints), ints);
|
||||||
*mv_io_base = ints[1];
|
*mv_io_base = ints[1];
|
||||||
*mv_mmio_enable = ints[2];
|
|
||||||
mv_len = mv_comma - from;
|
mv_len = mv_comma - from;
|
||||||
} else {
|
} else {
|
||||||
mv_len = mv_end - from;
|
mv_len = mv_end - from;
|
||||||
|
@ -158,6 +139,7 @@ static inline void parse_cmdline (char ** cmdline_p, char mv_name[MV_NAME_SIZE],
|
||||||
|
|
||||||
*mvp = get_mv_byname(mv_name);
|
*mvp = get_mv_byname(mv_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
c = *(from++);
|
c = *(from++);
|
||||||
if (!c)
|
if (!c)
|
||||||
break;
|
break;
|
||||||
|
@ -177,9 +159,8 @@ static int __init sh_mv_setup(char **cmdline_p)
|
||||||
struct sh_machine_vector *mv = NULL;
|
struct sh_machine_vector *mv = NULL;
|
||||||
char mv_name[MV_NAME_SIZE] = "";
|
char mv_name[MV_NAME_SIZE] = "";
|
||||||
unsigned long mv_io_base = 0;
|
unsigned long mv_io_base = 0;
|
||||||
int mv_mmio_enable = 0;
|
|
||||||
|
|
||||||
parse_cmdline(cmdline_p, mv_name, &mv, &mv_io_base, &mv_mmio_enable);
|
parse_cmdline(cmdline_p, mv_name, &mv, &mv_io_base);
|
||||||
|
|
||||||
#ifdef CONFIG_SH_UNKNOWN
|
#ifdef CONFIG_SH_UNKNOWN
|
||||||
if (mv == NULL) {
|
if (mv == NULL) {
|
||||||
|
@ -258,6 +239,7 @@ void __init setup_arch(char **cmdline_p)
|
||||||
|
|
||||||
sh_mv_setup(cmdline_p);
|
sh_mv_setup(cmdline_p);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Find the highest page frame number we have available
|
* Find the highest page frame number we have available
|
||||||
*/
|
*/
|
||||||
|
@ -305,6 +287,7 @@ void __init setup_arch(char **cmdline_p)
|
||||||
PFN_PHYS(pages));
|
PFN_PHYS(pages));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Reserve the kernel text and
|
* Reserve the kernel text and
|
||||||
* Reserve the bootmem bitmap. We do this in two steps (first step
|
* Reserve the bootmem bitmap. We do this in two steps (first step
|
||||||
|
|
Loading…
Reference in a new issue