[Pdbg] [PATCH 03/23] libpdbg: Rename function to reflect the functionality

Alistair Popple alistair at popple.id.au
Thu Sep 19 13:03:17 AEST 2019


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

On Thursday, 19 September 2019 12:33:13 PM AEST Amitay Isaacs wrote:
> Signed-off-by: Amitay Isaacs <amitay at ozlabs.org>
> ---
>  libpdbg/device.c | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/libpdbg/device.c b/libpdbg/device.c
> index 6c3b769..6e2e7bb 100644
> --- a/libpdbg/device.c
> +++ b/libpdbg/device.c
> @@ -173,26 +173,26 @@ static int dt_cmp_subnodes(const struct pdbg_target *a, const struct pdbg_target
>  	return strcmp(a->dn_name, b->dn_name);
>  }
>  
> -static bool dt_attach_root(struct pdbg_target *parent, struct pdbg_target *root)
> +static bool dt_attach_node(struct pdbg_target *parent, struct pdbg_target *child)
>  {
>  	struct pdbg_target *node = NULL;
>  
> -	assert(!root->parent);
> +	assert(!child->parent);
>  
>  	if (list_empty(&parent->children)) {
> -		list_add(&parent->children, &root->list);
> -		root->parent = parent;
> +		list_add(&parent->children, &child->list);
> +		child->parent = parent;
>  
>  		return true;
>  	}
>  
>  	dt_for_each_child(parent, node) {
> -		int cmp = dt_cmp_subnodes(node, root);
> +		int cmp = dt_cmp_subnodes(node, child);
>  
>  		/* Look for duplicates */
>  		if (cmp == 0) {
>  			prerror("DT: %s failed, duplicate %s\n",
> -				__func__, root->dn_name);
> +				__func__, child->dn_name);
>  			return false;
>  		}
>  
> @@ -202,8 +202,8 @@ static bool dt_attach_root(struct pdbg_target *parent, struct pdbg_target *root)
>  			break;
>  	}
>  
> -	list_add_before(&parent->children, &root->list, &node->list);
> -	root->parent = parent;
> +	list_add_before(&parent->children, &child->list, &node->list);
> +	child->parent = parent;
>  
>  	return true;
>  }
> @@ -583,7 +583,7 @@ static int dt_expand_node(struct pdbg_target *node, const void *fdt, int fdt_nod
>  			 * going for now, we may ultimately want to
>  			 * assert
>  			 */
> -			(void)dt_attach_root(node, child);
> +			(void)dt_attach_node(node, child);
>  			break;
>  		case FDT_END:
>  			return -1;
> 






More information about the Pdbg mailing list