Browse Source

dtc: Whitespace cleanup

This large patch removes all trailing whitespace from dtc (including
libfdt, the testsuite and documentation).  It also removes a handful
of redundant blank lines (at the end of functions, or when there are
two blank lines together for no particular reason).

As well as anything else, this means that quilt won't whinge when I go
to convert the whole of libfdt into a patch to apply to the kernel.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
main
David Gibson 18 years ago committed by Jon Loeliger
parent
commit
63dc9c7113
  1. 2
      Documentation/dtc-paper.tex
  2. 2
      Documentation/manual.txt
  3. 2
      Makefile
  4. 16
      data.c
  5. 12
      dtc-lexer.l
  6. 12
      dtc-parser.y
  7. 14
      dtc.c
  8. 12
      dtc.h
  9. 26
      flattree.c
  10. 14
      fstree.c
  11. 2
      ftdump.c
  12. 4
      libfdt/fdt_ro.c
  13. 27
      livetree.c
  14. 2
      tests/nop_property.c
  15. 2
      tests/notfound.c
  16. 2
      tests/root_node.c
  17. 2
      tests/setprop.c
  18. 4
      tests/setprop_inplace.c
  19. 1
      tests/testutils.c
  20. 6
      tests/trees.S
  21. 13
      treesource.c

2
Documentation/dtc-paper.tex

@ -193,7 +193,7 @@ particular, the following properties are desirable:
\vdots & \multicolumn{1}{c|}{\vdots} & \\\cline{2-2} \vdots & \multicolumn{1}{c|}{\vdots} & \\\cline{2-2}
& \texttt{\dtendnode} \\\cline{2-2} & \texttt{\dtendnode} \\\cline{2-2}
& \texttt{\dtend} \\\cline{2-2} & \texttt{\dtend} \\\cline{2-2}
\multicolumn{1}{r}{\vdots} & \multicolumn{1}{c}{\vdots} & \\\cline{2-2} \multicolumn{1}{r}{\vdots} & \multicolumn{1}{c}{\vdots} & \\\cline{2-2}
\multicolumn{1}{r}{\emph{totalsize}} \\ \multicolumn{1}{r}{\emph{totalsize}} \\
\end{tabular} \end{tabular}
\caption{Device tree blob layout} \caption{Device tree blob layout}

2
Documentation/manual.txt

@ -140,7 +140,7 @@ Here is a very rough overview of the layout of a DTS source file:


memreserve: label 'memreserve' ADDR ADDR ';' memreserve: label 'memreserve' ADDR ADDR ';'
| label 'memreserve' ADDR '-' ADDR ';' | label 'memreserve' ADDR '-' ADDR ';'

devicetree: '/' nodedef devicetree: '/' nodedef


nodedef: '{' list_of_property list_of_subnode '}' ';' nodedef: '{' list_of_property list_of_subnode '}' ';'

2
Makefile

@ -13,7 +13,7 @@ PATCHLEVEL = 0
SUBLEVEL = 0 SUBLEVEL = 0
EXTRAVERSION = EXTRAVERSION =
LOCAL_VERSION = LOCAL_VERSION =
CONFIG_LOCALVERSION = CONFIG_LOCALVERSION =


DTC_VERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) DTC_VERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
VERSION_FILE = version_gen.h VERSION_FILE = version_gen.h

16
data.c

@ -1,7 +1,7 @@
/* /*
* (C) Copyright David Gibson <dwg@au1.ibm.com>, IBM Corporation. 2005. * (C) Copyright David Gibson <dwg@au1.ibm.com>, IBM Corporation. 2005.
* *
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the * published by the Free Software Foundation; either version 2 of the
@ -11,11 +11,11 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details. * General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA * USA
*/ */


#include "dtc.h" #include "dtc.h"
@ -106,7 +106,7 @@ static char get_oct_char(char *s, int *i)
val = strtol(x, &endx, 8); val = strtol(x, &endx, 8);
if ((endx - x) == 0) if ((endx - x) == 0)
fprintf(stderr, "Empty \\nnn escape\n"); fprintf(stderr, "Empty \\nnn escape\n");

(*i) += endx - x; (*i) += endx - x;
return val; return val;
} }
@ -125,7 +125,7 @@ static char get_hex_char(char *s, int *i)
val = strtol(x, &endx, 16); val = strtol(x, &endx, 16);
if ((endx - x) == 0) if ((endx - x) == 0)
fprintf(stderr, "Empty \\x escape\n"); fprintf(stderr, "Empty \\x escape\n");

(*i) += endx - x; (*i) += endx - x;
return val; return val;
} }

12
dtc-lexer.l

@ -1,7 +1,7 @@
/* /*
* (C) Copyright David Gibson <dwg@au1.ibm.com>, IBM Corporation. 2005. * (C) Copyright David Gibson <dwg@au1.ibm.com>, IBM Corporation. 2005.
* *
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the * published by the Free Software Foundation; either version 2 of the
@ -11,11 +11,11 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details. * General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA * USA
*/ */


%option noyywrap nounput yylineno %option noyywrap nounput yylineno

12
dtc-parser.y

@ -1,7 +1,7 @@
/* /*
* (C) Copyright David Gibson <dwg@au1.ibm.com>, IBM Corporation. 2005. * (C) Copyright David Gibson <dwg@au1.ibm.com>, IBM Corporation. 2005.
* *
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the * published by the Free Software Foundation; either version 2 of the
@ -11,11 +11,11 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details. * General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA * USA
*/ */


%glr-parser %glr-parser

14
dtc.c

@ -1,7 +1,7 @@
/* /*
* (C) Copyright David Gibson <dwg@au1.ibm.com>, IBM Corporation. 2005. * (C) Copyright David Gibson <dwg@au1.ibm.com>, IBM Corporation. 2005.
* *
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the * published by the Free Software Foundation; either version 2 of the
@ -11,11 +11,11 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details. * General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA * USA
*/ */


#include "dtc.h" #include "dtc.h"
@ -218,6 +218,6 @@ int main(int argc, char *argv[])
} else { } else {
die("Unknown output format \"%s\"\n", outform); die("Unknown output format \"%s\"\n", outform);
} }

exit(0); exit(0);
} }

12
dtc.h

@ -4,7 +4,7 @@
/* /*
* (C) Copyright David Gibson <dwg@au1.ibm.com>, IBM Corporation. 2005. * (C) Copyright David Gibson <dwg@au1.ibm.com>, IBM Corporation. 2005.
* *
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the * published by the Free Software Foundation; either version 2 of the
@ -14,11 +14,11 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details. * General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA * USA
*/ */


#include <stdio.h> #include <stdio.h>

26
flattree.c

@ -1,7 +1,7 @@
/* /*
* (C) Copyright David Gibson <dwg@au1.ibm.com>, IBM Corporation. 2005. * (C) Copyright David Gibson <dwg@au1.ibm.com>, IBM Corporation. 2005.
* *
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the * published by the Free Software Foundation; either version 2 of the
@ -11,11 +11,11 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details. * General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA * USA
*/ */


#include "dtc.h" #include "dtc.h"
@ -111,7 +111,7 @@ static struct emitter bin_emitter = {
.data = bin_emit_data, .data = bin_emit_data,
.beginnode = bin_emit_beginnode, .beginnode = bin_emit_beginnode,
.endnode = bin_emit_endnode, .endnode = bin_emit_endnode,
.property = bin_emit_property, .property = bin_emit_property,
}; };


static void emit_label(FILE *f, char *prefix, char *label) static void emit_label(FILE *f, char *prefix, char *label)
@ -144,7 +144,7 @@ static void asm_emit_string(void *e, char *str, int len)
c = str[len]; c = str[len];
str[len] = '\0'; str[len] = '\0';
} }

fprintf(f, "\t.string\t\"%s\"\n", str); fprintf(f, "\t.string\t\"%s\"\n", str);


if (len != 0) { if (len != 0) {
@ -178,7 +178,7 @@ static void asm_emit_data(void *e, struct data d)
} }


if ((d.len - off) >= sizeof(u16)) { if ((d.len - off) >= sizeof(u16)) {
fprintf(f, "\t.short\t0x%hx\n", fprintf(f, "\t.short\t0x%hx\n",
be16_to_cpu(*((u16 *)(d.val+off)))); be16_to_cpu(*((u16 *)(d.val+off))));
off += sizeof(u16); off += sizeof(u16);
} }
@ -231,7 +231,7 @@ static struct emitter asm_emitter = {
.data = asm_emit_data, .data = asm_emit_data,
.beginnode = asm_emit_beginnode, .beginnode = asm_emit_beginnode,
.endnode = asm_emit_endnode, .endnode = asm_emit_endnode,
.property = asm_emit_property, .property = asm_emit_property,
}; };


