From c0556d3f2c3f42eaed049139ce6f0899ecdb0217 Mon Sep 17 00:00:00 2001 From: Rob Herring Date: Tue, 22 Apr 2014 12:55:10 -0500 Subject: [PATCH] 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 Tested-by: Grant Likely Tested-by: Stephen Chivers --- drivers/of/fdt.c | 8 ++++++++ include/linux/of_fdt.h | 1 + 2 files changed, 9 insertions(+) diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index d9e64504cda0..358bcf0500d2 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -553,6 +553,14 @@ unsigned long __init of_get_flat_dt_root(void) return 0; } +/** + * of_get_flat_dt_size - Return the total size of the FDT + */ +int __init of_get_flat_dt_size(void) +{ + return fdt_totalsize(initial_boot_params); +} + /** * of_get_flat_dt_prop - Given a node in the flat blob, return the property ptr * diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h index 348dae2c8a3c..e10099c95999 100644 --- a/include/linux/of_fdt.h +++ b/include/linux/of_fdt.h @@ -92,6 +92,7 @@ extern const void *of_get_flat_dt_prop(unsigned long node, const char *name, extern int of_flat_dt_is_compatible(unsigned long node, const char *name); extern int of_flat_dt_match(unsigned long node, const char *const *matches); extern unsigned long of_get_flat_dt_root(void); +extern int of_get_flat_dt_size(void); extern int early_init_dt_scan_chosen(unsigned long node, const char *uname, int depth, void *data); -- 2.39.5