MIPS: arc: use function argument for passing argc/argv to prom_init_cmdline

prom_argc and prom_argv are only used by prom_init_cmdline(), so
we could pass them directly as function argument.

Signed-off-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
Signed-off-by: Paul Burton <paulburton@kernel.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Paul Burton <paul.burton@mips.com>
Cc: James Hogan <jhogan@kernel.org>
Cc: linux-mips@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
This commit is contained in:
Thomas Bogendoerfer 2019-10-22 18:13:14 +02:00 committed by Paul Burton
parent cbd09241dd
commit 7b16831d1e
No known key found for this signature in database
GPG Key ID: 3EA79FACB57500DD
3 changed files with 13 additions and 19 deletions

View File

@ -17,6 +17,12 @@
#undef DEBUG_CMDLINE #undef DEBUG_CMDLINE
/*
* A 32-bit ARC PROM pass arguments and environment as 32-bit pointer.
* These macro take care of sign extension.
*/
#define prom_argv(index) ((char *) (long)argv[(index)])
static char *ignored[] = { static char *ignored[] = {
"ConsoleIn=", "ConsoleIn=",
"ConsoleOut=", "ConsoleOut=",
@ -32,14 +38,14 @@ static char *used_arc[][2] = {
{ "OSLoadOptions=", "" } { "OSLoadOptions=", "" }
}; };
static char * __init move_firmware_args(char* cp) static char __init *move_firmware_args(int argc, LONG *argv, char *cp)
{ {
char *s; char *s;
int actr, i; int actr, i;
actr = 1; /* Always ignore argv[0] */ actr = 1; /* Always ignore argv[0] */
while (actr < prom_argc) { while (actr < argc) {
for(i = 0; i < ARRAY_SIZE(used_arc); i++) { for(i = 0; i < ARRAY_SIZE(used_arc); i++) {
int len = strlen(used_arc[i][0]); int len = strlen(used_arc[i][0]);
@ -64,7 +70,7 @@ static char * __init move_firmware_args(char* cp)
return cp; return cp;
} }
void __init prom_init_cmdline(void) void __init prom_init_cmdline(int argc, LONG *argv)
{ {
char *cp; char *cp;
int actr, i; int actr, i;
@ -76,9 +82,9 @@ void __init prom_init_cmdline(void)
* Move ARC variables to the beginning to make sure they can be * Move ARC variables to the beginning to make sure they can be
* overridden by later arguments. * overridden by later arguments.
*/ */
cp = move_firmware_args(cp); cp = move_firmware_args(argc, argv, cp);
while (actr < prom_argc) { while (actr < argc) {
for (i = 0; i < ARRAY_SIZE(ignored); i++) { for (i = 0; i < ARRAY_SIZE(ignored); i++) {
int len = strlen(ignored[i]); int len = strlen(ignored[i]);

View File

@ -18,8 +18,6 @@
/* Master romvec interface. */ /* Master romvec interface. */
struct linux_romvec *romvec; struct linux_romvec *romvec;
int prom_argc;
LONG *_prom_argv;
#if defined(CONFIG_64BIT) && defined(CONFIG_FW_ARC32) #if defined(CONFIG_64BIT) && defined(CONFIG_FW_ARC32)
/* stack for calling 32bit ARC prom */ /* stack for calling 32bit ARC prom */
@ -32,9 +30,6 @@ void __init prom_init(void)
romvec = ROMVECTOR; romvec = ROMVECTOR;
prom_argc = fw_arg0;
_prom_argv = (LONG *) fw_arg1;
if (pb->magic != 0x53435241) { if (pb->magic != 0x53435241) {
printk(KERN_CRIT "Aieee, bad prom vector magic %08lx\n", printk(KERN_CRIT "Aieee, bad prom vector magic %08lx\n",
(unsigned long) pb->magic); (unsigned long) pb->magic);
@ -42,7 +37,7 @@ void __init prom_init(void)
; ;
} }
prom_init_cmdline(); prom_init_cmdline(fw_arg0, (LONG *)fw_arg1);
prom_identify_arch(); prom_identify_arch();
printk(KERN_INFO "PROMLIB: ARC firmware Version %d Revision %d\n", printk(KERN_INFO "PROMLIB: ARC firmware Version %d Revision %d\n",
pb->ver, pb->rev); pb->ver, pb->rev);

View File

@ -15,13 +15,6 @@
#include <asm/sgiarcs.h> #include <asm/sgiarcs.h>
extern struct linux_romvec *romvec; extern struct linux_romvec *romvec;
extern int prom_argc;
extern LONG *_prom_argv;
/* A 32-bit ARC PROM pass arguments and environment as 32-bit pointer.
These macros take care of sign extension. */
#define prom_argv(index) ((char *) (long) _prom_argv[(index)])
extern int prom_flags; extern int prom_flags;
@ -55,7 +48,7 @@ extern void prom_identify_arch(void);
extern PCHAR ArcGetEnvironmentVariable(PCHAR name); extern PCHAR ArcGetEnvironmentVariable(PCHAR name);
/* ARCS command line parsing. */ /* ARCS command line parsing. */
extern void prom_init_cmdline(void); extern void prom_init_cmdline(int argc, LONG *argv);
/* File operations. */ /* File operations. */
extern LONG ArcRead(ULONG fd, PVOID buf, ULONG num, PULONG cnt); extern LONG ArcRead(ULONG fd, PVOID buf, ULONG num, PULONG cnt);