Skip to content

Remove the GpioToken entirely #111

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 29, 2025
Merged

Remove the GpioToken entirely #111

merged 2 commits into from
Jun 29, 2025

Conversation

d3zd3z
Copy link
Collaborator

@d3zd3z d3zd3z commented Jun 27, 2025

Simplify the GPIO driver, by removing the token. This relies on the underlying gpio driver being thread safe. Keep the get_instance as unsafe, as this can't be determined statically.

Rust 1.88 introduces `unnecessary_transmute` warninigs that are
triggered by the bindgen code.  Suppress these.

Signed-off-by: David Brown <[email protected]>
The gpio driver's 'token' to ensure uniqueness doesn't really help with
correctness (as C code can use the gpio device as well).  Short of
re-defining the gpio interfaces, remove this token entirely, and make
only the `get_instance` of gpio unsafe, to indicate that the safety of
GPIO operations is dependent on the underlying controller.

This should improve the hygeine of the GPIO API significantly, and allow
uses, such as waiting on multiple pins, to be possible.

Signed-off-by: David Brown <[email protected]>
@cfriedt cfriedt merged commit 7e5f345 into main Jun 29, 2025
4 checks passed
@d3zd3z d3zd3z mentioned this pull request Jul 1, 2025
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.

3 participants