devicetree-spec.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org>
To: Kumar Gala <kumar.gala-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Cc: "Bolivar,
	Marti" <Marti.Bolivar-hR+23Fw+YnFSHonuZl5R5Q@public.gmane.org>,
	Grant Likely <Grant.Likely-5wv7dgnIgG8@public.gmane.org>,
	Rob.Herring-5wv7dgnIgG8@public.gmane.org,
	devicetree-spec-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: Node name & property name collusion - json/yaml implications
Date: Sat, 6 Feb 2021 18:11:31 +1100	[thread overview]
Message-ID: <20210206071131.GA61463@yekko.fritz.box> (raw)
In-Reply-To: <C008DF92-364E-4892-A1C0-68A2C97BE946-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 1614 bytes --]

On Fri, Feb 05, 2021 at 06:57:54AM -0600, Kumar Gala wrote:
> There’s an old thread about this from 2016:
> 
> https://www.spinics.net/lists/devicetree-spec/msg00296.html

That is not the only case of this - IIRC old Apple machine device
trees had both an 'l2-cache' property and an 'l2-cache' node under
each CPU node.

> In which its clearly stated that node names and property names technically can be the same.  However, as we’ve starting utilizing tooling like JSON for validation, does it make sense to maintain this and should we update the specification to require that a node name and property name at the same hierarchy in the tree is not allowed?
> 
> Otherwise we get into fun situations like, being valid DTS, but invalid YAML, and various tools not working correct as the YAML loaders have to pick one or there the other version of ‘foo’:
> 
> [Example is from Marti]
> 
> /dts-v1/;
> / {
> 	foo;
> 	foo {
> 		bar = <0>;
> 	};
> };
> 
> (Using pyYAML)
> 
> $ dtc -I dts -O yaml ./foo.dts | python -c 'import sys, yaml; print(yaml.safe_load(sys.stdin.read()))’
> [{'foo': {'bar': [[0]]}}]
> 
> (Using ruamel, w/allow_duplicate_keys as dt-schema does)
> 
> $ dtc -I dts -O yaml ./foo.dts | python -c 'import sys, ruamel.yaml; yaml = ruamel.yaml.YAML(typ="safe"); yaml.allow_duplicate_keys = True; print(yaml.load(sys.stdin.read()))’
> [{'foo': True}]
> 
> - k

-- 
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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  parent reply	other threads:[~2021-02-06  7:11 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-05 12:57 Node name & property name collusion - json/yaml implications Kumar Gala
     [not found] ` <C008DF92-364E-4892-A1C0-68A2C97BE946-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2021-02-05 17:25   ` Rob Herring
     [not found]     ` <65e8549e-2c90-903a-ed70-a1bda1a02af7-5wv7dgnIgG8@public.gmane.org>
2021-02-05 17:28       ` Kumar Gala
2021-02-06  7:11   ` David Gibson [this message]
     [not found]     ` <20210206071131.GA61463-l+x2Y8Cxqc4e6aEkudXLsA@public.gmane.org>
2021-02-08 14:39       ` Kumar Gala
     [not found]         ` <9B77D509-0790-4210-9B24-24527A8743D8-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2021-02-10  1:35           ` David Gibson
2021-02-08 15:01       ` Rob Herring
     [not found]         ` <CAL_Jsq+e7JjDJTAkDJj_6bcc70QZSZ3cP8012TE7QEf3+sid3Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2021-02-08 15:47           ` Arnd Bergmann
     [not found]             ` <CAK8P3a34jOEFo6YfW752bVjEkh4sVr1dnRU+Y0wW9r+9YHXrzg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2021-02-08 16:00               ` Rob Herring
     [not found]                 ` <CAL_JsqKxuN-3_2eMbmxnLGXCo2PjOVxqsn7RQqQwTdKg_sJLAg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2021-02-08 16:07                   ` Kumar Gala

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=20210206071131.GA61463@yekko.fritz.box \
    --to=david-xt8fgy+axnrb3ne2bgzf6laj5h9x9tb+@public.gmane.org \
    --cc=Grant.Likely-5wv7dgnIgG8@public.gmane.org \
    --cc=Marti.Bolivar-hR+23Fw+YnFSHonuZl5R5Q@public.gmane.org \
    --cc=Rob.Herring-5wv7dgnIgG8@public.gmane.org \
    --cc=devicetree-spec-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=kumar.gala-QSEj5FYQhm4dnm+yROfE0A@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;
as well as URLs for NNTP newsgroup(s).