static int stringtable_insert(struct data *d, char *str) static int stringtable_insert(struct data *d, char *str)
@ -717,7 +717,7 @@ static char *nodename_from_path(char *ppath, char *cpath)


if (! strneq(ppath, cpath, plen)) if (! strneq(ppath, cpath, plen))
return NULL; return NULL;

return strdup(lslash+1); return strdup(lslash+1);
} }


@ -766,7 +766,7 @@ static struct node *unflatten_tree(struct inbuf *dtbuf,
node->name = flat_read_string(dtbuf); node->name = flat_read_string(dtbuf);
node->fullpath = join_path(parent_path, node->name); node->fullpath = join_path(parent_path, node->name);
} }

node->basenamelen = check_node_name(node->name); node->basenamelen = check_node_name(node->name);
if (node->basenamelen < 0) { if (node->basenamelen < 0) {
fprintf(stderr, "Warning \"%s\" has incorrect format\n", node->name); fprintf(stderr, "Warning \"%s\" has incorrect format\n", node->name);
@ -926,7 +926,7 @@ struct boot_info *dt_from_blob(FILE *f)
if (off_dt+size_dt > totalsize) if (off_dt+size_dt > totalsize)
die("Structure block extends past total size\n"); die("Structure block extends past total size\n");
} }

if (version < 16) { if (version < 16) {
flags |= FTF_FULLPATH | FTF_NAMEPROPS | FTF_VARALIGN; flags |= FTF_FULLPATH | FTF_NAMEPROPS | FTF_VARALIGN;
} else { } else {

14
fstree.c

@ -1,7 +1,7 @@
/* /*
* (C) Copyright David Gibson <dwg@au1.ibm.com>, IBM Corporation. 2005. * (C) Copyright David Gibson <dwg@au1.ibm.com>, IBM Corporation. 2005.
* *
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the * published by the Free Software Foundation; either version 2 of the
@ -11,11 +11,11 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details. * General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA * USA
*/ */


#include "dtc.h" #include "dtc.h"
@ -44,7 +44,7 @@ static struct node *read_fstree(char *dirname)
continue; continue;


tmpnam = join_path(dirname, de->d_name); tmpnam = join_path(dirname, de->d_name);

if (lstat(tmpnam, &st) < 0) if (lstat(tmpnam, &st) < 0)
die("stat(%s): %s\n", tmpnam, strerror(errno)); die("stat(%s): %s\n", tmpnam, strerror(errno));



2
ftdump.c

@ -81,7 +81,7 @@ static void print_data(const void *data, int len)
static void dump_blob(void *blob) static void dump_blob(void *blob)
{ {
struct boot_param_header *bph = blob; struct boot_param_header *bph = blob;
struct reserve_entry *p_rsvmap = struct reserve_entry *p_rsvmap =
(struct reserve_entry *)(blob (struct reserve_entry *)(blob
+ be32_to_cpu(bph->off_mem_rsvmap)); + be32_to_cpu(bph->off_mem_rsvmap));
char *p_struct = blob + be32_to_cpu(bph->off_dt_struct); char *p_struct = blob + be32_to_cpu(bph->off_dt_struct);

4
libfdt/fdt_ro.c

@ -166,7 +166,7 @@ int fdt_path_offset(const void *fdt, const char *path)
p = q; p = q;
} }


return offset; return offset;
} }


const char *fdt_get_name(const void *fdt, int nodeoffset, int *len) const char *fdt_get_name(const void *fdt, int nodeoffset, int *len)
@ -244,7 +244,7 @@ const struct fdt_property *fdt_get_property(const void *fdt,


if (lenp) if (lenp)
*lenp = len; *lenp = len;

return prop; return prop;
} }
break; break;

27
livetree.c

@ -1,7 +1,7 @@
/* /*
* (C) Copyright David Gibson <dwg@au1.ibm.com>, IBM Corporation. 2005. * (C) Copyright David Gibson <dwg@au1.ibm.com>, IBM Corporation. 2005.
* *
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the * published by the Free Software Foundation; either version 2 of the
@ -11,11 +11,11 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details. * General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA * USA
*/ */


#include "dtc.h" #include "dtc.h"
@ -41,9 +41,9 @@ struct property *build_property(char *name, struct data val, char *label)
struct property *chain_property(struct property *first, struct property *list) struct property *chain_property(struct property *first, struct property *list)
{ {
assert(first->next == NULL); assert(first->next == NULL);

first->next = list; first->next = list;
return first; return first;
} }


struct node *build_node(struct property *proplist, struct node *children) struct node *build_node(struct property *proplist, struct node *children)
@ -232,7 +232,7 @@ static struct node *get_node_by_label(struct node *tree, const char *label)


static struct node *get_node_by_phandle(struct node *tree, cell_t phandle) static struct node *get_node_by_phandle(struct node *tree, cell_t phandle)
{ {
struct node *child, *node; struct node *child, *node;


assert((phandle != 0) && (phandle != -1)); assert((phandle != 0) && (phandle != -1));


@ -333,13 +333,12 @@ static int check_properties(struct node *node)
prop->name, node->fullpath); prop->name, node->fullpath);
} }
} }


/* check name length */ /* check name length */
if (strlen(prop->name) > MAX_PROPNAME_LEN) if (strlen(prop->name) > MAX_PROPNAME_LEN)
WARNMSG("Property name %s is too long in %s\n", WARNMSG("Property name %s is too long in %s\n",
prop->name, node->fullpath); prop->name, node->fullpath);

/* check this property */ /* check this property */
for (i = 0; i < ARRAY_SIZE(prop_checker_table); i++) { for (i = 0; i < ARRAY_SIZE(prop_checker_table); i++) {
if (streq(prop->name, prop_checker_table[i].propname)) if (streq(prop->name, prop_checker_table[i].propname))
@ -426,7 +425,7 @@ static int check_structure(struct node *tree)
(node)->fullpath, (propname), \ (node)->fullpath, (propname), \
prop->val.val, (value)); \ prop->val.val, (value)); \
} while (0) } while (0)

#define CHECK_HAVE_ONECELL(node, propname) \ #define CHECK_HAVE_ONECELL(node, propname) \
do { \ do { \
CHECK_HAVE((node), (propname)); \ CHECK_HAVE((node), (propname)); \
@ -553,7 +552,7 @@ static int check_cpus(struct node *root, int outversion, int boot_cpuid_phys)
WARNMSG("physical boot CPU not set. Use -b option to set\n"); WARNMSG("physical boot CPU not set. Use -b option to set\n");
} }


return ok; return ok;
} }


static int check_memory(struct node *root) static int check_memory(struct node *root)
@ -578,7 +577,7 @@ static int check_memory(struct node *root)
return 0; return 0;
} }


return ok; return ok;
} }


static int check_chosen(struct node *root) static int check_chosen(struct node *root)

2
tests/nop_property.c

@ -53,7 +53,7 @@ int main(int argc, char *argv[])
FAIL("prop-int still present after nopping"); FAIL("prop-int still present after nopping");
if (lenerr != -FDT_ERR_NOTFOUND) if (lenerr != -FDT_ERR_NOTFOUND)
FAIL("Unexpected error on second getprop: %s", fdt_strerror(err)); FAIL("Unexpected error on second getprop: %s", fdt_strerror(err));

strp = check_getprop(fdt, 0, "prop-str", strlen(TEST_STRING_1)+1, strp = check_getprop(fdt, 0, "prop-str", strlen(TEST_STRING_1)+1,
TEST_STRING_1); TEST_STRING_1);
verbose_printf("string value was \"%s\"\n", strp); verbose_printf("string value was \"%s\"\n", strp);

2
tests/notfound.c

@ -68,6 +68,6 @@ int main(int argc, char *argv[])


offset = fdt_path_offset(fdt, "/nonexistant-subnode"); offset = fdt_path_offset(fdt, "/nonexistant-subnode");
check_error("fdt_path_offset(\"/nonexistant-subnode\")", offset); check_error("fdt_path_offset(\"/nonexistant-subnode\")", offset);

PASS(); PASS();
} }

2
tests/root_node.c

@ -36,7 +36,7 @@ int main(int argc, char *argv[])


test_init(argc, argv); test_init(argc, argv);
fdt = load_blob_arg(argc, argv); fdt = load_blob_arg(argc, argv);

nh = fdt_offset_ptr_typed(fdt, 0, nh); nh = fdt_offset_ptr_typed(fdt, 0, nh);


if (! nh) if (! nh)

2
tests/setprop.c

@ -62,7 +62,7 @@ int main(int argc, char *argv[])


