Skip to contentSkip to conversation

hwconfig: Fix handling of env_hwconfig, board_hwconfig, and cpu_hwconfig

PATCH New Kumar Gala 3 participants 4 messages Nov 30, 2010 – Dec 8, 2010

lore
Share & tools
lore

Kumar Gala

author
#0 lore raw

PATCH 1/1 hwconfig: Fix handling of env_hwconfig, board_hwconfig, and cpu_hwconfig

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).

---
 common/hwconfig.c |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)
common/hwconfig.c +9 -6
index da8d3ed..193863a 100644
@@ -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;
 }
 
 /*
Signature · 1 line
1.7.2.3
#1 lore raw

PATCH 1/1 hwconfig: Fix handling of env_hwconfig, board_hwconfig, and cpu_hwconfig

Quoted 9 lines · Kumar Gala

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).

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?

Signature · 2 lines
Timur Tabi
Linux kernel developer at Freescale
author
#2 lore raw

PATCH 1/1 hwconfig: Fix handling of env_hwconfig, board_hwconfig, and cpu_hwconfig

Quoted 5 lines · Timur Tabi
Quoted 4 lines · Kumar Gala

The handling of env_hwconfig, board_hwconfig, and cpu_hwconfig got broken when we removed the boards defining dummy board_hwconfig & cpu_hwconfig values.

Quoted 12 lines
Quoted 5 lines

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).

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?

Signature · 2 lines
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

#3 lore raw

PATCH 1/1 hwconfig: Fix handling of env_hwconfig, board_hwconfig, and cpu_hwconfig

In reply to Kumar Gala

Dear Kumar Gala,

Quoted 4 lines · In message <[email protected]> you…

The handling of env_hwconfig, board_hwconfig, and cpu_hwconfig got broken when we removed the boards defining dummy board_hwconfig & cpu_hwconfig values.

Quoted 8 lines

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).

---
 common/hwconfig.c |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"To IBM, 'open' means there is a modicum  of  interoperability  among
some of their equipment."                            - Harv Masterson