Skip to content

Add inherited interrupt-parent lookup#10

Merged
ZR233 merged 2 commits intomainfrom
fix/issue-8-interrupt-parent
Mar 9, 2026
Merged

Add inherited interrupt-parent lookup#10
ZR233 merged 2 commits intomainfrom
fix/issue-8-interrupt-parent

Conversation

@ZR233
Copy link
Member

@ZR233 ZR233 commented Mar 9, 2026

Summary

  • add inherited interrupt-parent lookup for fdt-edit node views and typed nodes
  • carry interrupt-parent through fdt-raw inherited node context
  • add regression tests for inherited lookup and local override behavior

Testing

  • cargo test -p fdt-raw
  • cargo test -p fdt-edit --test clock --test encode --test fdt --test pci --test range

Closes #8

Copilot AI review requested due to automatic review settings March 9, 2026 07:30
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-parent resolution in fdt-raw nodes via an inherited NodeContext field plus a new NodeBase::interrupt_parent() accessor.
  • Carry the effective interrupt-parent through fdt-raw iteration 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()),
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
.or(node.interrupt_parent()),
.or_else(|| node.interrupt_parent()),

Copilot uses AI. Check for mistakes.
@ZR233 ZR233 merged commit e59ff44 into main Mar 9, 2026
1 check passed
@ZR233 ZR233 deleted the fix/issue-8-interrupt-parent branch March 9, 2026 07:38
This was referenced Mar 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: get interrupt-parent

2 participants