[PATCH 0/3] Add capability to create property from old property

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



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





[Index of Archives]     [Device Tree]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux