From: David Gibson <da...@gibson.dropbear.id.au>

In a lot of places libfdt uses a leading _ character to mark an identifier
as "internal" (not part of the published libfdt API).  This is a bad idea,
because identifiers with a leading _ are generally reserved by the C
library or system.  It's particularly dangerous for libfdt, because it's
designed to be able to be integrated into lots of different environments.

In some cases the leading _ has no purpose, so we simply drop it.  In most
cases we move it to the end, as our new convention for marking internal
identifiers.

Signed-off-by: David Gibson <da...@gibson.dropbear.id.au>
---
 cpukit/dtc/libfdt/fdt.c             | 10 ++---
 cpukit/dtc/libfdt/fdt_ro.c          | 32 ++++++-------
 cpukit/dtc/libfdt/fdt_rw.c          | 90 ++++++++++++++++++-------------------
 cpukit/dtc/libfdt/fdt_sw.c          | 24 +++++-----
 cpukit/dtc/libfdt/fdt_wip.c         | 10 ++---
 cpukit/dtc/libfdt/libfdt_internal.h | 32 ++++++-------
 cpukit/include/fdt.h                |  6 +--
 cpukit/include/libfdt.h             | 30 ++++++-------
 cpukit/include/libfdt_env.h         |  6 +--
 9 files changed, 120 insertions(+), 120 deletions(-)

diff --git a/cpukit/dtc/libfdt/fdt.c b/cpukit/dtc/libfdt/fdt.c
index 22286a1aae..fd13236736 100644
--- a/cpukit/dtc/libfdt/fdt.c
+++ b/cpukit/dtc/libfdt/fdt.c
@@ -88,7 +88,7 @@ const void *fdt_offset_ptr(const void *fdt, int offset, 
unsigned int len)
                    || ((offset + len) > fdt_size_dt_struct(fdt)))
                        return NULL;
 
-       return _fdt_offset_ptr(fdt, offset);
+       return fdt_offset_ptr_(fdt, offset);
 }
 
 uint32_t fdt_next_tag(const void *fdt, int startoffset, int *nextoffset)
@@ -141,7 +141,7 @@ uint32_t fdt_next_tag(const void *fdt, int startoffset, int 
*nextoffset)
        return tag;
 }
 
-int _fdt_check_node_offset(const void *fdt, int offset)
+int fdt_check_node_offset_(const void *fdt, int offset)
 {
        if ((offset < 0) || (offset % FDT_TAGSIZE)
            || (fdt_next_tag(fdt, offset, &offset) != FDT_BEGIN_NODE))
@@ -150,7 +150,7 @@ int _fdt_check_node_offset(const void *fdt, int offset)
        return offset;
 }
 
