X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=arch%2Fmips%2Fau1000%2Fcommon%2Fprom.c;h=ae7d8c57bf3f8d889758f02607a2ad0aec16e4c2;hb=9464c7cf61b9433057924c36e6e02f303a00e768;hp=b4b010a2fe36d2b8947a680b903666de8b2715c2;hpb=41689045f6a3cbe0550e1d34e9cc20d2e8c432ba;p=linux-2.6.git diff --git a/arch/mips/au1000/common/prom.c b/arch/mips/au1000/common/prom.c index b4b010a2f..ae7d8c57b 100644 --- a/arch/mips/au1000/common/prom.c +++ b/arch/mips/au1000/common/prom.c @@ -1,7 +1,7 @@ /* * * BRIEF MODULE DESCRIPTION - * PROM library initialisation code, supports YAMON and U-Boot. + * PROM library initialisation code, assuming YAMON is the boot loader. * * Copyright 2000, 2001, 2006 MontaVista Software Inc. * Author: MontaVista Software, Inc. @@ -46,6 +46,12 @@ extern int prom_argc; extern char **prom_argv, **prom_envp; +typedef struct +{ + char *name; + char *val; +} t_env_var; + char * prom_getcmdline(void) { @@ -78,21 +84,13 @@ char *prom_getenv(char *envname) { /* * Return a pointer to the given environment variable. - * YAMON uses "name", "value" pairs, while U-Boot uses "name=value". */ - char **env = prom_envp; - int i = strlen(envname); - int yamon = (*env && strchr(*env, '=') == NULL); - - while (*env) { - if (yamon) { - if (strcmp(envname, *env++) == 0) - return *env; - } else { - if (strncmp(envname, *env, i) == 0 && (*env)[i] == '=') - return *env + i + 1; - } + t_env_var *env = (t_env_var *)prom_envp; + + while (env->name) { + if (strcmp(envname, env->name) == 0) + return env->val; env++; } return NULL;