mirror of
https://github.com/dgibson/dtc.git
synced 2026-04-12 00:47:46 -04:00
libfdt: Abolish fdt_offset_ptr_typed()
The fdt_offset_ptr_typed() macro seemed like a good idea at the time. However, it's not actually used all that often, it can silently throw away const qualifications and it uses a gcc extension (typeof) which I'd prefer to avoid for portability. Therefore, this patch gets rid of it (and the fdt_offset_ptr_typed_w() variant which was never used at all). It also makes a few variables const in testcases, which always should have been const, but weren't caught before because of the aforementioned silent discards. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
9521dc5ecc
commit
2cf86939af
6 changed files with 9 additions and 15 deletions
|
|
@ -249,7 +249,7 @@ const struct fdt_property *fdt_get_property(const void *fdt,
|
|||
|
||||
case FDT_PROP:
|
||||
err = -FDT_ERR_BADSTRUCTURE;
|
||||
prop = fdt_offset_ptr_typed(fdt, offset, prop);
|
||||
prop = fdt_offset_ptr(fdt, offset, sizeof(*prop));
|
||||
if (! prop)
|
||||
goto fail;
|
||||
namestroff = fdt32_to_cpu(prop->nameoff);
|
||||
|
|
|
|||
|
|
@ -128,12 +128,6 @@ static inline void *fdt_offset_ptr_w(void *fdt, int offset, int checklen)
|
|||
return (void *)fdt_offset_ptr(fdt, offset, checklen);
|
||||
}
|
||||
|
||||
|
||||
#define fdt_offset_ptr_typed(fdt, offset, var) \
|
||||
((typeof(var))(fdt_offset_ptr((fdt), (offset), sizeof(*(var)))))
|
||||
#define fdt_offset_ptr_typed_w(fdt, offset, var) \
|
||||
((typeof(var))(fdt_offset_ptr_w((fdt), (offset), sizeof(*(var)))))
|
||||
|
||||
uint32_t fdt_next_tag(const void *fdt, int offset, int *nextoffset);
|
||||
|
||||
/**********************************************************************/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue