You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
rust/kernel/platdev: get rid of unnecessary Pinning
`Registration` contains a self-referential structure.
We need to ensure that users never move that structure around.
This is currently done by marking `Registration` as `!Unpin`,
and returning it as a `Pin<Box<Registration>>`, which users cannot
move out of - not without the use of `unsafe`, anyway.
However, the self-referenial structure is an implementation detail,
which we are pushing onto users, by using `Pin` in the public function
signature.
Treat the self-referential structure as a true, internal implementation
detail: store it into a private `Box` member of `Registration`. This is
safe as long as `Registration` never moves that structure out of its
`Box`.
Now `Registration` can safely be moved by its users, and there is no
longer a need to mark `Registration` as `!Unpin`, or return it
`Pin`ned to users. This greatly simplifies and clarifies driver-side
code.
Signed-off-by: Sven Van Asbroeck <[email protected]>
0 commit comments