devicetree-compiler.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] Add capability to create property from old property
@ 2025-03-01 13:25 Ayush Singh
  2025-03-01 13:25 ` [PATCH 1/3] Add alloc_marker Ayush Singh
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Ayush Singh @ 2025-03-01 13:25 UTC (permalink / raw)
  To: David Gibson, Andreas Gnau, d-gole, lorforlinux, jkridner,
	robertcnelson, Andrew Davis, Geert Uytterhoeven, Simon Glass
  Cc: devicetree-compiler, Ayush Singh

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 /./>``.

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

[0]: https://lore.kernel.org/devicetree-compiler/Z24nldCpXpoT7RaK@zatzit/T/#t

Signed-off-by: Ayush Singh <ayush@beagleboard.org>
---
Ayush Singh (3):
      Add alloc_marker
      dtc: Add /./
      tests: Add test for /./

 data.c              | 20 +++++++++++++++-----
 dtc-lexer.l         |  5 +++++
 dtc-parser.y        |  5 +++++
 dtc.h               |  3 +++
 livetree.c          | 44 ++++++++++++++++++++++++++++++++++++++++++--
 tests/prev_prop.dts | 21 +++++++++++++++++++++
 tests/run_tests.sh  |  7 +++++++
 7 files changed, 98 insertions(+), 7 deletions(-)
---
base-commit: ce1d8588880aecd7af264e422a16a8b33617cef7
change-id: 20241227-previous-value-c22d4eeaae72

Best regards,
-- 
Ayush Singh <ayush@beagleboard.org>


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2025-03-05  4:17 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH 0/3] Add capability to create property from old property David Gibson

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