Skip to content

Add capability to append to property

Ayush Singh devicetree-compiler 3 versions – In review

Get series with b4
b4 am [email protected] change-id 20240827-append-f614fe3261f9

Versions newest first

  1. v3 Latest2 patches 9 repliesIn review
  2. v22 patches 10 repliesSuperseded
  3. v12 patches 4 repliesSuperseded

Changes in v3 from the cover letter

- Add support for annotations. Works similar to nodes (since they
already append by default).
- Link to v2: https://lore.kernel.org/r/[email protected]

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2dtc: Add /append-property/dtc-lexer.l dtc-parser.y dtc.h +1 more+47 -71 reply
2/2tests: Add test for append-propertytests/append_prop.dts tests/run_tests.sh+28 -00 replies

Reviews trailers per patch

1 of 2 patches has a Reviewed-by or Acked-by.

PatchSimon GlassDhruva Gole
1/2R-b R-b
2/2

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH v3 0/2] Add capability to append to property

Allow appending values to a property instead of overriding the previous values of property.

Currently, we have /delete-node/ and /delete-property/, but lack /append-property/. Hence we end up having to repeat all existing values when appending to a property (e.g. see [1] appending to clocks from [2]).

This functionality is also important for creating a device tree based implementation to support different types of addon-boards such as mikroBUS, Grove [3], etc.

In practice, it looks as follows:

```
dts-v1/;

/ {
	str-prop = "0";
};

/ {
	/append-property/ str-prop = "1";
};
```

Open items
- Appending to non-existent property:

I think it is better to create a new property if the property does not exist instead of giving an error.
If the default is an error, then the condition, "create a property if it does not exist, else append" cannot be expressed. I think this behaviour is desirable with more complex overlays required for supporting addon boards using devicetree.

[3] https://lore.kernel.org/linux-arm-kernel/[email protected]/
[2] https://elixir.bootlin.com/linux/latest/source/arch/arm64/boot/dts/renesas/r8a77951-salvator-xs.dts#L39
[1] https://elixir.bootlin.com/linux/latest/source/arch/arm64/boot/dts/renesas/r8a77951.dtsi#L3334

---
Changes in v3:
- Add support for annotations. Works similar to nodes (since they
already append by default).
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- Add comment for append struct member.
- Small code improvements
- Improve test
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Ayush Singh (2):
dtc: Add /append-property/
tests: Add test for append-property

 dtc-lexer.l           |  7 +++++++
 dtc-parser.y          |  6 ++++++
 dtc.h                 |  5 +++++
 livetree.c            | 36 +++++++++++++++++++++++++++++-------
 tests/append_prop.dts | 21 +++++++++++++++++++++
 tests/run_tests.sh    |  7 +++++++
 6 files changed, 75 insertions(+), 7 deletions(-)

---
base-commit: 99031e3a4a6e479466ae795790b44727434ca27d
change-id: 20240827-append-f614fe3261f9

Best regards,

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