Conversation
There was a problem hiding this comment.
Pull request overview
Adds support for inheriting the interrupt-parent property up the device tree hierarchy, aligning behavior with the DT spec and exposing the effective value through both fdt-raw node iteration context and fdt-edit node views/typed nodes.
Changes:
- Implement inherited
interrupt-parentresolution infdt-rawnodes via an inheritedNodeContextfield plus a newNodeBase::interrupt_parent()accessor. - Carry the effective
interrupt-parentthroughfdt-rawiteration so descendants can resolve it without re-walking ancestors. - Add regression tests in both crates to validate inheritance and local override behavior.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| fdt-raw/tests/node.rs | Adds regression test ensuring /chosen inherits interrupt-parent from /. |
| fdt-raw/src/node/mod.rs | Extends inherited node context with interrupt_parent and adds effective lookup API. |
| fdt-raw/src/iter.rs | Propagates effective interrupt-parent through the iterator’s context stack. |
| fdt-edit/tests/fdt.rs | Adds inheritance + override test for NodeView/typed node accessors. |
| fdt-edit/src/node/view/mod.rs | Implements NodeView::interrupt_parent() (ancestor walk) and exposes via NodeType. |
| fdt-edit/src/node/view/generic.rs | Exposes interrupt_parent() on the generic node view wrapper. |
| fdt-edit/src/node/mod.rs | Clarifies Node::interrupt_parent() returns only the local property value. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| size_cells: node.size_cells, | ||
| interrupt_parent: props | ||
| .interrupt_parent | ||
| .or(node.interrupt_parent()), |
There was a problem hiding this comment.
In child_context, props.interrupt_parent.or(node.interrupt_parent()) evaluates node.interrupt_parent() eagerly, which re-scans the node’s properties even when props.interrupt_parent is already Some. This can add significant overhead while iterating large trees. Use a lazy alternative (e.g. or_else(|| node.interrupt_parent())) or compute from the already-available inherited context (e.g. props.interrupt_parent.or(self.current_context().interrupt_parent)) to avoid the extra scan.
| .or(node.interrupt_parent()), | |
| .or_else(|| node.interrupt_parent()), |
Summary
Testing
Closes #8