Skip to content

rust: gpio: add support for registering irq chips with gpio chip. #565

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 1 commit into from
Nov 27, 2021

Conversation

wedsonaf
Copy link

This is used by the PL061 driver.

Signed-off-by: Wedson Almeida Filho [email protected]

Copy link
Member

@ojeda ojeda left a comment

Choose a reason for hiding this comment

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

A couple nits...


// SAFETY: Registration with and unregistration from the gpio subsystem (including irq chips for
// them) can happen from any thread. Additionally, `T::Data` (which is dropped during
// unregistration) is `Send`, so it is ok to move `Registration` to different threads.
Copy link
Member

Choose a reason for hiding this comment

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

(Off-topic: I wonder if it would be useful in cases like this to assert safety conditions like T::Data is Send nearby where we rely on them too, specially in cases where it may be too far away etc.)

Copy link
Author

Choose a reason for hiding this comment

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

I like the idea of having the machine check some of our stated assumptions. I added a bound for this particular, though it is just repeating one that already exists.

It will help catch problems if in the future someone inadvertently removes the bounds from T::Data. On the other hand, we were asking the Rust folks to help us avoid repeating such bounds :)

Copy link
Member

Choose a reason for hiding this comment

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

It will help catch problems if in the future someone inadvertently removes the bounds from T::Data

Exactly -- I was thinking about the "SAFETY 'proofs' in both ends" discussion and while for "comments" it would likely be too annoying, for something that can be machine checked (& that can be asserted on this side), it seems worth to do.

This is used by the PL061 driver.

Signed-off-by: Wedson Almeida Filho <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants