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:
signature.asc
Description: PGP signature