diff options
author | Rob Herring <robh@kernel.org> | 2014-04-22 13:55:10 -0400 |
---|---|---|
committer | Rob Herring <robh@kernel.org> | 2014-04-30 01:59:18 -0400 |
commit | c0556d3f2c3f42eaed049139ce6f0899ecdb0217 (patch) | |
tree | 9bfbb3c61b640a8492e95f0cdff10c9734376c09 | |
parent | 1d1a661da4c8468b3fa6f567b2b1f8cdeafa847a (diff) |
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 <robh@kernel.org>
Tested-by: Grant Likely <grant.likely@linaro.org>
Tested-by: Stephen Chivers <schivers@csc.com>
-rw-r--r-- | drivers/of/fdt.c | 8 | ||||
-rw-r--r-- | include/linux/of_fdt.h | 1 |
2 files changed, 9 insertions, 0 deletions
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 | |||
@@ -554,6 +554,14 @@ unsigned long __init of_get_flat_dt_root(void) | |||
554 | } | 554 | } |
555 | 555 | ||
556 | /** | 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 | |||
564 | /** | ||
557 | * of_get_flat_dt_prop - Given a node in the flat blob, return the property ptr | 565 | * of_get_flat_dt_prop - Given a node in the flat blob, return the property ptr |
558 | * | 566 | * |
559 | * This function can be used within scan_flattened_dt callback to get | 567 | * This function can be used within scan_flattened_dt callback to get |
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, | |||
92 | extern int of_flat_dt_is_compatible(unsigned long node, const char *name); | 92 | extern int of_flat_dt_is_compatible(unsigned long node, const char *name); |
93 | extern int of_flat_dt_match(unsigned long node, const char *const *matches); | 93 | extern int of_flat_dt_match(unsigned long node, const char *const *matches); |
94 | extern unsigned long of_get_flat_dt_root(void); | 94 | extern unsigned long of_get_flat_dt_root(void); |
95 | extern int of_get_flat_dt_size(void); | ||
95 | 96 | ||
96 | extern int early_init_dt_scan_chosen(unsigned long node, const char *uname, | 97 | extern int early_init_dt_scan_chosen(unsigned long node, const char *uname, |
97 | int depth, void *data); | 98 | int depth, void *data); |