mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Douglas Anderson <dianders@chromium.org>
To: Rob Herring <robh@kernel.org>, Saravana Kannan <saravanak@google.com>
Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	Douglas Anderson <dianders@chromium.org>
Subject: [PATCH 1/2] checks: Allow "__overlay__" node at the root of an overlay fragment
Date: Mon, 10 Nov 2025 12:45:26 -0800	[thread overview]
Message-ID: <20251110204529.2838248-1-dianders@chromium.org> (raw)

Checking a `dtso` file will give the following warning:
  Warning (node_name_chars_strict): /fragment@<num>/__overlay__: Character '_' not recommended in node name

Add the node named "__overlay__" at the root of a fragment as a
special case to not warn about.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
---

 checks.c | 33 ++++++++++++++++++++++++++++++++-
 1 file changed, 32 insertions(+), 1 deletion(-)

diff --git a/checks.c b/checks.c
index 5d092164ee12..908df5b98ec5 100644
--- a/checks.c
+++ b/checks.c
@@ -192,6 +192,25 @@ out:
 	return error;
 }
 
+/* Return the path after "/fragment@<num>" or NULL if path doesn't start "/fragment@<num>/"" */
+static const char *get_fragment_relative_path(const char *fullpath)
+{
+	const char *p;
+
+	if (strncmp(fullpath, "/fragment@", 10) != 0)
+		return NULL;
+
+	p = &(fullpath[10]);
+	if (!isdigit(*p))
+		return NULL;
+	while (isdigit(*p))
+		p++;
+	if (*p != '/')
+		return NULL;
+
+	return p;
+}
+
 /*
  * Utility check functions
  */
@@ -324,8 +343,20 @@ ERROR(node_name_chars, check_node_name_chars, NODECHARS);
 static void check_node_name_chars_strict(struct check *c, struct dt_info *dti,
 					 struct node *node)
 {
-	int n = strspn(node->name, c->data);
+	int n;
+
+	/*
+	 * The node named "__overlay__" is allowed at the root of a fragment
+	 * in an overlay.
+	 */
+	if (dti->dtsflags & DTSF_PLUGIN) {
+		const char *frag_path = get_fragment_relative_path(node->fullpath);
+
+		if (frag_path && streq(frag_path, "/__overlay__"))
+			return;
+	}
 
+	n = strspn(node->name, c->data);
 	if (n < node->basenamelen)
 		FAIL(c, dti, node, "Character '%c' not recommended in node name",
 		     node->name[n]);
-- 
2.51.2.1041.gc1ab5b90ca-goog


             reply	other threads:[~2025-11-10 20:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-10 20:45 Douglas Anderson [this message]
2025-11-10 20:45 ` [PATCH 2/2] checks: Allow "chosen" node under "__overlay__" for a DT fragment Douglas Anderson

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=20251110204529.2838248-1-dianders@chromium.org \
    --to=dianders@chromium.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=saravanak@google.com \
    /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

all inboxes | Powered by JetHome®