dtc: Use the same endian-conversion functions as libfdt

Currently both libfdt and dtc define a set of endian conversion macros
for accessing the device tree blob which is always big-endian.  libfdt
uses names like cpu_to_fdt32() and dtc uses names like cpu_to_be32 (as
the Linux kernel).  This patch switches dtc over to using the libfdt
macros (including libfdt_env.h to supply them).  This has a couple of
small advantages:
	- Removes some code duplication
	- Will make conversion a bit easier if we ever need to produce
          little-endian device tree blobs.
	- dtc no longer needs to pull in netinet/in.h simply for the
          ntohs() and ntohl() functions

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
David Gibson 2008-06-25 14:27:53 +10:00 committed by Jon Loeliger
parent 53359016ca
commit c8c374b856
6 changed files with 38 additions and 59 deletions

View file

@ -147,7 +147,7 @@ static void write_propval_cells(FILE *f, struct data val)
m = m->next;
}
fprintf(f, "0x%x", be32_to_cpu(*cp++));
fprintf(f, "0x%x", fdt32_to_cpu(*cp++));
if ((void *)cp >= propend)
break;
fprintf(f, " ");