[PATCH v2 0/4] Add capability to create property from old property
Ayush Singh <[email protected]>
| Newsgroups | org.kernel.vger.devicetree-compiler |
|---|---|
| Message-ID | <[email protected]> |
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>, /./;
};
dts to source output with -T -T also works as expected:
/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 */
[0]: https://lore.kernel.org/devicetree-compiler/Z24nldCpXpoT7RaK@zatzit/T/#t
Signed-off-by: Ayush Singh <[email protected]>
---
Changes in v2:
- Compare against expected dtb instead of checking each property
individually in tests.
- Use xstrdup when copying refs so each marker has it's own copy.
- Pass struct data by value, not by pointer.
- Add srcpos_free helper to properly free srcpos which have been
extended previously.
- Remove open items since my original choices seem correct.
- Link to v1: https://lore.kernel.org/r/[email protected]
---
Ayush Singh (4):
Add alloc_marker
srcpos: Define srcpos_free
dtc: Add /./
tests: Add test for /./
data.c | 20 +++++++++++++-----
dtc-lexer.l | 5 +++++
dtc-parser.y | 5 +++++
dtc.h | 3 +++
livetree.c | 50 ++++++++++++++++++++++++++++++++++++++++++--
srcpos.c | 11 ++++++++++
srcpos.h | 1 +
tests/prev_prop.dts | 25 ++++++++++++++++++++++
tests/prev_prop_expected.dts | 13 ++++++++++++
tests/run_tests.sh | 5 +++++
10 files changed, 131 insertions(+), 7 deletions(-)
---
base-commit: ce1d8588880aecd7af264e422a16a8b33617cef7
change-id: 20241227-previous-value-c22d4eeaae72
Best regards,
--
Ayush Singh <[email protected]>