From: David Gibson <david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org>
To: John Bonesio <bones-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
Subject: Re: [PATCH 2/4] Implements new features for updating existing device tree nodes.
Date: Thu, 21 Oct 2010 16:58:04 +1100 [thread overview]
Message-ID: <20101021055804.GH6227@yookeroo> (raw)
In-Reply-To: <20101020214506.2985.32859.stgit@riker>
On Wed, Oct 20, 2010 at 02:45:06PM -0700, John Bonesio wrote:
> This is interesting when the /include/ "<filename>" feature is used. This way
> we can create base device tree source files for a family of systems and modify
> the device tree for a specific system.
>
> The current sytem allows an existing node to be extended with new properties
> and subnodes.
>
> The new features allow an existing node to be replaced completely by the new
> properties and subnodes. The new features also allow an existing node to be
> deleted.
[snip]
> + | devicetree DT_REMOVENODE DT_REF ';'
> + {
> + struct node *target;
> +
> + target = get_node_by_label($1, $3);
> + if (target)
> + remove_child(target->parent, target);
> + else
> + print_error("label, '%s' not found", $3);
> + }
This still has the problem of labels disappearing into the ether.
> ;
>
> nodedef:
> diff --git a/dtc.h b/dtc.h
> index b36ac5d..a7f3667 100644
> --- a/dtc.h
> +++ b/dtc.h
> @@ -178,6 +178,7 @@ struct node *merge_nodes(struct node *old_node, struct node *new_node);
>
> void add_property(struct node *node, struct property *prop);
> void add_child(struct node *parent, struct node *child);
> +void remove_child(struct node *parent, struct node *child);
>
> const char *get_unitname(struct node *node);
> struct property *get_property(struct node *node, const char *propname);
> diff --git a/livetree.c b/livetree.c
> index 13c5f10..21a4c48 100644
> --- a/livetree.c
> +++ b/livetree.c
> @@ -202,6 +202,24 @@ void add_child(struct node *parent, struct node *child)
> *p = child;
> }
>
> +void remove_child(struct node *parent, struct node *child)
> +{
> + struct node **p;
> +
> + /* Make sure we've got a consistent tree here */
> + assert(child->parent == parent);
> +
> + p = &parent->children;
> + while (*p) {
> + if (*p == child) {
> + *p = (*p)->next_sibling;
> + break;
> + }
> + p = &((*p)->next_sibling);
> + }
> + child->parent = NULL;
> +}
> +
> struct reserve_info *build_reserve_entry(uint64_t address, uint64_t size)
> {
> struct reserve_info *new = xmalloc(sizeof(*new));
>
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
next prev parent reply other threads:[~2010-10-21 5:58 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-20 21:44 [PATCH 0/4] Series short description John Bonesio
2010-10-20 21:44 ` [PATCH 1/4] Create new and use new print_error that uses printf style formatting John Bonesio
2010-10-21 4:44 ` Grant Likely
[not found] ` <20101021044410.GD13335-MrY2KI0G/OVr83L8+7iqerDks+cytr/Z@public.gmane.org>
2010-11-13 20:40 ` Jon Loeliger
2010-10-20 21:45 ` [PATCH 2/4] Implements new features for updating existing device tree nodes John Bonesio
2010-10-21 4:47 ` Grant Likely
2010-10-21 5:58 ` David Gibson [this message]
2010-10-20 21:45 ` [PATCH 3/4] Allow nodes at the root to be specified by path as well as by label John Bonesio
2010-10-21 4:36 ` Grant Likely
2010-10-21 6:03 ` David Gibson
2010-10-20 21:45 ` [PATCH 4/4] Create a new property value that means 'undefined' John Bonesio
2010-10-21 5:20 ` Grant Likely
[not found] ` <20101021052053.GF13335-MrY2KI0G/OVr83L8+7iqerDks+cytr/Z@public.gmane.org>
2010-10-21 6:19 ` David Gibson
2010-10-21 15:20 ` John Bonesio
2010-10-22 0:38 ` David Gibson
2010-10-22 19:42 ` John Bonesio
2010-10-21 6:14 ` David Gibson
2010-10-22 19:50 ` John Bonesio
2010-10-25 0:44 ` David Gibson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20101021055804.GH6227@yookeroo \
--to=david-xt8fgy+axnrb3ne2bgzf6laj5h9x9tb+@public.gmane.org \
--cc=bones-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org \
--cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.