-int _fdt_check_prop_offset(const void *fdt, int offset)
+int fdt_check_prop_offset_(const void *fdt, int offset)
 {
        if ((offset < 0) || (offset % FDT_TAGSIZE)
            || (fdt_next_tag(fdt, offset, &offset) != FDT_PROP))
@@ -165,7 +165,7 @@ int fdt_next_node(const void *fdt, int offset, int *depth)
        uint32_t tag;
 
        if (offset >= 0)
-               if ((nextoffset = _fdt_check_node_offset(fdt, offset)) < 0)
+               if ((nextoffset = fdt_check_node_offset_(fdt, offset)) < 0)
                        return nextoffset;
 
        do {
@@ -227,7 +227,7 @@ int fdt_next_subnode(const void *fdt, int offset)
        return offset;
 }
 
-const char *_fdt_find_string(const char *strtab, int tabsize, const char *s)
+const char *fdt_find_string_(const char *strtab, int tabsize, const char *s)
 {
        int len = strlen(s) + 1;
        const char *last = strtab + tabsize - len;
diff --git a/cpukit/dtc/libfdt/fdt_ro.c b/cpukit/dtc/libfdt/fdt_ro.c
index 08de2cce67..ce17814b2b 100644
--- a/cpukit/dtc/libfdt/fdt_ro.c
+++ b/cpukit/dtc/libfdt/fdt_ro.c
@@ -55,7 +55,7 @@
 
 #include "libfdt_internal.h"
 
-static int _fdt_nodename_eq(const void *fdt, int offset,
+static int fdt_nodename_eq_(const void *fdt, int offset,
                            const char *s, int len)
 {
        const char *p = fdt_offset_ptr(fdt, offset + FDT_TAGSIZE, len+1);
@@ -80,7 +80,7 @@ const char *fdt_string(const void *fdt, int stroffset)
        return (const char *)fdt + fdt_off_dt_strings(fdt) + stroffset;
 }
 
-static int _fdt_string_eq(const void *fdt, int stroffset,
+static int fdt_string_eq_(const void *fdt, int stroffset,
                          const char *s, int len)
 {
        const char *p = fdt_string(fdt, stroffset);
@@ -117,8 +117,8 @@ uint32_t fdt_get_max_phandle(const void *fdt)
 int fdt_get_mem_rsv(const void *fdt, int n, uint64_t *address, uint64_t *size)
 {
        FDT_CHECK_HEADER(fdt);
-       *address = fdt64_to_cpu(_fdt_mem_rsv(fdt, n)->address);
-       *size = fdt64_to_cpu(_fdt_mem_rsv(fdt, n)->size);
+       *address = fdt64_to_cpu(fdt_mem_rsv_(fdt, n)->address);
+       *size = fdt64_to_cpu(fdt_mem_rsv_(fdt, n)->size);
        return 0;
 }
 
@@ -126,12 +126,12 @@ int fdt_num_mem_rsv(const void *fdt)
 {
        int i = 0;
 
-       while (fdt64_to_cpu(_fdt_mem_rsv(fdt, i)->size) != 0)
+       while (fdt64_to_cpu(fdt_mem_rsv_(fdt, i)->size) != 0)
                i++;
        return i;
 }
 
-static int _nextprop(const void *fdt, int offset)
+static int nextprop_(const void *fdt, int offset)
 {
        uint32_t tag;
        int nextoffset;
@@ -166,7 +166,7 @@ int fdt_subnode_offset_namelen(const void *fdt, int offset,
             (offset >= 0) && (depth >= 0);
             offset = fdt_next_node(fdt, offset, &depth))
                if ((depth == 1)
-                   && _fdt_nodename_eq(fdt, offset, name, namelen))
+                   && fdt_nodename_eq_(fdt, offset, name, namelen))
                        return offset;
 
        if (depth < 0)
@@ -232,11 +232,11 @@ int fdt_path_offset(const void *fdt, const char *path)
 
 const char *fdt_get_name(const void *fdt, int nodeoffset, int *len)
 {
-       const struct fdt_node_header *nh = _fdt_offset_ptr(fdt, nodeoffset);
+       const struct fdt_node_header *nh = fdt_offset_ptr_(fdt, nodeoffset);
        int err;
 
        if (((err = fdt_check_header(fdt)) != 0)
-           || ((err = _fdt_check_node_offset(fdt, nodeoffset)) < 0))
+           || ((err = fdt_check_node_offset_(fdt, nodeoffset)) < 0))
                        goto fail;
 
        if (len)
@@ -254,18 +254,18 @@ int fdt_first_property_offset(const void *fdt, int 
nodeoffset)
 {
        int offset;
 
-       if ((offset = _fdt_check_node_offset(fdt, nodeoffset)) < 0)
+       if ((offset = fdt_check_node_offset_(fdt, nodeoffset)) < 0)
                return offset;
 
-       return _nextprop(fdt, offset);
+       return nextprop_(fdt, offset);
 }
 
 int fdt_next_property_offset(const void *fdt, int offset)
 {
-       if ((offset = _fdt_check_prop_offset(fdt, offset)) < 0)
+       if ((offset = fdt_check_prop_offset_(fdt, offset)) < 0)
                return offset;
 
-       return _nextprop(fdt, offset);
+       return nextprop_(fdt, offset);
 }
 
 const struct fdt_property *fdt_get_property_by_offset(const void *fdt,
@@ -275,13 +275,13 @@ const struct fdt_property 
*fdt_get_property_by_offset(const void *fdt,
        int err;
        const struct fdt_property *prop;
 
-       if ((err = _fdt_check_prop_offset(fdt, offset)) < 0) {
+       if ((err = fdt_check_prop_offset_(fdt, offset)) < 0) {
                if (lenp)
                        *lenp = err;
                return NULL;
        }
 
-       prop = _fdt_offset_ptr(fdt, offset);
+       prop = fdt_offset_ptr_(fdt, offset);
 
        if (lenp)
                *lenp = fdt32_to_cpu(prop->len);
@@ -303,7 +303,7 @@ const struct fdt_property *fdt_get_property_namelen(const 
void *fdt,
                        offset = -FDT_ERR_INTERNAL;
                        break;
                }
-               if (_fdt_string_eq(fdt, fdt32_to_cpu(prop->nameoff),
+               if (fdt_string_eq_(fdt, fdt32_to_cpu(prop->nameoff),
                                   name, namelen))
                        return prop;
        }
diff --git a/cpukit/dtc/libfdt/fdt_rw.c b/cpukit/dtc/libfdt/fdt_rw.c
index 5c3a2bb0bc..9b829051e4 100644
--- a/cpukit/dtc/libfdt/fdt_rw.c
+++ b/cpukit/dtc/libfdt/fdt_rw.c
@@ -55,8 +55,8 @@
 
 #include "libfdt_internal.h"
 
-static int _fdt_blocks_misordered(const void *fdt,
-                             int mem_rsv_size, int struct_size)
+static int fdt_blocks_misordered_(const void *fdt,
+                                 int mem_rsv_size, int struct_size)
 {
        return (fdt_off_mem_rsvmap(fdt) < FDT_ALIGN(sizeof(struct fdt_header), 
8))
                || (fdt_off_dt_struct(fdt) <
@@ -67,13 +67,13 @@ static int _fdt_blocks_misordered(const void *fdt,
                    (fdt_off_dt_strings(fdt) + fdt_size_dt_strings(fdt)));
 }
 
-static int _fdt_rw_check_header(void *fdt)
+static int fdt_rw_check_header_(void *fdt)
 {
        FDT_CHECK_HEADER(fdt);
 
        if (fdt_version(fdt) < 17)
                return -FDT_ERR_BADVERSION;
-       if (_fdt_blocks_misordered(fdt, sizeof(struct fdt_reserve_entry),
+       if (fdt_blocks_misordered_(fdt, sizeof(struct fdt_reserve_entry),
                                   fdt_size_dt_struct(fdt)))
                return -FDT_ERR_BADLAYOUT;
        if (fdt_version(fdt) > 17)
@@ -84,20 +84,20 @@ static int _fdt_rw_check_header(void *fdt)
 
 #define FDT_RW_CHECK_HEADER(fdt) \
        { \
-               int __err; \
-               if ((__err = _fdt_rw_check_header(fdt)) != 0) \
-                       return __err; \
+               int err_; \
+               if ((err_ = fdt_rw_check_header_(fdt)) != 0) \
+                       return err_; \
        }
 
-static inline int _fdt_data_size(void *fdt)
+static inline int fdt_data_size_(void *fdt)
 {
        return fdt_off_dt_strings(fdt) + fdt_size_dt_strings(fdt);
 }
 
-static int _fdt_splice(void *fdt, void *splicepoint, int oldlen, int newlen)
+static int fdt_splice_(void *fdt, void *splicepoint, int oldlen, int newlen)
 {
        char *p = splicepoint;
-       char *end = (char *)fdt + _fdt_data_size(fdt);
+       char *end = (char *)fdt + fdt_data_size_(fdt);
 
        if (((p + oldlen) < p) || ((p + oldlen) > end))
                return -FDT_ERR_BADOFFSET;
@@ -109,12 +109,12 @@ static int _fdt_splice(void *fdt, void *splicepoint, int 
oldlen, int newlen)
        return 0;
 }
 
-static int _fdt_splice_mem_rsv(void *fdt, struct fdt_reserve_entry *p,
+static int fdt_splice_mem_rsv_(void *fdt, struct fdt_reserve_entry *p,
                               int oldn, int newn)
 {
        int delta = (newn - oldn) * sizeof(*p);
        int err;
-       err = _fdt_splice(fdt, p, oldn * sizeof(*p), newn * sizeof(*p));
+       err = fdt_splice_(fdt, p, oldn * sizeof(*p), newn * sizeof(*p));
        if (err)
                return err;
        fdt_set_off_dt_struct(fdt, fdt_off_dt_struct(fdt) + delta);
@@ -122,13 +122,13 @@ static int _fdt_splice_mem_rsv(void *fdt, struct 
fdt_reserve_entry *p,
        return 0;
 }
 
-static int _fdt_splice_struct(void *fdt, void *p,
+static int fdt_splice_struct_(void *fdt, void *p,
                              int oldlen, int newlen)
 {
        int delta = newlen - oldlen;
        int err;
 
-       if ((err = _fdt_splice(fdt, p, oldlen, newlen)))
+       if ((err = fdt_splice_(fdt, p, oldlen, newlen)))
                return err;
 
        fdt_set_size_dt_struct(fdt, fdt_size_dt_struct(fdt) + delta);
@@ -136,20 +136,20 @@ static int _fdt_splice_struct(void *fdt, void *p,
        return 0;
 }
 
-static int _fdt_splice_string(void *fdt, int newlen)
+static int fdt_splice_string_(void *fdt, int newlen)
 {
        void *p = (char *)fdt
                + fdt_off_dt_strings(fdt) + fdt_size_dt_strings(fdt);
        int err;
 
-       if ((err = _fdt_splice(fdt, p, 0, newlen)))
+       if ((err = fdt_splice_(fdt, p, 0, newlen)))
                return err;
 
        fdt_set_size_dt_strings(fdt, fdt_size_dt_strings(fdt) + newlen);
        return 0;
 }
 
-static int _fdt_find_add_string(void *fdt, const char *s)
+static int fdt_find_add_string_(void *fdt, const char *s)
 {
        char *strtab = (char *)fdt + fdt_off_dt_strings(fdt);
        const char *p;
@@ -157,13 +157,13 @@ static int _fdt_find_add_string(void *fdt, const char *s)
        int len = strlen(s) + 1;
        int err;
 
-       p = _fdt_find_string(strtab, fdt_size_dt_strings(fdt), s);
+       p = fdt_find_string_(strtab, fdt_size_dt_strings(fdt), s);
        if (p)
                /* found it */
                return (p - strtab);
 
        new = strtab + fdt_size_dt_strings(fdt);
-       err = _fdt_splice_string(fdt, len);
+       err = fdt_splice_string_(fdt, len);
        if (err)
                return err;
 
@@ -178,8 +178,8 @@ int fdt_add_mem_rsv(void *fdt, uint64_t address, uint64_t 
size)
 
        FDT_RW_CHECK_HEADER(fdt);
 
-       re = _fdt_mem_rsv_w(fdt, fdt_num_mem_rsv(fdt));
-       err = _fdt_splice_mem_rsv(fdt, re, 0, 1);
+       re = fdt_mem_rsv_w_(fdt, fdt_num_mem_rsv(fdt));
+       err = fdt_splice_mem_rsv_(fdt, re, 0, 1);
        if (err)
                return err;
 
@@ -190,17 +190,17 @@ int fdt_add_mem_rsv(void *fdt, uint64_t address, uint64_t 
size)
 
 int fdt_del_mem_rsv(void *fdt, int n)
 {
-       struct fdt_reserve_entry *re = _fdt_mem_rsv_w(fdt, n);
+       struct fdt_reserve_entry *re = fdt_mem_rsv_w_(fdt, n);
 
        FDT_RW_CHECK_HEADER(fdt);
 
        if (n >= fdt_num_mem_rsv(fdt))
                return -FDT_ERR_NOTFOUND;
 
-       return _fdt_splice_mem_rsv(fdt, re, 1, 0);
+       return fdt_splice_mem_rsv_(fdt, re, 1, 0);
 }
 
-static int _fdt_resize_property(void *fdt, int nodeoffset, const char *name,
+static int fdt_resize_property_(void *fdt, int nodeoffset, const char *name,
                                int len, struct fdt_property **prop)
 {
        int oldlen;
@@ -210,7 +210,7 @@ static int _fdt_resize_property(void *fdt, int nodeoffset, 
const char *name,
        if (!*prop)
                return oldlen;
 
-       if ((err = _fdt_splice_struct(fdt, (*prop)->data, FDT_TAGALIGN(oldlen),
+       if ((err = fdt_splice_struct_(fdt, (*prop)->data, FDT_TAGALIGN(oldlen),
                                      FDT_TAGALIGN(len))))
                return err;
 
@@ -218,7 +218,7 @@ static int _fdt_resize_property(void *fdt, int nodeoffset, 
const char *name,
        return 0;
 }
 
-static int _fdt_add_property(void *fdt, int nodeoffset, const char *name,
+static int fdt_add_property_(void *fdt, int nodeoffset, const char *name,
                             int len, struct fdt_property **prop)
 {
        int proplen;
@@ -226,17 +226,17 @@ static int _fdt_add_property(void *fdt, int nodeoffset, 
const char *name,
        int namestroff;
        int err;
 
-       if ((nextoffset = _fdt_check_node_offset(fdt, nodeoffset)) < 0)
+       if ((nextoffset = fdt_check_node_offset_(fdt, nodeoffset)) < 0)
                return nextoffset;
 
-       namestroff = _fdt_find_add_string(fdt, name);
+       namestroff = fdt_find_add_string_(fdt, name);
        if (namestroff < 0)
                return namestroff;
 
-       *prop = _fdt_offset_ptr_w(fdt, nextoffset);
+       *prop = fdt_offset_ptr_w_(fdt, nextoffset);
        proplen = sizeof(**prop) + FDT_TAGALIGN(len);
 
-       err = _fdt_splice_struct(fdt, *prop, 0, proplen);
+       err = fdt_splice_struct_(fdt, *prop, 0, proplen);
        if (err)
                return err;
 
@@ -260,7 +260,7 @@ int fdt_set_name(void *fdt, int nodeoffset, const char 
*name)
 
        newlen = strlen(name);
 
-       err = _fdt_splice_struct(fdt, namep, FDT_TAGALIGN(oldlen+1),
+       err = fdt_splice_struct_(fdt, namep, FDT_TAGALIGN(oldlen+1),
                                 FDT_TAGALIGN(newlen+1));
        if (err)
                return err;
@@ -277,9 +277,9 @@ int fdt_setprop_placeholder(void *fdt, int nodeoffset, 
const char *name,
 
        FDT_RW_CHECK_HEADER(fdt);
 
-       err = _fdt_resize_property(fdt, nodeoffset, name, len, &prop);
+       err = fdt_resize_property_(fdt, nodeoffset, name, len, &prop);
        if (err == -FDT_ERR_NOTFOUND)
-               err = _fdt_add_property(fdt, nodeoffset, name, len, &prop);
+               err = fdt_add_property_(fdt, nodeoffset, name, len, &prop);
        if (err)
                return err;
 
@@ -313,7 +313,7 @@ int fdt_appendprop(void *fdt, int nodeoffset, const char 
*name,
        prop = fdt_get_property_w(fdt, nodeoffset, name, &oldlen);
        if (prop) {
                newlen = len + oldlen;
-               err = _fdt_splice_struct(fdt, prop->data,
+               err = fdt_splice_struct_(fdt, prop->data,
                                         FDT_TAGALIGN(oldlen),
                                         FDT_TAGALIGN(newlen));
                if (err)
@@ -321,7 +321,7 @@ int fdt_appendprop(void *fdt, int nodeoffset, const char 
*name,
                prop->len = cpu_to_fdt32(newlen);
                memcpy(prop->data + oldlen, val, len);
        } else {
-               err = _fdt_add_property(fdt, nodeoffset, name, len, &prop);
+               err = fdt_add_property_(fdt, nodeoffset, name, len, &prop);
                if (err)
                        return err;
                memcpy(prop->data, val, len);
@@ -341,7 +341,7 @@ int fdt_delprop(void *fdt, int nodeoffset, const char *name)
                return len;
 
        proplen = sizeof(*prop) + FDT_TAGALIGN(len);
-       return _fdt_splice_struct(fdt, prop, proplen, 0);
+       return fdt_splice_struct_(fdt, prop, proplen, 0);
 }
 
 int fdt_add_subnode_namelen(void *fdt, int parentoffset,
@@ -369,10 +369,10 @@ int fdt_add_subnode_namelen(void *fdt, int parentoffset,
                tag = fdt_next_tag(fdt, offset, &nextoffset);
        } while ((tag == FDT_PROP) || (tag == FDT_NOP));
 
-       nh = _fdt_offset_ptr_w(fdt, offset);
+       nh = fdt_offset_ptr_w_(fdt, offset);
        nodelen = sizeof(*nh) + FDT_TAGALIGN(namelen+1) + FDT_TAGSIZE;
 
-       err = _fdt_splice_struct(fdt, nh, 0, nodelen);
+       err = fdt_splice_struct_(fdt, nh, 0, nodelen);
        if (err)
                return err;
 
@@ -396,15 +396,15 @@ int fdt_del_node(void *fdt, int nodeoffset)
 
        FDT_RW_CHECK_HEADER(fdt);
 
-       endoffset = _fdt_node_end_offset(fdt, nodeoffset);
+       endoffset = fdt_node_end_offset_(fdt, nodeoffset);
        if (endoffset < 0)
                return endoffset;
 
-       return _fdt_splice_struct(fdt, _fdt_offset_ptr_w(fdt, nodeoffset),
+       return fdt_splice_struct_(fdt, fdt_offset_ptr_w_(fdt, nodeoffset),
                                  endoffset - nodeoffset, 0);
 }
 
-static void _fdt_packblocks(const char *old, char *new,
+static void fdt_packblocks_(const char *old, char *new,
                            int mem_rsv_size, int struct_size)
 {
        int mem_rsv_off, struct_off, strings_off;
@@ -450,7 +450,7 @@ int fdt_open_into(const void *fdt, void *buf, int bufsize)
                        return struct_size;
        }
 
-       if (!_fdt_blocks_misordered(fdt, mem_rsv_size, struct_size)) {
+       if (!fdt_blocks_misordered_(fdt, mem_rsv_size, struct_size)) {
                /* no further work necessary */
                err = fdt_move(fdt, buf, bufsize);
                if (err)
@@ -478,7 +478,7 @@ int fdt_open_into(const void *fdt, void *buf, int bufsize)
                        return -FDT_ERR_NOSPACE;
        }
 
-       _fdt_packblocks(fdt, tmp, mem_rsv_size, struct_size);
+       fdt_packblocks_(fdt, tmp, mem_rsv_size, struct_size);
        memmove(buf, tmp, newsize);
 
        fdt_set_magic(buf, FDT_MAGIC);
@@ -498,8 +498,8 @@ int fdt_pack(void *fdt)
 
        mem_rsv_size = (fdt_num_mem_rsv(fdt)+1)
                * sizeof(struct fdt_reserve_entry);
-       _fdt_packblocks(fdt, fdt, mem_rsv_size, fdt_size_dt_struct(fdt));
-       fdt_set_totalsize(fdt, _fdt_data_size(fdt));
+       fdt_packblocks_(fdt, fdt, mem_rsv_size, fdt_size_dt_struct(fdt));
+       fdt_set_totalsize(fdt, fdt_data_size_(fdt));
 
        return 0;
 }
diff --git a/cpukit/dtc/libfdt/fdt_sw.c b/cpukit/dtc/libfdt/fdt_sw.c
index 2bd15e7aef..6d33cc29d0 100644
--- a/cpukit/dtc/libfdt/fdt_sw.c
+++ b/cpukit/dtc/libfdt/fdt_sw.c
@@ -55,7 +55,7 @@
 
 #include "libfdt_internal.h"
 
-static int _fdt_sw_check_header(void *fdt)
+static int fdt_sw_check_header_(void *fdt)
 {
        if (fdt_magic(fdt) != FDT_SW_MAGIC)
                return -FDT_ERR_BADMAGIC;
@@ -66,11 +66,11 @@ static int _fdt_sw_check_header(void *fdt)
 #define FDT_SW_CHECK_HEADER(fdt) \
        { \
                int err; \
-               if ((err = _fdt_sw_check_header(fdt)) != 0) \
+               if ((err = fdt_sw_check_header_(fdt)) != 0) \
                        return err; \
        }
 
-static void *_fdt_grab_space(void *fdt, size_t len)
+static void *fdt_grab_space_(void *fdt, size_t len)
 {
        int offset = fdt_size_dt_struct(fdt);
        int spaceleft;
@@ -82,7 +82,7 @@ static void *_fdt_grab_space(void *fdt, size_t len)
                return NULL;
 
        fdt_set_size_dt_struct(fdt, offset + len);
-       return _fdt_offset_ptr_w(fdt, offset);
+       return fdt_offset_ptr_w_(fdt, offset);
 }
 
 int fdt_create(void *buf, int bufsize)
@@ -174,7 +174,7 @@ int fdt_begin_node(void *fdt, const char *name)
 
        FDT_SW_CHECK_HEADER(fdt);
 
-       nh = _fdt_grab_space(fdt, sizeof(*nh) + FDT_TAGALIGN(namelen));
+       nh = fdt_grab_space_(fdt, sizeof(*nh) + FDT_TAGALIGN(namelen));
        if (! nh)
                return -FDT_ERR_NOSPACE;
 
@@ -189,7 +189,7 @@ int fdt_end_node(void *fdt)
 
        FDT_SW_CHECK_HEADER(fdt);
 
-       en = _fdt_grab_space(fdt, FDT_TAGSIZE);
+       en = fdt_grab_space_(fdt, FDT_TAGSIZE);
        if (! en)
                return -FDT_ERR_NOSPACE;
 
@@ -197,7 +197,7 @@ int fdt_end_node(void *fdt)
        return 0;
 }
 
-static int _fdt_find_add_string(void *fdt, const char *s)
+static int fdt_find_add_string_(void *fdt, const char *s)
 {
        char *strtab = (char *)fdt + fdt_totalsize(fdt);
        const char *p;
@@ -205,7 +205,7 @@ static int _fdt_find_add_string(void *fdt, const char *s)
        int len = strlen(s) + 1;
        int struct_top, offset;
 
-       p = _fdt_find_string(strtab - strtabsize, strtabsize, s);
+       p = fdt_find_string_(strtab - strtabsize, strtabsize, s);
        if (p)
                return p - strtab;
 
@@ -227,11 +227,11 @@ int fdt_property_placeholder(void *fdt, const char *name, 
int len, void **valp)
 
        FDT_SW_CHECK_HEADER(fdt);
 
-       nameoff = _fdt_find_add_string(fdt, name);
+       nameoff = fdt_find_add_string_(fdt, name);
        if (nameoff == 0)
                return -FDT_ERR_NOSPACE;
 
-       prop = _fdt_grab_space(fdt, sizeof(*prop) + FDT_TAGALIGN(len));
+       prop = fdt_grab_space_(fdt, sizeof(*prop) + FDT_TAGALIGN(len));
        if (! prop)
                return -FDT_ERR_NOSPACE;
 
@@ -265,7 +265,7 @@ int fdt_finish(void *fdt)
        FDT_SW_CHECK_HEADER(fdt);
 
        /* Add terminator */
-       end = _fdt_grab_space(fdt, sizeof(*end));
+       end = fdt_grab_space_(fdt, sizeof(*end));
        if (! end)
                return -FDT_ERR_NOSPACE;
        *end = cpu_to_fdt32(FDT_END);
@@ -281,7 +281,7 @@ int fdt_finish(void *fdt)
        while ((tag = fdt_next_tag(fdt, offset, &nextoffset)) != FDT_END) {
                if (tag == FDT_PROP) {
                        struct fdt_property *prop =
-                               _fdt_offset_ptr_w(fdt, offset);
+                               fdt_offset_ptr_w_(fdt, offset);
                        int nameoff;
 
                        nameoff = fdt32_to_cpu(prop->nameoff);
diff --git a/cpukit/dtc/libfdt/fdt_wip.c b/cpukit/dtc/libfdt/fdt_wip.c
index 5e85919862..534c1cbbb2 100644
--- a/cpukit/dtc/libfdt/fdt_wip.c
+++ b/cpukit/dtc/libfdt/fdt_wip.c
@@ -93,7 +93,7 @@ int fdt_setprop_inplace(void *fdt, int nodeoffset, const char 
*name,
                                                   val, len);
 }
 
-static void _fdt_nop_region(void *start, int len)
+static void fdt_nop_region_(void *start, int len)
 {
        fdt32_t *p;
 
@@ -110,12 +110,12 @@ int fdt_nop_property(void *fdt, int nodeoffset, const 
char *name)
        if (!prop)
                return len;
 
-       _fdt_nop_region(prop, len + sizeof(*prop));
+       fdt_nop_region_(prop, len + sizeof(*prop));
 
        return 0;
 }
 
-int _fdt_node_end_offset(void *fdt, int offset)
+int fdt_node_end_offset_(void *fdt, int offset)
 {
        int depth = 0;
 
@@ -129,11 +129,11 @@ int fdt_nop_node(void *fdt, int nodeoffset)
 {
        int endoffset;
 
-       endoffset = _fdt_node_end_offset(fdt, nodeoffset);
+       endoffset = fdt_node_end_offset_(fdt, nodeoffset);
        if (endoffset < 0)
                return endoffset;
 
-       _fdt_nop_region(fdt_offset_ptr_w(fdt, nodeoffset, 0),
+       fdt_nop_region_(fdt_offset_ptr_w(fdt, nodeoffset, 0),
                        endoffset - nodeoffset);
        return 0;
 }
diff --git a/cpukit/dtc/libfdt/libfdt_internal.h 
b/cpukit/dtc/libfdt/libfdt_internal.h
index 02cfa6fb61..7681e19229 100644
--- a/cpukit/dtc/libfdt/libfdt_internal.h
+++ b/cpukit/dtc/libfdt/libfdt_internal.h
@@ -1,5 +1,5 @@
-#ifndef _LIBFDT_INTERNAL_H
-#define _LIBFDT_INTERNAL_H
+#ifndef LIBFDT_INTERNAL_H
+#define LIBFDT_INTERNAL_H
 /*
  * libfdt - Flat Device Tree manipulation
  * Copyright (C) 2006 David Gibson, IBM Corporation.
@@ -57,27 +57,27 @@
 
 #define FDT_CHECK_HEADER(fdt) \
        { \
-               int __err; \
-               if ((__err = fdt_check_header(fdt)) != 0) \
-                       return __err; \
+               int err_; \
+               if ((err_ = fdt_check_header(fdt)) != 0) \
+                       return err_; \
        }
 
-int _fdt_check_node_offset(const void *fdt, int offset);
-int _fdt_check_prop_offset(const void *fdt, int offset);
-const char *_fdt_find_string(const char *strtab, int tabsize, const char *s);
-int _fdt_node_end_offset(void *fdt, int nodeoffset);
+int fdt_check_node_offset_(const void *fdt, int offset);
+int fdt_check_prop_offset_(const void *fdt, int offset);
+const char *fdt_find_string_(const char *strtab, int tabsize, const char *s);
+int fdt_node_end_offset_(void *fdt, int nodeoffset);
 
-static inline const void *_fdt_offset_ptr(const void *fdt, int offset)
+static inline const void *fdt_offset_ptr_(const void *fdt, int offset)
 {
        return (const char *)fdt + fdt_off_dt_struct(fdt) + offset;
 }
 
-static inline void *_fdt_offset_ptr_w(void *fdt, int offset)
+static inline void *fdt_offset_ptr_w_(void *fdt, int offset)
 {
-       return (void *)(uintptr_t)_fdt_offset_ptr(fdt, offset);
+       return (void *)(uintptr_t)fdt_offset_ptr_(fdt, offset);
 }
 
-static inline const struct fdt_reserve_entry *_fdt_mem_rsv(const void *fdt, 
int n)
+static inline const struct fdt_reserve_entry *fdt_mem_rsv_(const void *fdt, 
int n)
 {
        const struct fdt_reserve_entry *rsv_table =
                (const struct fdt_reserve_entry *)
@@ -85,11 +85,11 @@ static inline const struct fdt_reserve_entry 
*_fdt_mem_rsv(const void *fdt, int
 
        return rsv_table + n;
 }
-static inline struct fdt_reserve_entry *_fdt_mem_rsv_w(void *fdt, int n)
+static inline struct fdt_reserve_entry *fdt_mem_rsv_w_(void *fdt, int n)
 {
-       return (void *)(uintptr_t)_fdt_mem_rsv(fdt, n);
+       return (void *)(uintptr_t)fdt_mem_rsv_(fdt, n);
 }
 
 #define FDT_SW_MAGIC           (~FDT_MAGIC)
 
-#endif /* _LIBFDT_INTERNAL_H */
+#endif /* LIBFDT_INTERNAL_H */
diff --git a/cpukit/include/fdt.h b/cpukit/include/fdt.h
index 526aedb515..74961f9026 100644
--- a/cpukit/include/fdt.h
+++ b/cpukit/include/fdt.h
@@ -1,5 +1,5 @@
-#ifndef _FDT_H
-#define _FDT_H
+#ifndef FDT_H
+#define FDT_H
 /*
  * libfdt - Flat Device Tree manipulation
  * Copyright (C) 2006 David Gibson, IBM Corporation.
@@ -108,4 +108,4 @@ struct fdt_property {
 #define FDT_V16_SIZE   FDT_V3_SIZE
 #define FDT_V17_SIZE   (FDT_V16_SIZE + sizeof(fdt32_t))
 
-#endif /* _FDT_H */
+#endif /* FDT_H */
diff --git a/cpukit/include/libfdt.h b/cpukit/include/libfdt.h
index c8865208df..baa882cfa1 100644
--- a/cpukit/include/libfdt.h
+++ b/cpukit/include/libfdt.h
@@ -1,5 +1,5 @@
-#ifndef _LIBFDT_H
-#define _LIBFDT_H
+#ifndef LIBFDT_H
+#define LIBFDT_H
 /*
  * libfdt - Flat Device Tree manipulation
  * Copyright (C) 2006 David Gibson, IBM Corporation.
@@ -225,23 +225,23 @@ int fdt_next_subnode(const void *fdt, int offset);
 #define fdt_size_dt_strings(fdt)       (fdt_get_header(fdt, size_dt_strings))
 #define fdt_size_dt_struct(fdt)                (fdt_get_header(fdt, 
size_dt_struct))
 
-#define __fdt_set_hdr(name) \
+#define fdt_set_hdr_(name) \
        static inline void fdt_set_##name(void *fdt, uint32_t val) \
        { \
                struct fdt_header *fdth = (struct fdt_header *)fdt; \
                fdth->name = cpu_to_fdt32(val); \
        }
-__fdt_set_hdr(magic);
-__fdt_set_hdr(totalsize);
-__fdt_set_hdr(off_dt_struct);
-__fdt_set_hdr(off_dt_strings);
-__fdt_set_hdr(off_mem_rsvmap);
-__fdt_set_hdr(version);
-__fdt_set_hdr(last_comp_version);
-__fdt_set_hdr(boot_cpuid_phys);
-__fdt_set_hdr(size_dt_strings);
-__fdt_set_hdr(size_dt_struct);
-#undef __fdt_set_hdr
+fdt_set_hdr_(magic);
+fdt_set_hdr_(totalsize);
+fdt_set_hdr_(off_dt_struct);
+fdt_set_hdr_(off_dt_strings);
+fdt_set_hdr_(off_mem_rsvmap);
+fdt_set_hdr_(version);
+fdt_set_hdr_(last_comp_version);
+fdt_set_hdr_(boot_cpuid_phys);
+fdt_set_hdr_(size_dt_strings);
+fdt_set_hdr_(size_dt_struct);
+#undef fdt_set_hdr_
 
 /**
  * fdt_check_header - sanity check a device tree or possible device tree
@@ -1896,4 +1896,4 @@ int fdt_overlay_apply(void *fdt, void *fdto);
 
 const char *fdt_strerror(int errval);
 
-#endif /* _LIBFDT_H */
+#endif /* LIBFDT_H */
diff --git a/cpukit/include/libfdt_env.h b/cpukit/include/libfdt_env.h
index 952056cddf..3605d93254 100644
--- a/cpukit/include/libfdt_env.h
+++ b/cpukit/include/libfdt_env.h
@@ -1,5 +1,5 @@
-#ifndef _LIBFDT_ENV_H
-#define _LIBFDT_ENV_H
+#ifndef LIBFDT_ENV_H
+#define LIBFDT_ENV_H
 /*
  * libfdt - Flat Device Tree manipulation
  * Copyright (C) 2006 David Gibson, IBM Corporation.
@@ -109,4 +109,4 @@ static inline fdt64_t cpu_to_fdt64(uint64_t x)
 #undef CPU_TO_FDT16
 #undef EXTRACT_BYTE
 
-#endif /* _LIBFDT_ENV_H */
+#endif /* LIBFDT_ENV_H */
-- 
2.13.7

_______________________________________________
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Reply via email to