Devicetree
 help / color / mirror / Atom feed
From: John Bonesio <bones-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
To: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
Subject: [PATCH 2/2] Allow nodes at the root to be specified by path as well as by label.
Date: Mon, 18 Oct 2010 13:25:50 -0700	[thread overview]
Message-ID: <20101018202540.24286.12690.stgit@riker> (raw)
In-Reply-To: <20101018202353.24286.74857.stgit@riker>

Changes to allow us to specify a node by it's path. A path can be used in
place of a label.

This is particularly useful when overriding existing nodes.
This way we don't have to label every possible node in a device tree we know
is a base device tree for a class of systems, and we know the tree will be
modified for the specific systems.

Signed-off-by: John Bonesio <bones-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
---

 dtc-parser.y |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/dtc-parser.y b/dtc-parser.y
index 56d7789..0efd0cc 100644
--- a/dtc-parser.y
+++ b/dtc-parser.y
@@ -134,22 +134,30 @@ devicetree:
 		{
 			struct node *target;
 
-			target = get_node_by_label($1, $2);
+			if ($2[0] == '/')
+				target = get_node_by_path($1, $2);
+			else
+				target = get_node_by_label($1, $2);
+
 			if (target)
 				merge_nodes(target, $3);
 			else
-				print_error("label, '%s' not found", $2);
+				print_error("label or path, '%s', not found", $2);
 			$$ = $1;
 		}
 	| devicetree DT_REMOVENODE DT_REF ';'
 		{
 			struct node *target;
 
-			target = get_node_by_label($1, $3);
+			if ($3[0] == '/')
+				target = get_node_by_path($1, $3);
+			else
+				target = get_node_by_label($1, $3);
+
 			if (target)
 				remove_nodes(target);
 			else
-				print_error("label, '%s' not found", $3);
+				print_error("label or path, '%s', not found", $3);
 		}
 	;

  reply	other threads:[~2010-10-18 20:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-18 20:25 [PATCH 1/2] Implements new features for updating existing device tree nodes John Bonesio
2010-10-18 20:25 ` John Bonesio [this message]
2010-10-18 20:50   ` [PATCH 2/2] Allow nodes at the root to be specified by path as well as by label Grant Likely
     [not found]     ` <AANLkTimi_w-3pd9U6mKj5A78RzOp2KdBvh3fqgNTFBqH@mail.gmail.com>
     [not found]       ` <20101018215143.GC3337@angua.secretlab.ca>
     [not found]         ` <20101018215143.GC3337-MrY2KI0G/OVr83L8+7iqerDks+cytr/Z@public.gmane.org>
2010-10-18 23:36           ` John Bonesio
     [not found]             ` <AANLkTimT6WaCDgLM-cqEvrUqTmeDDohOGEgxDXjxssPQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-10-19  2:33               ` David Gibson
2010-10-23 23:14                 ` node reference: path from a label John Bonesio
2010-10-25  4:26                   ` David Gibson
2010-11-02  4:42                     ` Grant Likely
2010-10-19  2:14   ` [PATCH 2/2] Allow nodes at the root to be specified by path as well as by label David Gibson
2010-10-19 16:05     ` John Bonesio
2010-10-19 21:51       ` David Gibson
2010-10-18 20:42 ` [PATCH 1/2] Implements new features for updating existing device tree nodes Grant Likely

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=20101018202540.24286.12690.stgit@riker \
    --to=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox