Re: [PATCH v3 1/2] dtc: Add /append-property/

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



On Nov 11, 2024 at 15:24:33 +0530, Ayush Singh wrote:
> 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.
> 
> The annotate feature works similar to how it works for nodes. Here is a
> small example:
> 
> base.dtsi
> ```
> /dts-v1/;
> 
> / {
> 	prop = "0";
> 	propa = <0>;
> };
> ```
> 
> app1.dtsi
> ```
> /dts-v1/;
> 
> /include/ "base.dtsi"
> 
> / {
> 	/append-property/ prop = "1";
> };
> ```
> 
> app2.dts
> ```
> /dts-v1/;
> 
> /include/ "app1.dtsi"
> 
> / {
> 	/append-property/ prop = "2";
> 	/append-property/ propa = <2>;
> };
> ```
> 
> Output:
> ```
> ❯ ../dtc -T -T -o temp.dts app2.dts
> ❯ cat temp.dts
> /dts-v1/;
> 
> / { /* base.dtsi:3:3-7:3, app1.dtsi:5:3-7:3, app2.dts:5:3-8:3 */
> 	prop = "0", "1", "2"; /* base.dtsi:4:2-4:13, app1.dtsi:6:2-6:31, app2.dts:6:2-6:31 */
> 	propa = <0x00>, <0x02>; /* base.dtsi:6:3-6:15, app2.dts:7:2-7:32 */
> }; /* base.dtsi:3:3-7:3, app1.dtsi:5:3-7:3, app2.dts:5:3-8:3 */
> ```
> 
> [3] https://lore.kernel.org/linux-arm-kernel/20240702164403.29067-1-afd@xxxxxx/
> [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
> 
> Reviewed-by: Simon Glass <sjg@xxxxxxxxxxxx>
> Signed-off-by: Ayush Singh <ayush@xxxxxxxxxxxxxxx>
> ---
>  dtc-lexer.l  |  7 +++++++
>  dtc-parser.y |  6 ++++++
>  dtc.h        |  5 +++++
>  livetree.c   | 36 +++++++++++++++++++++++++++++-------
>  4 files changed, 47 insertions(+), 7 deletions(-)

In general, I agree with these changes. Would be really good to have
append-property.

Reviewed-by: Dhruva Gole <d-gole@xxxxxx>

-- 
Best regards,
Dhruva Gole
Texas Instruments Incorporated




[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