aboutsummaryrefslogtreecommitdiff
path: root/libfdt/fdt_rw.c
AgeCommit message (Collapse)Author
2008-08-24libfdt: Increase namespace-pollution paranoiaDavid Gibson
libfdt is supposed to easy to embed in projects all and sundry. Often, it won't be practical to separate the embedded libfdt's namespace from that of the surrounding project. Which means there can be namespace conflicts between even libfdt's internal/static functions and functions or macros coming from the surrounding project's headers via libfdt_env.h. This patch, therefore, renames a bunch of libfdt internal functions and macros and makes a few other chances to reduce the chances of namespace collisions with embedding projects. Specifically: - Internal functions (even static ones) are now named _fdt_*() - The type and (static) global for the error table in fdt_strerror() gain an fdt_ prefix - The unused macro PALIGN is removed - The memeq and streq macros are removed and open-coded in the users (they were only used once each) - Other macros gain an FDT_ prefix - To save some of the bulk from the previous change, an FDT_TAGALIGN() macro is introduced, where FDT_TAGALIGN(x) == FDT_ALIGN(x, FDT_TAGSIZE) Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2008-08-24dtc: Enable and fix -Wcast-qual warningsDavid Gibson
Enabling -Wcast-qual warnings in dtc shows up a number of places where we are incorrectly discarding a const qualification. There are also some places where we are intentionally discarding the 'const', and we need an ugly cast through uintptr_t to suppress the warning. However, most of these are pretty well isolated with the *_w() functions. So in the interests of maximum safety with const qualifications, this patch enables the warnings and fixes the existing complaints. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Acked-by: Gerald Van Baren <vanbaren@cideas.com>
2008-08-24dtc: Enable and fix -Wpointer-arith warningsDavid Gibson
This patch turns on the -Wpointer-arith option in the dtc Makefile, and fixes the resulting warnings due to using (void *) in pointer arithmetic. While convenient, pointer arithmetic on void * is not portable, so it's better that we avoid it, particularly in libfdt. Also add necessary definition of uintptr_t needed by David Gibson's changeset "dtc: Enable and fix -Wpointer-arith warnings" (the definition comes from stdint.h, which u-boot doesn't have). -- gvb Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Gerald Van Baren <vanbaren@cideas.com>
2008-06-09libfdt: Several cleanups to parameter checkingDavid Gibson
This patch makes a couple of small cleanups to parameter checking of libfdt functions. - In several functions which take a node offset, we use an idiom involving fdt_next_tag() first to check that we have indeed been given a node offset. This patch adds a helper function _fdt_check_node_offset() to encapsulate this usage of fdt_next_tag(). - In fdt_rw.c in several places we have the expanded version of the RW_CHECK_HEADER() macro for no particular reason. This patch replaces those instances with an invocation of the macro; that's what it's for. - In fdt_sw.c we rename the check_header_sw() function to sw_check_header() to match the analgous function in fdt_rw.c, and we provide an SW_CHECK_HEADER() wrapper macro as RW_CHECK_HEADER() functions in fdt_rw.c Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2008-03-26Merge branch 'new-image' of git://www.denx.de/git/u-boot-testingBartlomiej Sieka
Conflicts: common/cmd_bootm.c cpu/mpc8xx/cpu.c Signed-off-by: Bartlomiej Sieka <tur@semihalf.com>
2008-03-18libfdt: Trivial cleanup for CHECK_HEADER)David Gibson
Currently the CHECK_HEADER() macro is defined local to fdt_ro.c. However, there are a handful of functions (fdt_move, rw_check_header, fdt_open_into) from other files which could also use it (currently they open-code something more-or-less identical). Therefore, this patch moves CHECK_HEADER() to libfdt_internal.h and uses it in those places. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2008-03-18libfdt: Fix NOP handling bug in fdt_add_subnode_namelen()David Gibson
fdt_add_subnode_namelen() has a bug if asked to add a subnode to a node which has NOP tags interspersed with its properties. In this case fdt_add_subnode_namelen() will put the new subnode before the first NOP tag, even if there are properties after it, which will result in an invalid blob. This patch fixes the bug, and adds a testcase for it. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2008-03-18libfdt: Add fdt_set_name() functionDavid Gibson
This patch adds an fdt_set_name() function to libfdt, mirroring fdt_get_name(). This is a r/w function which alters the name of a given device tree node. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2008-02-29[new uImage] Add libfdt support to mkimageBartlomiej Sieka
Signed-off-by: Bartlomiej Sieka <tur@semihalf.com>
2008-01-08LIBFDT: use memmove() instead of memcpy()Gerald Van Baren
This is partial patch from the DTC/libfdt commit 67b6b33b9b413a450a72135b5dc59c0a1e33e647 Author: David Gibson <david@gibson.dropbear.id.au> Date: Wed Nov 21 11:56:14 2007 +1100 The patch also fixes one genuine bug caught by valgrind - _packblocks() in fdt_rw.c was using memcpy() where it should have been using memmove(). Signed-off-by: Gerald Van Baren <vanbaren@cideas.com>
2007-11-21Update libfdt from device tree compiler (dtc)Kumar Gala
Update libfdt to commit 8eaf5e358366017aa2e846c5038d1aa19958314e from the device tree compiler (dtc) project. Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
2007-11-21Removed some nonused fdt functions and moved fdt_find_and_setprop out of libfdtKumar Gala
Removed: fdt_node_is_compatible fdt_find_node_by_type fdt_find_compatible_node To ease merge of newer libfdt as we aren't using them anywhere at this time. Also moved fdt_find_and_setprop out of libfdt into fdt_support.c for the same reason. Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
2007-11-21[BUILD] conditionally compile libfdt/*.c in libfdt/MakefileKumar Gala
Modify libfdt/Makefile to conditionally compile the *.c files based on the board config. Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
2007-09-06libfdt: add convenience function fdt_find_and_setprop()Grant Likely
Given the path to a node, fdt_find_and_setprop() allows a property value to be set directly. Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2007-08-10libfdt: Conditionally compile based on CONFIG_OF_LIBFDTGerald Van Baren
This is the way u-boot reduces configured-out code. At Wolfgang Grandegger and Wolfgang Denk's request, make libfdt conform. Signed-off-by: Gerald Van Baren <vanbaren@cideas.com>
2007-04-06libfdt: Make fdt_check_header() publicGerald Van Baren
Changed _fdt_check_header() to fdt_check_header() and made it part of the interface - it is a useful routine. Also did some asthetics cleanup to the include files (headers).
2007-03-31libfdt: Enhanced and published fdt_next_tag()Gerald Van Baren
Enhanced the formerly private function _fdt_next_tag() to allow stepping through the tree, used to produce a human-readable dump, and made it part of the published interface. Also added some comments.
2007-03-31libfdt: Import libfdt source (2 of 2)Gerald Van Baren
This adds the applicable libfdt source files (unmodified) and a README to explain where the source came from.