From: David Gibson <david@gibson.dropbear.id.au>
To: Ayush Singh <ayush@beagleboard.org>
Cc: Andreas Gnau <andreas.gnau@iopsys.eu>,
d-gole@ti.com, lorforlinux@beagleboard.org,
jkridner@beagleboard.org, robertcnelson@beagleboard.org,
Andrew Davis <afd@ti.com>,
Geert Uytterhoeven <geert@linux-m68k.org>,
Simon Glass <sjg@chromium.org>,
devicetree-compiler@vger.kernel.org
Subject: Re: [PATCH 0/3] Add capability to create property from old property
Date: Mon, 3 Mar 2025 20:02:02 +1100 [thread overview]
Message-ID: <Z8VwCsTCGXkFD46h@zatzit> (raw)
In-Reply-To: <20250301-previous-value-v1-0-71d612eb0ea9@beagleboard.org>
[-- Attachment #1: Type: text/plain, Size: 2268 bytes --]
On Sat, Mar 01, 2025 at 06:55:01PM +0530, Ayush Singh wrote:
> Allow construction of new values for a property using old property
> value.
>
> This was originally suggested in /append-property/ Patch series [0] and
> can be used to achieve the same results (and much more).
>
> In practice, it looks as follows:
>
> dts-v1/;
>
> / {
> str-prop = "0";
> int-prop = <0>;
> };
>
> / {
> str-prop = /./, "1", /./;
> int-prop = /./, <1>, /./;
> };
>
> Open Items:
>
> - Integer array:
>
> Currently, the use with integer arrays looks as follows:
>
> /dts-v1/;
>
> / {
> int-prop = <0 1>;
> };
>
> / {
> int-prop = /./, <2 3>, /./;
> };
>
> This will produce the correct code, and I personally prefer the
> current syntax to ``</./ 1 /./>``.
You've made the correct choice. We don't exactly keep track of types
in dtc, but we do some things close enough that you can kind of think
of things in terms of types. </./ 1 /./> would make no sense from a
typing point of view, because you're putting a bytestring value /./ in
an operator that expects integers < ... >.
> - dts to source output can look somewhat weird
>
> The above dts produces the following with annoation:
>
> /dts-v1/;
>
> / { /* base.dts:3:3-5:3, base.dts:7:3-9:3 */
> int-prop = <0x00 0x01>, <0x02 0x03>, <0x00 0x01>; /* base.dts:4:9-4:26, base.dts:8:9-8:36 */
> }; /* base.dts:3:3-5:3, base.dts:7:3-9:3 */
>
> It isn't a real problem since it allows easily tracing that some parts
> were constructed at other places, but is differnt from how a normal
> array would appear.
Right. This is just another example of the fact that properties are
just bytestrings, so how we format them for -Odts is a guess as to
type. I sometimes think that preserving some "type" information
during the run so that -I dts -O dts will give output more similar to
the input was a mistake, since it can increase the false impression
that the dtb format is self-describing.
--
David Gibson (he or they) | 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 --]
prev parent reply other threads:[~2025-03-03 10:07 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-01 13:25 [PATCH 0/3] Add capability to create property from old property Ayush Singh
2025-03-01 13:25 ` [PATCH 1/3] Add alloc_marker Ayush Singh
2025-03-03 9:35 ` David Gibson
2025-03-01 13:25 ` [PATCH 2/3] dtc: Add /./ Ayush Singh
2025-03-05 4:14 ` David Gibson
2025-03-01 13:25 ` [PATCH 3/3] tests: Add test for /./ Ayush Singh
2025-03-05 4:17 ` David Gibson
2025-03-03 9:02 ` David Gibson [this message]
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=Z8VwCsTCGXkFD46h@zatzit \
--to=david@gibson.dropbear.id.au \
--cc=afd@ti.com \
--cc=andreas.gnau@iopsys.eu \
--cc=ayush@beagleboard.org \
--cc=d-gole@ti.com \
--cc=devicetree-compiler@vger.kernel.org \
--cc=geert@linux-m68k.org \
--cc=jkridner@beagleboard.org \
--cc=lorforlinux@beagleboard.org \
--cc=robertcnelson@beagleboard.org \
--cc=sjg@chromium.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).