Devicetree Compiler
 help / color / mirror / Atom feed
* [PATCH 0/2] dtc: Fix deletes within a section and before a redefinition
@ 2026-10-26 17:35 Simon Glass
  2026-10-26 17:35 ` [PATCH 1/2] dtc: Apply deletes in the section which has them Simon Glass
  2026-10-26 17:35 ` [PATCH 2/2] dtc: Remove a deleted node or property from the tree Simon Glass
  0 siblings, 2 replies; 6+ messages in thread
From: Simon Glass @ 2026-10-26 17:35 UTC (permalink / raw)
  To: Devicetree Compiler; +Cc: David Gibson, Simon Glass

A /delete-property/ or /delete-node/ in the first section of a dts, or
in a node which a later section adds, is ignored and leaves its
placeholder in the tree, where it can show up as a bogus duplicate. A
node which is deleted and then defined again also returns to its old
place, with its old subnodes in their old order.

The first patch applies each delete within its own section and keeps
the placeholders out of the tree. The second removes deleted entries
from the tree, so that a node defined again comes after the existing
ones.

Note that the second patch changes the output of existing dts files
which delete and then redefine a node or property. That patch explains
why this seems the better behaviour.


Simon Glass (2):
  dtc: Apply deletes in the section which has them
  dtc: Remove a deleted node or property from the tree

 dtc-parser.y                            |   1 +
 dtc.h                                   |   1 +
 livetree.c                              | 112 ++++++++++++++++++---
 tests/delete_in_section.dts             | 125 ++++++++++++++++++++++++
 tests/delete_in_section_badref.dts      |  11 +++
 tests/delete_in_section_labels.dts      |  28 ++++++
 tests/delete_in_section_labels_ref.dts  |   9 ++
 tests/delete_in_section_overlay.dts     |  21 ++++
 tests/delete_in_section_overlay_ref.dts |   9 ++
 tests/delete_in_section_ref.dts         |  44 +++++++++
 tests/delete_readd_order.dts            |  57 +++++++++++
 tests/delete_readd_order_ref.dts        |  28 ++++++
 tests/run_tests.sh                      |  27 +++++
 13 files changed, 461 insertions(+), 12 deletions(-)
 create mode 100644 tests/delete_in_section.dts
 create mode 100644 tests/delete_in_section_badref.dts
 create mode 100644 tests/delete_in_section_labels.dts
 create mode 100644 tests/delete_in_section_labels_ref.dts
 create mode 100644 tests/delete_in_section_overlay.dts
 create mode 100644 tests/delete_in_section_overlay_ref.dts
 create mode 100644 tests/delete_in_section_ref.dts
 create mode 100644 tests/delete_readd_order.dts
 create mode 100644 tests/delete_readd_order_ref.dts

---
base-commit: f99e3af0ecb67a9085478a9b8ddbcc25aa64931d
branch: delete-markers2

-- 
2.43.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-10-28  3:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-26 17:35 [PATCH 0/2] dtc: Fix deletes within a section and before a redefinition Simon Glass
2026-10-26 17:35 ` [PATCH 1/2] dtc: Apply deletes in the section which has them Simon Glass
2026-10-27  7:41   ` Herve Codina
2026-10-28  3:47   ` David Gibson
2026-10-26 17:35 ` [PATCH 2/2] dtc: Remove a deleted node or property from the tree Simon Glass
2026-10-27  7:45   ` Herve Codina

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox