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>
This commit is contained in:
David Gibson 2007-06-13 14:18:10 +10:00
parent 857f54e79f
commit a6c76f923d
15 changed files with 70 additions and 43 deletions

View file

@ -137,13 +137,13 @@ int fdt_path_offset(const void *fdt, const char *path)
return offset;
}
struct fdt_property *fdt_get_property(const void *fdt,
int nodeoffset,
const char *name, int *lenp)
const struct fdt_property *fdt_get_property(const void *fdt,
int nodeoffset,
const char *name, int *lenp)
{
int level = 0;
uint32_t tag;
struct fdt_property *prop;
const struct fdt_property *prop;
int namestroff;
int offset, nextoffset;
int err;
@ -216,7 +216,7 @@ struct fdt_property *fdt_get_property(const void *fdt,
return NULL;
}
void *fdt_getprop(const void *fdt, int nodeoffset,
const void *fdt_getprop(const void *fdt, int nodeoffset,
const char *name, int *lenp)
{
const struct fdt_property *prop;