diff options
author | Jeremy Kerr <jeremy.kerr@canonical.com> | 2010-01-11 17:17:34 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-02-15 16:39:13 -0500 |
commit | 2b0d8c251b8876d530a6bf671eb5425838fa698a (patch) | |
tree | f8b85d4ee0f76be6a45738452e91fbbb94602b4c /arch/arm/kernel/setup.c | |
parent | e119bfff1f102f8d1505910cd6c09df55c776b43 (diff) |
ARM: 5880/1: arm: use generic infrastructure for early params
The ARM setup code includes its own parser for early params, there's
also one in the generic init code.
This patch removes __early_init (and related code) from
arch/arm/kernel/setup.c, and changes users to the generic early_init
macro instead.
The generic macro takes a char * argument, rather than char **, so we
need to update the parser functions a little.
Signed-off-by: Jeremy Kerr <jeremy.kerr@canonical.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/kernel/setup.c')
-rw-r--r-- | arch/arm/kernel/setup.c | 62 |
1 files changed, 16 insertions, 46 deletions
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index 5357e48f2c39..b01a56a03ed8 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c | |||
@@ -418,10 +418,11 @@ static int __init arm_add_memory(unsigned long start, unsigned long size) | |||
418 | * Pick out the memory size. We look for mem=size@start, | 418 | * Pick out the memory size. We look for mem=size@start, |
419 | * where start and size are "size[KkMm]" | 419 | * where start and size are "size[KkMm]" |
420 | */ | 420 | */ |
421 | static void __init early_mem(char **p) | 421 | static int __init early_mem(char *p) |
422 | { | 422 | { |
423 | static int usermem __initdata = 0; | 423 | static int usermem __initdata = 0; |
424 | unsigned long size, start; | 424 | unsigned long size, start; |
425 | char *endp; | ||
425 | 426 | ||
426 | /* | 427 | /* |
427 | * If the user specifies memory size, we | 428 | * If the user specifies memory size, we |
@@ -434,52 +435,15 @@ static void __init early_mem(char **p) | |||
434 | } | 435 | } |
435 | 436 | ||
436 | start = PHYS_OFFSET; | 437 | start = PHYS_OFFSET; |
437 | size = memparse(*p, p); | 438 | size = memparse(p, &endp); |
438 | if (**p == '@') | 439 | if (*endp == '@') |
439 | start = memparse(*p + 1, p); | 440 | start = memparse(endp + 1, NULL); |
440 | 441 | ||
441 | arm_add_memory(start, size); | 442 | arm_add_memory(start, size); |
442 | } | ||
443 | __early_param("mem=", early_mem); | ||
444 | 443 | ||
445 | /* | 444 | return 0; |
446 | * Initial parsing of the command line. | ||
447 | */ | ||
448 | static void __init parse_cmdline(char **cmdline_p, char *from) | ||
449 | { | ||
450 | char c = ' ', *to = command_line; | ||
451 | int len = 0; | ||
452 | |||
453 | for (;;) { | ||
454 | if (c == ' ') { | ||
455 | extern struct early_params __early_begin, __early_end; | ||
456 | struct early_params *p; | ||
457 | |||
458 | for (p = &__early_begin; p < &__early_end; p++) { | ||
459 | int arglen = strlen(p->arg); | ||
460 | |||
461 | if (memcmp(from, p->arg, arglen) == 0) { | ||
462 | if (to != command_line) | ||
463 | to -= 1; | ||
464 | from += arglen; | ||
465 | p->fn(&from); | ||
466 | |||
467 | while (*from != ' ' && *from != '\0') | ||
468 | from++; | ||
469 | break; | ||
470 | } | ||
471 | } | ||
472 | } | ||
473 | c = *from++; | ||
474 | if (!c) | ||
475 | break; | ||
476 | if (COMMAND_LINE_SIZE <= ++len) | ||
477 | break; | ||
478 | *to++ = c; | ||
479 | } | ||
480 | *to = '\0'; | ||
481 | *cmdline_p = command_line; | ||
482 | } | 445 | } |
446 | early_param("mem", early_mem); | ||
483 | 447 | ||
484 | static void __init | 448 | static void __init |
485 | setup_ramdisk(int doload, int prompt, int image_start, unsigned int rd_sz) | 449 | setup_ramdisk(int doload, int prompt, int image_start, unsigned int rd_sz) |
@@ -740,9 +704,15 @@ void __init setup_arch(char **cmdline_p) | |||
740 | init_mm.end_data = (unsigned long) _edata; | 704 | init_mm.end_data = (unsigned long) _edata; |
741 | init_mm.brk = (unsigned long) _end; | 705 | init_mm.brk = (unsigned long) _end; |
742 | 706 | ||
743 | memcpy(boot_command_line, from, COMMAND_LINE_SIZE); | 707 | /* parse_early_param needs a boot_command_line */ |
744 | boot_command_line[COMMAND_LINE_SIZE-1] = '\0'; | 708 | strlcpy(boot_command_line, from, COMMAND_LINE_SIZE); |
745 | parse_cmdline(cmdline_p, from); | 709 | |
710 | /* populate command_line too for later use, preserving boot_command_line */ | ||
711 | strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE); | ||
712 | *cmdline_p = command_line; | ||
713 | |||
714 | parse_early_param(); | ||
715 | |||
746 | paging_init(mdesc); | 716 | paging_init(mdesc); |
747 | request_standard_resources(&meminfo, mdesc); | 717 | request_standard_resources(&meminfo, mdesc); |
748 | 718 | ||