libfdt: Add fdt_header_size()
We have a couple of places within libfdt and its tests where we need to find the size of the header, based on the version. Add a helper function for it. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Alexey Kardashevskiy <aik@ozlabs.ru> Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
This commit is contained in:
@@ -44,13 +44,9 @@ static void expand_buf(struct bufstate *buf, int newsize)
|
||||
|
||||
static void new_header(struct bufstate *buf, int version, const void *fdt)
|
||||
{
|
||||
int hdrsize;
|
||||
int hdrsize = fdt_header_size_(version);
|
||||
|
||||
if (version == 16)
|
||||
hdrsize = FDT_V16_SIZE;
|
||||
else if (version == 17)
|
||||
hdrsize = FDT_V17_SIZE;
|
||||
else
|
||||
if ((version != 16) && (version != 17))
|
||||
CONFIG("Bad version %d", version);
|
||||
|
||||
expand_buf(buf, hdrsize);
|
||||
|
||||
Reference in New Issue
Block a user