Device Contexts: Bound, Core, and Normal
A device reference means different things at different moments: during probe the driver is bound to it and may map its registers; after removal the same object still exists but touching the hardware is no longer allowed. Rust encodes that difference in the type itself, so a bound-context device permits operations that an ordinary one does not, and a reference you stored away cannot be used to do the forbidden thing later. The C version of this rule is a sentence in the documentation and a use-after-unbind bug in the field. Reading these markers in a signature tells you exactly when a call is legal.
Questions this Concept answers
- Why is the bound context expressed in the type rather than as a sentence in the documentation?
This Concept is waiting for its first lesson!
A device reference means different things at different moments: during probe the driver is bound to it and may map its registers; after removal the same object still exists but touching the hardware is no longer allowed. Rust encodes that difference in the type itself, so a bound-context device permits operations that an ordinary one does not, and a reference you stored away cannot be used to do the forbidden thing later. The C version of this rule is a sentence in the documentation and a use-after-unbind bug in the field. Reading these markers in a signature tells you exactly when a call is legal.
Are you a teacher? Sign in to start contributing.
Sign In