libfdt: More thorough use of constification
As a read-only functions, which take a const pointer to the fdt, treat
fdt_get_property() and fdt_getprop() as returning const pointers to
within the blob. fdt_get_property_w() and fdt_getprop_w() versions
are supplied which take a non-const fdt pointer and return a non-const
pointer for the benefit of callers wishing to alter the device tree
contents.
Likewise the lower-level fdt_offset_ptr() and _fdt_offset_ptr()
functions are changed to return const pointers, with *_w() versions
supplied.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
diff --git a/fdt.c b/fdt.c
index 772da46..3572ef8 100644
--- a/fdt.c
+++ b/fdt.c
@@ -42,9 +42,9 @@
return 0;
}
-void *fdt_offset_ptr(const void *fdt, int offset, int len)
+const void *fdt_offset_ptr(const void *fdt, int offset, int len)
{
- void *p;
+ const void *p;
if (fdt_version(fdt) >= 0x11)
if (((offset + len) < offset)