[PATCH 18/20] x86: use libfdt accessors for header data

From: Rob Herring
Date: Thu Apr 03 2014 - 18:22:10 EST

From: Rob Herring <robh@xxxxxxxxxx>

With libfdt support, we can take advantage of helper accessors in libfdt
for accessing the FDT header data. This makes the code more readable and
makes the FDT blob structure more opaque to the kernel. This also
prepares for removing struct boot_param_header completely.

Signed-off-by: Rob Herring <robh@xxxxxxxxxx>
Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxxxxx>
Cc: "H. Peter Anvin" <hpa@xxxxxxxxx>
Cc: x86@xxxxxxxxxx
arch/x86/kernel/devicetree.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kernel/devicetree.c b/arch/x86/kernel/devicetree.c
index d35078e..f49f57f 100644
--- a/arch/x86/kernel/devicetree.c
+++ b/arch/x86/kernel/devicetree.c
@@ -206,16 +206,15 @@ static void __init dtb_apic_setup(void)
static void __init x86_flattree_get_config(void)
u32 size, map_len;
- struct boot_param_header *dt;
+ const void *dt;

if (!initial_dtb)

- map_len = max(PAGE_SIZE - (initial_dtb & ~PAGE_MASK),
- (u64)sizeof(struct boot_param_header));
+ map_len = max(PAGE_SIZE - (initial_dtb & ~PAGE_MASK), FDT_V17_SIZE);

dt = early_memremap(initial_dtb, map_len);
- size = be32_to_cpu(dt->totalsize);
+ size = fdt_totalsize(dt);
if (map_len < size) {
early_iounmap(dt, map_len);
dt = early_memremap(initial_dtb, size);

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/