]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - common/ft_build.c
ColdFire: idmr platform MCF52x2 update
[karo-tx-uboot.git] / common / ft_build.c
index b5a997c1ba5ed514cdb1e1e9650bd4757c938b1f..5a0575e89aa4036a6b1af7bf82d01c9426669a19 100644 (file)
@@ -29,6 +29,7 @@
 #include <stddef.h>
 
 #include <ft_build.h>
+#include <linux/ctype.h>
 
 #undef DEBUG
 
@@ -87,9 +88,9 @@ static int lookup_string(struct ft_cxt *cxt, const char *name)
 
        p = cxt->p;
        while (p < cxt->p_end) {
-               if (strcmp(p, name) == 0)
+               if (strcmp((char *)p, name) == 0)
                        return p - cxt->p;
-               p += strlen(p) + 1;
+               p += strlen((char *)p) + 1;
        }
 
        return -1;
@@ -103,7 +104,7 @@ void ft_prop(struct ft_cxt *cxt, const char *name, const void *data, int sz)
        if (off == -1) {
                memcpy(cxt->p_end, name, strlen(name) + 1);
                off = cxt->p_end - cxt->p;
-               cxt->p_end += strlen(name) + 2;
+               cxt->p_end += strlen(name) + 1;
        }
 
        /* now put offset from beginning of *STRUCTURE* */
@@ -143,9 +144,9 @@ void ft_init_cxt(struct ft_cxt *cxt, void *blob)
        cxt->p_rsvmap += SIZE_OF_RSVMAP_ENTRY;
        }
 
-       cxt->p_start = (char*)bph + bph->off_dt_struct;
-       cxt->p_end = (char *)bph + bph->totalsize;
-       cxt->p = (char *)bph + bph->off_dt_strings;
+       cxt->p_start = (u8 *)bph + bph->off_dt_struct;
+       cxt->p_end = (u8 *)bph + bph->totalsize;
+       cxt->p = (u8 *)bph + bph->off_dt_strings;
 }
 
 /* add a reserver physical area to the rsvmap */
@@ -180,11 +181,6 @@ void ft_finalize_tree(struct ft_cxt *cxt) {
        bph->dt_strings_size = cxt->p_end - cxt->p;
 }
 
-static inline int isprint(int c)
-{
-       return c >= 0x20 && c <= 0x7e;
-}
-
 static int is_printable_string(const void *data, int len)
 {
        const char *s = data;
@@ -219,7 +215,9 @@ static void print_data(const void *data, int len)
                return;
 
        if (is_printable_string(data, len)) {
-               printf(" = \"%s\"", (char *)data);
+               puts(" = \"");
+               puts(data);
+               puts("\"");
                return;
        }