Skip to content

Add capability to create property from old property

Ayush Singh devicetree-compiler 3 versions – Applied

Status from this message: Merged, thanks.

Get series with b4
b4 am [email protected] change-id 20241227-previous-value-c22d4eeaae72

Versions newest first

  1. v3 Latest4 patches 2 repliesApplied
  2. v24 patches 4 repliesSuperseded
  3. v13 patches 4 repliesSuperseded

Changes in v3 from the cover letter

- Rebase on main
- Fix Patch 2 commit message example.
- Rename data_insert_old_value to data_insert_data.
- Move data_insert_data to data.c and split into independent patch.
- Rename DT_PREV_PROP to DT_PREV_VALUE.
- Make prev_value_used local to while loop.
- Link to v2: https://lore.kernel.org/r/[email protected]

Patches in v3 Applied

#Subject and filesSizeRepliesApplied
1/4srcpos: Define srcpos_freelivetree.c srcpos.c srcpos.h+13 -11 reply
2/4dtc: Add data_insert_data functiondata.c dtc.h+28 -01 reply
3/4dtc: Add /./dtc-lexer.l dtc-parser.y dtc.h +1 more+32 -20 replies
4/4tests: Add test for /./tests/prev_prop.dts tests/prev_prop_expected.dts tests/run_tests.sh+43 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.

Read the v3 thread

Cover letter [PATCH v3 0/4] Add capability to create property from old property

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

---
Changes in v3:
- Rebase on main
- Fix Patch 2 commit message example.
- Rename data_insert_old_value to data_insert_data.
- Move data_insert_data to data.c and split into independent patch.
- Rename DT_PREV_PROP to DT_PREV_VALUE.
- Make prev_value_used local to while loop.
- Link to v2: https://lore.kernel.org/r/[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):
srcpos: Define srcpos_free
dtc: Add data_insert_data function
dtc: Add /./
tests: Add test for /./

 data.c                       | 27 +++++++++++++++++++++++++++
 dtc-lexer.l                  |  5 +++++
 dtc-parser.y                 |  5 +++++
 dtc.h                        |  2 ++
 livetree.c                   | 23 +++++++++++++++++++++--
 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, 115 insertions(+), 2 deletions(-)

---
base-commit: e0b7749c26a9ea28a480bca4a87d238e284ac68f
change-id: 20241227-previous-value-c22d4eeaae72

Best regards,

Signature · 1 line
Ayush Singh <[email protected]>