Devicetree Compiler
 help / color / mirror / Atom feed
* [PATCH v2 0/6] dtc: Fix deletes within a section and before a redefinition
@ 2026-10-28  9:36 Simon Glass
  2026-10-28  9:36 ` [PATCH v2 1/6] dtc: Apply deletes in the section which has them Simon Glass
                   ` (6 more replies)
  0 siblings, 7 replies; 12+ messages in thread
From: Simon Glass @ 2026-10-28  9:36 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. The third clarifies some comments. The fourth lets dtc-fatal.sh
check the error message, which the fifth uses to test an error for a
delete in an overlay fragment which has nothing to delete there, since
an overlay cannot delete from the base tree. The sixth documents how
deletes behave.

Note that the second and fifth patches change existing behaviour. The
second changes the output of existing dts files which delete and then
redefine a node or property. The fifth breaks the build of two overlays
in Linux, whose deletes have never taken effect. Each patch explains
why this seems the better behaviour.

Changes in v2:
- Add new patch to clarify the comments
- Add new patch to check the error message in dtc-fatal.sh
- Add new patch to report an error for a delete in an overlay fragment
- Add new patch to document deletes

Simon Glass (6):
  dtc: Apply deletes in the section which has them
  dtc: Remove a deleted node or property from the tree
  dtc: Clarify when delete placeholders are dropped
  tests: Allow dtc-fatal.sh to check the error message
  dtc: Report an error for a delete in an overlay fragment
  doc: dts-format: Describe later definitions and deletes

 Documentation/dts-format.txt                  |  44 +++++
 dtc-parser.y                                  |  28 ++-
 dtc.h                                         |   4 +
 livetree.c                                    | 159 ++++++++++++++++--
 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           |  22 +++
 tests/delete_in_section_overlay_ref.dts       |   9 +
 tests/delete_in_section_overlay_unused.dts    |   8 +
 ...delete_in_section_overlay_unused_label.dts |  14 ++
 .../delete_in_section_overlay_unused_path.dts |  13 ++
 tests/delete_in_section_ref.dts               |  44 +++++
 tests/delete_readd_order.dts                  |  57 +++++++
 tests/delete_readd_order_ref.dts              |  28 +++
 tests/dtc-fatal.sh                            |  18 +-
 tests/run_tests.sh                            |  39 ++++-
 18 files changed, 642 insertions(+), 18 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_overlay_unused.dts
 create mode 100644 tests/delete_in_section_overlay_unused_label.dts
 create mode 100644 tests/delete_in_section_overlay_unused_path.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: 1d50f3f8fa8bf9429eebb0769dafa5df37381ae1
branch: delete-markers2

-- 
2.43.0


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

end of thread, other threads:[~2026-10-29  2:52 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-28  9:36 [PATCH v2 0/6] dtc: Fix deletes within a section and before a redefinition Simon Glass
2026-10-28  9:36 ` [PATCH v2 1/6] dtc: Apply deletes in the section which has them Simon Glass
2026-10-28  9:36 ` [PATCH v2 2/6] dtc: Remove a deleted node or property from the tree Simon Glass
2026-10-28  9:36 ` [PATCH v2 3/6] dtc: Clarify when delete placeholders are dropped Simon Glass
2026-10-28 17:56   ` Herve Codina
2026-10-28  9:36 ` [PATCH v2 4/6] tests: Allow dtc-fatal.sh to check the error message Simon Glass
2026-10-28 18:02   ` Herve Codina
2026-10-28  9:36 ` [PATCH v2 5/6] dtc: Report an error for a delete in an overlay fragment Simon Glass
2026-10-28 18:17   ` Herve Codina
2026-10-28  9:36 ` [PATCH v2 6/6] doc: dts-format: Describe later definitions and deletes Simon Glass
2026-10-28 18:25   ` Herve Codina
2026-10-29  2:49 ` [PATCH v2 0/6] dtc: Fix deletes within a section and before a redefinition David Gibson

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