strp = check_getprop_string(fdt, 0, "prop-int", NEW_STRING); strp = check_getprop_string(fdt, 0, "prop-int", NEW_STRING);
verbose_printf("New value is \"%s\"\n", strp); verbose_printf("New value is \"%s\"\n", strp);

strp = check_getprop(fdt, 0, "prop-str", strlen(TEST_STRING_1)+1, strp = check_getprop(fdt, 0, "prop-str", strlen(TEST_STRING_1)+1,
TEST_STRING_1); TEST_STRING_1);



4
tests/setprop_inplace.c

@ -51,7 +51,7 @@ int main(int argc, char *argv[])
~TEST_VALUE_1, fdt_strerror(err)); ~TEST_VALUE_1, fdt_strerror(err));
intp = check_getprop_typed(fdt, 0, "prop-int", ~TEST_VALUE_1); intp = check_getprop_typed(fdt, 0, "prop-int", ~TEST_VALUE_1);
verbose_printf("New int value is 0x%08x\n", *intp); verbose_printf("New int value is 0x%08x\n", *intp);

strp = check_getprop(fdt, 0, "prop-str", strlen(TEST_STRING_1)+1, strp = check_getprop(fdt, 0, "prop-str", strlen(TEST_STRING_1)+1,
TEST_STRING_1); TEST_STRING_1);


@ -66,7 +66,7 @@ int main(int argc, char *argv[])
xstr, fdt_strerror(err)); xstr, fdt_strerror(err));


strp = check_getprop(fdt, 0, "prop-str", xlen+1, xstr); strp = check_getprop(fdt, 0, "prop-str", xlen+1, xstr);
verbose_printf("New string value is \"%s\"\n", strp); verbose_printf("New string value is \"%s\"\n", strp);


PASS(); PASS();
} }

1
tests/testutils.c

@ -104,7 +104,6 @@ void check_property(void *fdt, int nodeoffset, const char *name,
name, proplen, len); name, proplen, len);
if (memcmp(val, prop->data, len) != 0) if (memcmp(val, prop->data, len) != 0)
FAIL("Data mismatch on property \"%s\"", name); FAIL("Data mismatch on property \"%s\"", name);
} }


const void *check_getprop(void *fdt, int nodeoffset, const char *name, const void *check_getprop(void *fdt, int nodeoffset, const char *name,

6
tests/trees.S

@ -65,7 +65,7 @@ tree: \
#define STRING(tree, name, str) \ #define STRING(tree, name, str) \
tree##_##name: \ tree##_##name: \
.string str .string str

.data .data


TREE_HDR(test_tree1) TREE_HDR(test_tree1)
@ -77,7 +77,7 @@ test_tree1_struct:
BEGIN_NODE("") BEGIN_NODE("")
PROP_INT(test_tree1, prop_int, TEST_VALUE_1) PROP_INT(test_tree1, prop_int, TEST_VALUE_1)
PROP_STR(test_tree1, prop_str, TEST_STRING_1) PROP_STR(test_tree1, prop_str, TEST_STRING_1)

BEGIN_NODE("subnode1") BEGIN_NODE("subnode1")
PROP_INT(test_tree1, prop_int, TEST_VALUE_1) PROP_INT(test_tree1, prop_int, TEST_VALUE_1)


@ -110,7 +110,7 @@ truncated_property_struct:
BEGIN_NODE("") BEGIN_NODE("")
PROPHDR(truncated_property, prop_truncated, 4) PROPHDR(truncated_property, prop_truncated, 4)
/* Oops, no actual property data here */ /* Oops, no actual property data here */

truncated_property_strings: truncated_property_strings:
STRING(truncated_property, prop_truncated, "truncated") STRING(truncated_property, prop_truncated, "truncated")
truncated_property_end: truncated_property_end:

13
treesource.c

@ -1,7 +1,7 @@
/* /*
* (C) Copyright David Gibson <dwg@au1.ibm.com>, IBM Corporation. 2005. * (C) Copyright David Gibson <dwg@au1.ibm.com>, IBM Corporation. 2005.
* *
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the * published by the Free Software Foundation; either version 2 of the
@ -11,11 +11,11 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details. * General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA * USA
*/ */


#include "dtc.h" #include "dtc.h"
@ -77,7 +77,6 @@ static enum proptype guess_type(struct property *prop)
return PROP_CELLS; return PROP_CELLS;
else else
return PROP_BYTES; return PROP_BYTES;
} }





Loading…
Cancel
Save