Patchwork [U-Boot] hwconfig: Fix handling of env_hwconfig, board_hwconfig, and cpu_hwconfig

login
register
mail settings
Submitter Kumar Gala
Date Nov. 30, 2010, 9:58 p.m.
Message ID <1291154307-21377-1-git-send-email-galak@kernel.crashing.org>
Download mbox | patch
Permalink /patch/73666/
State Accepted
Commit bb141079d34bebb073c5b0566313e1441973ec01
Delegated to: Wolfgang Denk
Headers show

Comments

Kumar Gala - Nov. 30, 2010, 9:58 p.m.
The handling of env_hwconfig, board_hwconfig, and cpu_hwconfig got
broken when we removed the boards defining dummy board_hwconfig
& cpu_hwconfig values.

We fix this by handling the various strings in priority order.  If
hwconfig_parse returns NULL for a given string we check the next one
in order (env_hwconfig, board_hwconfig, followed by cpu_hwconfig).

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
---
 common/hwconfig.c |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)
Timur Tabi - Dec. 1, 2010, 12:09 a.m.
On Tue, Nov 30, 2010 at 3:58 PM, Kumar Gala <galak@kernel.crashing.org> wrote:
> The handling of env_hwconfig, board_hwconfig, and cpu_hwconfig got
> broken when we removed the boards defining dummy board_hwconfig
> & cpu_hwconfig values.
>
> We fix this by handling the various strings in priority order.  If
> hwconfig_parse returns NULL for a given string we check the next one
> in order (env_hwconfig, board_hwconfig, followed by cpu_hwconfig).
>
> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>

I think the P1022DS is broken without this fix, but I can't get this
patch to apply.  Is there a pre-requisite patch that I'm missing?
Kumar Gala - Dec. 1, 2010, 1:01 p.m.
On Nov 30, 2010, at 6:09 PM, Timur Tabi wrote:

> On Tue, Nov 30, 2010 at 3:58 PM, Kumar Gala <galak@kernel.crashing.org> wrote:
>> The handling of env_hwconfig, board_hwconfig, and cpu_hwconfig got
>> broken when we removed the boards defining dummy board_hwconfig
>> & cpu_hwconfig values.
>> 
>> We fix this by handling the various strings in priority order.  If
>> hwconfig_parse returns NULL for a given string we check the next one
>> in order (env_hwconfig, board_hwconfig, followed by cpu_hwconfig).
>> 
>> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
> 
> I think the P1022DS is broken without this fix, but I can't get this
> patch to apply.  Is there a pre-requisite patch that I'm missing?
> 
> -- 
> Timur Tabi
> Linux kernel developer at Freescale

Try the latest HEAD of tree, Wolfgang pulled in the pre-req patch:

http://patchwork.ozlabs.org/patch/73656/

- k
Wolfgang Denk - Dec. 8, 2010, 10:54 p.m.
Dear Kumar Gala,

In message <1291154307-21377-1-git-send-email-galak@kernel.crashing.org> you wrote:
> The handling of env_hwconfig, board_hwconfig, and cpu_hwconfig got
> broken when we removed the boards defining dummy board_hwconfig
> & cpu_hwconfig values.
> 
> We fix this by handling the various strings in priority order.  If
> hwconfig_parse returns NULL for a given string we check the next one
> in order (env_hwconfig, board_hwconfig, followed by cpu_hwconfig).
> 
> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
> ---
>  common/hwconfig.c |   15 +++++++++------
>  1 files changed, 9 insertions(+), 6 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Patch

diff --git a/common/hwconfig.c b/common/hwconfig.c
index da8d3ed..193863a 100644
--- a/common/hwconfig.c
+++ b/common/hwconfig.c
@@ -75,7 +75,7 @@  const char board_hwconfig[] __attribute__((weak)) = "";
 
 static const char *__hwconfig(const char *opt, size_t *arglen)
 {
-	const char *env_hwconfig = NULL;
+	const char *env_hwconfig = NULL, *ret;
 	char buf[HWCONFIG_PRE_RELOC_BUF_SIZE];
 
 	if (gd->flags & GD_FLG_ENV_READY) {
@@ -92,17 +92,20 @@  static const char *__hwconfig(const char *opt, size_t *arglen)
 			env_hwconfig = buf;
 	}
 
-	if (env_hwconfig)
-		return hwconfig_parse(env_hwconfig, strlen(env_hwconfig),
+	if (env_hwconfig) {
+		ret = hwconfig_parse(env_hwconfig, strlen(env_hwconfig),
 				      opt, ";", ':', arglen);
+		if (ret)
+			return ret;
+	}
 
-	return hwconfig_parse(board_hwconfig, strlen(board_hwconfig),
+	ret = hwconfig_parse(board_hwconfig, strlen(board_hwconfig),
 			opt, ";", ':', arglen);
+	if (ret)
+		return ret;
 
 	return hwconfig_parse(cpu_hwconfig, strlen(cpu_hwconfig),
 			opt, ";", ':', arglen);
-
-	return NULL;
 }
 
 /*