Skip to contentSkip to conversation

mgcoge, mgsuvd: extract more common code

U-Boot Applied Heiko Schocher 2 participants 2 messages Oct 17, 2008

lore
Share & tools
lore
#0 lore raw

in ft_blob_update () for both boards was an unneccessary repetition of code, which this patch moves in a common function for this boards.

---
 board/keymile/common/common.c |   26 +++++++++++++++
 board/keymile/mgcoge/mgcoge.c |   52 ++++++++-----------------------
 board/keymile/mgsuvd/mgsuvd.c |   68 ++++++++++------------------------------
 3 files changed, 56 insertions(+), 90 deletions(-)
board/keymile/common/common.c +26 -0
index e47928d..e39b706 100644
@@ -495,3 +495,29 @@ void i2c_init_board(void)
 #endif
 }
 #endif
+
+#if defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT)
+int fdt_set_node_and_value (void *blob,
+				char *nodename,
+				char *regname,
+				void *var,
+				int size)
+{
+	int ret = 0;
+	int nodeoffset = 0;
+
+	nodeoffset = fdt_path_offset (blob, nodename);
+	if (nodeoffset >= 0) {
+		ret = fdt_setprop (blob, nodeoffset, regname, var,
+					size);
+		if (ret < 0)
+			printf("ft_blob_update(): cannot set %s/%s "
+				"property err:%s\n", nodename, regname,
+				fdt_strerror (ret));
+	} else {
+		printf("ft_blob_update(): cannot find %s node "
+			"err:%s\n", nodename, fdt_strerror (nodeoffset));
+	}
+	return ret;
+}
+#endif
board/keymile/mgcoge/mgcoge.c +13 -39

75 lines not on this page · raw message

board/keymile/mgsuvd/mgsuvd.c +17 -51

90 lines not on this page · raw message

Signature · 5 lines
1.5.6.1

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#1 lore raw

Dear Heiko,

Quoted 10 lines · In message <[email protected]> you wrote:

in ft_blob_update () for both boards was an unneccessary repetition of code, which this patch moves in a common function for this boards.

---
 board/keymile/common/common.c |   26 +++++++++++++++
 board/keymile/mgcoge/mgcoge.c |   52 ++++++++-----------------------
 board/keymile/mgsuvd/mgsuvd.c |   68 ++++++++++------------------------------
 3 files changed, 56 insertions(+), 90 deletions(-)

Applied to "next" branch.

Best regards,

Wolfgang Denk

Signature · 6 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
egrep patterns are full regular expressions; it uses a fast  determi-
nistic algorithm that sometimes needs exponential space.
- unix manuals