[Pdbg] [PATCH v3 14/22] libpdbg: Pass root node to dt_expand

Alistair Popple alistair at popple.id.au
Thu Sep 26 15:29:57 AEST 2019


Reviewed-by: Alistair Popple <alistair at popple.id.au>

On Monday, 23 September 2019 6:48:33 PM AEST Amitay Isaacs wrote:
> This will enable parsing more than one device tree.
> 
> Signed-off-by: Amitay Isaacs <amitay at ozlabs.org>
> ---
>  libpdbg/device.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/libpdbg/device.c b/libpdbg/device.c
> index 960d23a..7926040 100644
> --- a/libpdbg/device.c
> +++ b/libpdbg/device.c
> @@ -602,7 +602,7 @@ static int dt_expand_node(struct pdbg_target *node, const void *fdt, int fdt_nod
>  	return nextoffset;
>  }
>  
> -static void dt_expand(void *root, const void *fdt)
> +static void dt_expand(struct pdbg_target *root, const void *fdt)
>  {
>  	PR_DEBUG("FDT: Parsing fdt @%p\n", fdt);
>  
> @@ -742,9 +742,6 @@ skip:
>  
>  void pdbg_targets_init(void *fdt)
>  {
> -	/* Root node needs to be valid when this function returns */
> -	pdbg_dt_root = dt_new_node("", NULL, 0);
> -
>  	if (!fdt)
>  		fdt = pdbg_default_dtb();
>  
> @@ -753,7 +750,12 @@ void pdbg_targets_init(void *fdt)
>  		return;
>  	}
>  
> +	/* Root node needs to be valid when this function returns */
> +	pdbg_dt_root = dt_new_node("", NULL, 0);
> +	assert(pdbg_dt_root);
> +
>  	dt_expand(pdbg_dt_root, fdt);
> +
>  	pdbg_targets_init_virtual(pdbg_dt_root, pdbg_dt_root);
>  }
>  
> 






More information about the Pdbg mailing list