Re: [PATCH v2 18/21] powerpc: use libfdt accessors for header data
From: Michal Simek
Date: Wed Apr 23 2014 - 09:48:58 EST
On 04/23/2014 03:18 AM, Rob Herring wrote:
> 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: Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx>
> Cc: Paul Mackerras <paulus@xxxxxxxxx>
> ---
> v2: As powerpc is the only platform needing FDT header access, make
> prom.c include libfdt directly.
>
> arch/powerpc/kernel/Makefile | 1 +
> arch/powerpc/kernel/prom.c | 11 ++++++-----
> 2 files changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
> index fcc9a89..fab19ec 100644
> --- a/arch/powerpc/kernel/Makefile
> +++ b/arch/powerpc/kernel/Makefile
> @@ -2,6 +2,7 @@
> # Makefile for the linux kernel.
> #
>
> +CFLAGS_prom.o = -I$(src)/../../../scripts/dtc/libfdt
> CFLAGS_ptrace.o += -DUTS_MACHINE='"$(UTS_MACHINE)"'
>
> subdir-ccflags-$(CONFIG_PPC_WERROR) := -Werror
> diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
> index b1de8e3..0239f0b 100644
> --- a/arch/powerpc/kernel/prom.c
> +++ b/arch/powerpc/kernel/prom.c
> @@ -33,6 +33,7 @@
> #include <linux/memblock.h>
> #include <linux/of.h>
> #include <linux/of_fdt.h>
> +#include <linux/libfdt.h>
>
> #include <asm/prom.h>
> #include <asm/rtas.h>
> @@ -117,14 +118,14 @@ static void __init move_device_tree(void)
> DBG("-> move_device_tree\n");
>
> start = __pa(initial_boot_params);
> - size = be32_to_cpu(initial_boot_params->totalsize);
> + size = fdt_totalsize(initial_boot_params);
In 19/21 you use your newly introduced of_get_flat_dt_size()
that's why I expect you will use it here too.
size = of_get_flat_dt_size();
The same is for 14/21 where you can use this new function too.
It means moving 14/21 to the end and using this new function
makes more sense.
Thanks,
Michal
--
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform
Attachment:
signature.asc
Description: OpenPGP digital signature