From: Tom Rini <trini@kernel.crashing.org>

- Remove saved_command_line (and saving of the command line).
- Call parse_early_options
- Convert mem= to __early_param


---

 25-akpm/arch/parisc/kernel/setup.c       |   12 ++++--------
 25-akpm/arch/parisc/kernel/vmlinux.lds.S |    3 +++
 25-akpm/arch/parisc/mm/init.c            |   27 +++++----------------------
 25-akpm/include/asm-parisc/setup.h       |   12 ++++--------
 4 files changed, 16 insertions(+), 38 deletions(-)

diff -puN arch/parisc/kernel/setup.c~early-param-parisc arch/parisc/kernel/setup.c
--- 25/arch/parisc/kernel/setup.c~early-param-parisc	2004-03-30 19:49:09.420506448 -0800
+++ 25-akpm/arch/parisc/kernel/setup.c	2004-03-30 19:49:09.427505384 -0800
@@ -44,9 +44,8 @@
 #include <asm/machdep.h>	/* for pa7300lc_init() proto */
 #include <asm/pdc_chassis.h>
 #include <asm/io.h>
+#include <asm/setup.h>
 
-#define COMMAND_LINE_SIZE 1024
-char	saved_command_line[COMMAND_LINE_SIZE];
 char	command_line[COMMAND_LINE_SIZE];
 
 /* Intended for ccio/sba/cpu statistics under /proc/bus/{runway|gsc} */
@@ -60,11 +59,8 @@ void __init setup_cmdline(char **cmdline
 	/* Collect stuff passed in from the boot loader */
 
 	/* boot_args[0] is free-mem start, boot_args[1] is ptr to command line */
-	if (boot_args[0] < 64) {
-		/* called from hpux boot loader */
-		saved_command_line[0] = '\0';
-	} else {
-		strcpy(saved_command_line, (char *)__va(boot_args[1]));
+	if (boot_args[0] > 64) {
+		strcpy(command_line, (char *)__va(boot_args[1]));
 
 #ifdef CONFIG_BLK_DEV_INITRD
 		if (boot_args[2] != 0) /* did palo pass us a ramdisk? */
@@ -75,8 +71,8 @@ void __init setup_cmdline(char **cmdline
 #endif
 	}
 
-	strcpy(command_line, saved_command_line);
 	*cmdline_p = command_line;
+	parse_early_options(cmdline_p);
 }
 
 #ifdef CONFIG_PA11
diff -puN arch/parisc/kernel/vmlinux.lds.S~early-param-parisc arch/parisc/kernel/vmlinux.lds.S
--- 25/arch/parisc/kernel/vmlinux.lds.S~early-param-parisc	2004-03-30 19:49:09.421506296 -0800
+++ 25-akpm/arch/parisc/kernel/vmlinux.lds.S	2004-03-30 19:49:09.428505232 -0800
@@ -116,6 +116,9 @@ SECTIONS
   __setup_start = .;
   .init.setup : { *(.init.setup) }
   __setup_end = .;
+  __early_begin = .;
+  __early_param : { *(__early_param) }
+  __early_end = .;
   __start___param = .;
   __param : { *(__param) }
   __stop___param = .;
diff -puN arch/parisc/mm/init.c~early-param-parisc arch/parisc/mm/init.c
--- 25/arch/parisc/mm/init.c~early-param-parisc	2004-03-30 19:49:09.423505992 -0800
+++ 25-akpm/arch/parisc/mm/init.c	2004-03-30 19:49:09.429505080 -0800
@@ -74,33 +74,18 @@ int npmem_ranges;
 
 static unsigned long mem_limit = MAX_MEM;
 
-static void __init mem_limit_func(void)
+static int __init mem_limit_func(char *cp)
 {
-	char *cp, *end;
 	unsigned long limit;
-	extern char saved_command_line[];
 
-	/* We need this before __setup() functions are called */
-
-	limit = MAX_MEM;
-	for (cp = saved_command_line; *cp; ) {
-		if (memcmp(cp, "mem=", 4) == 0) {
-			cp += 4;
-			limit = memparse(cp, &end);
-			if (end != cp)
-				break;
-			cp = end;
-		} else {
-			while (*cp != ' ' && *cp)
-				++cp;
-			while (*cp == ' ')
-				++cp;
-		}
-	}
+	limit = memparse(cp, &cp);
 
 	if (limit < mem_limit)
 		mem_limit = limit;
+
+	return 0;
 }
+__early_param("mem=", mem_limit_func);
 
 #define MAX_GAP (0x40000000UL >> PAGE_SHIFT)
 
@@ -215,8 +200,6 @@ static void __init setup_bootmem(void)
 	 * to work with multiple memory ranges).
 	 */
 
-	mem_limit_func();       /* check for "mem=" argument */
-
 	mem_max = 0;
 	for (i = 0; i < npmem_ranges; i++) {
 		unsigned long rsize;
diff -puN include/asm-parisc/setup.h~early-param-parisc include/asm-parisc/setup.h
--- 25/include/asm-parisc/setup.h~early-param-parisc	2004-03-30 19:49:09.424505840 -0800
+++ 25-akpm/include/asm-parisc/setup.h	2004-03-30 19:49:09.430504928 -0800
@@ -1,10 +1,6 @@
-/*
- *	Just a place holder. We don't want to have to test x86 before
- *	we include stuff
- */
+#ifndef _PARISC_SETUP_H
+#define _PARISC_SETUP_H
 
-#ifndef _i386_SETUP_H
-#define _i386_SETUP_H
+#define COMMAND_LINE_SIZE	1024
 
-
-#endif /* _i386_SETUP_H */
+#endif /* _PARISC_SETUP_H */

_