Skip to content

Commit c0556d3

Browse files
committed
of/fdt: introduce of_get_flat_dt_size
Add a wrapper function to retrieve the FDT size from the FDT header. This is primarily to avoid libfdt include paths for the whole kernel. Signed-off-by: Rob Herring <[email protected]> Tested-by: Grant Likely <[email protected]> Tested-by: Stephen Chivers <[email protected]>
1 parent 1d1a661 commit c0556d3

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

drivers/of/fdt.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,14 @@ unsigned long __init of_get_flat_dt_root(void)
553553
return 0;
554554
}
555555

556+
/**
557+
* of_get_flat_dt_size - Return the total size of the FDT
558+
*/
559+
int __init of_get_flat_dt_size(void)
560+
{
561+
return fdt_totalsize(initial_boot_params);
562+
}
563+
556564
/**
557565
* of_get_flat_dt_prop - Given a node in the flat blob, return the property ptr
558566
*

include/linux/of_fdt.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ extern const void *of_get_flat_dt_prop(unsigned long node, const char *name,
9292
extern int of_flat_dt_is_compatible(unsigned long node, const char *name);
9393
extern int of_flat_dt_match(unsigned long node, const char *const *matches);
9494
extern unsigned long of_get_flat_dt_root(void);
95+
extern int of_get_flat_dt_size(void);
9596

9697
extern int early_init_dt_scan_chosen(unsigned long node, const char *uname,
9798
int depth, void *data);

0 commit comments

Comments
 (0)