All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/13] dtc: Merge the fragments of a dts file after parsing
@ 2026-11-01 16:36 Simon Glass
  2026-11-01 16:36 ` [PATCH 01/13] tests: Check each error when merging a dts file Simon Glass
                   ` (12 more replies)
  0 siblings, 13 replies; 44+ messages in thread
From: Simon Glass @ 2026-11-01 16:36 UTC (permalink / raw)
  To: Devicetree Compiler; +Cc: David Gibson, Simon Glass

The parser merges each top-level fragment of a dts file into the tree as
soon as it is parsed. This means that deletes cannot be dealt with
consistently, nor checks run on each fragment before it is merged. Here
a fragment is a top-level part of the source, such as / { ... }; or
&label { ... };, not an overlay's fragment@N node.

As a first step towards keeping the fragments apart until after parsing,
move the merge logic out of the grammar actions into livetree.c, one
action at a time, then have the parser return a list of fragments and
merge them from main(). The output is unchanged. The only changes to the
errors are the final message when a reference cannot be resolved, that a
syntax error later in the file now stops dtc before any earlier
reference errors are reported, and that reference errors now come after
any other errors from the parser.

Most of the merge errors have no tests, so the series starts by adding a
test for each one, checking the message and its position in the source.
Every line of the new merge code is then covered by the tests. At each
commit, make check passes and dtc gives the same output and messages as
before for all 4162 .dts and .dtso files in Linux
v7.3-12284-g3799eeb906c9

Following this, the plan is to apply deletes while merging, deciding
what a delete in a plugin should do, and then to run some checks on each
fragment.

Link: https://lore.kernel.org/devicetree-compiler/auK0ERvxGCJGSc3p@gractus.seuss/


Simon Glass (13):
  tests: Check each error when merging a dts file
  dtc: Add a list for the top-level fragments of a dts file
  dtc: Move the /delete-node/ handling out of the grammar
  dtc: Move the /omit-if-no-ref/ handling out of the grammar
  dtc: Move is_ref_relative() to livetree.c
  dtc: Move label-reference handling out of the grammar
  dtc: Move path-reference handling out of the grammar
  dtc: Move labelled-reference handling out of the grammar
  dtc: Move first-reference handling out of the grammar
  dtc: Add merge_fragment() to merge any fragment
  dtc: Add helpers for the errors when merging a fragment
  dtc: Merge the fragments of a dts file after parsing
  dtc: Merge the fragments of a dts file in main()

 dtc-parser.y                       | 130 ++++---------
 dtc.c                              |   2 +
 dtc.h                              |  48 +++++
 livetree.c                         | 302 ++++++++++++++++++++++++++++-
 tests/merge-delete-missing.dts     |   9 +
 tests/merge-errors.dts             |  14 ++
 tests/merge-first-ref-relative.dts |  10 +
 tests/merge-first-ref.dts          |   9 +
 tests/merge-labelled-plugin.dts    |  12 ++
 tests/merge-labelled-relative.dts  |  14 ++
 tests/merge-omit-missing.dts       |   9 +
 tests/merge-parse-error.dts        |  17 ++
 tests/merge-path-ref-missing.dts   |  11 ++
 tests/merge-path-relative.dts      |  12 ++
 tests/run_tests.sh                 |  44 ++++-
 treesource.c                       |   5 +-
 16 files changed, 551 insertions(+), 97 deletions(-)
 create mode 100644 tests/merge-delete-missing.dts
 create mode 100644 tests/merge-errors.dts
 create mode 100644 tests/merge-first-ref-relative.dts
 create mode 100644 tests/merge-first-ref.dts
 create mode 100644 tests/merge-labelled-plugin.dts
 create mode 100644 tests/merge-labelled-relative.dts
 create mode 100644 tests/merge-omit-missing.dts
 create mode 100644 tests/merge-parse-error.dts
 create mode 100644 tests/merge-path-ref-missing.dts
 create mode 100644 tests/merge-path-relative.dts

---
base-commit: c22868416b8db8354ce5db29d3494dda688a2ae3
branch: dt-forest

-- 
2.43.0


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

end of thread, other threads:[~2026-11-04 15:18 UTC | newest]

Thread overview: 44+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-01 16:36 [PATCH 00/13] dtc: Merge the fragments of a dts file after parsing Simon Glass
2026-11-01 16:36 ` [PATCH 01/13] tests: Check each error when merging a dts file Simon Glass
2026-11-02  6:32   ` David Gibson
2026-11-04 15:15     ` Simon Glass
2026-11-01 16:36 ` [PATCH 02/13] dtc: Add a list for the top-level fragments of " Simon Glass
2026-11-02  9:49   ` David Gibson
2026-11-03 17:56     ` Herve Codina
2026-11-04  6:32       ` David Gibson
2026-11-04  8:29         ` Herve Codina
2026-11-04  9:34           ` David Gibson
2026-11-04 15:18     ` Simon Glass
2026-11-03 17:07   ` Herve Codina
2026-11-04  6:28     ` David Gibson
2026-11-01 16:36 ` [PATCH 03/13] dtc: Move the /delete-node/ handling out of the grammar Simon Glass
2026-11-02  9:55   ` David Gibson
2026-11-04 15:15     ` Simon Glass
2026-11-01 16:36 ` [PATCH 04/13] dtc: Move the /omit-if-no-ref/ " Simon Glass
2026-11-02 10:03   ` David Gibson
2026-11-01 16:36 ` [PATCH 05/13] dtc: Move is_ref_relative() to livetree.c Simon Glass
2026-11-02 10:04   ` David Gibson
2026-11-01 16:37 ` [PATCH 06/13] dtc: Move label-reference handling out of the grammar Simon Glass
2026-11-03  7:25   ` David Gibson
2026-11-01 16:37 ` [PATCH 07/13] dtc: Move path-reference " Simon Glass
2026-11-03  7:27   ` David Gibson
2026-11-04 15:16     ` Simon Glass
2026-11-01 16:37 ` [PATCH 08/13] dtc: Move labelled-reference " Simon Glass
2026-11-03  7:29   ` David Gibson
2026-11-04 15:16     ` Simon Glass
2026-11-01 16:37 ` [PATCH 09/13] dtc: Move first-reference " Simon Glass
2026-11-01 16:37 ` [PATCH 10/13] dtc: Add merge_fragment() to merge any fragment Simon Glass
2026-11-01 16:37 ` [PATCH 11/13] dtc: Add helpers for the errors when merging a fragment Simon Glass
2026-11-03 17:23   ` Herve Codina
2026-11-04  6:49     ` David Gibson
2026-11-04  8:55       ` Herve Codina
2026-11-01 16:37 ` [PATCH 12/13] dtc: Merge the fragments of a dts file after parsing Simon Glass
2026-11-03 17:07   ` Herve Codina
2026-11-04  6:50     ` David Gibson
2026-11-04 15:18       ` Simon Glass
2026-11-01 16:37 ` [PATCH 13/13] dtc: Merge the fragments of a dts file in main() Simon Glass
2026-11-03 17:08   ` Herve Codina
2026-11-04  6:51     ` David Gibson
2026-11-04  8:40       ` Herve Codina
2026-11-04  9:47         ` David Gibson
2026-11-04 13:23           ` Herve Codina

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.