From 6250f0f6297c5ba9aecdea6290799a95c5d4b1da Mon Sep 17 00:00:00 2001 From: Heiko Schocher Date: Fri, 17 Oct 2008 16:11:52 +0200 Subject: mgcoge, mgsuvd: extract more common code in ft_blob_update () for both boards was an unneccessary repetition of code, which this patch moves in a common function for this boards. Signed-off-by: Heiko Schocher --- board/keymile/common/common.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'board/keymile/common') diff --git a/board/keymile/common/common.c b/board/keymile/common/common.c index e47928d..a4cf24c 100644 --- a/board/keymile/common/common.c +++ b/board/keymile/common/common.c @@ -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 -- cgit v1.1