Skip to content
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

apis: update breaking driver existence check changes #517

Merged
merged 1 commit into from
Nov 13, 2023

Conversation

Samir-Rashid
Copy link
Contributor

@Samir-Rashid Samir-Rashid commented Oct 3, 2023

Bring libtock-rs into consistency with the changes in this PR.

Only apis/gpio/src/lib.rs needed to be changed. The rest is a grepped driver_check -> exists.

@jrvanwhy jrvanwhy added the upkeep Indicates a PR is upkeep as defined by the code review policy. label Oct 3, 2023
ppannuto
ppannuto previously approved these changes Oct 6, 2023
Copy link
Member

@ppannuto ppannuto left a comment

Choose a reason for hiding this comment

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

This is part of a trio of PRs across the kernel, libtock-c, and here. While it's a bit of churn, I think there's value in the consistency of the term "exists" across the tock ecosystem with these changes.


Blocked on pending kernel PR.

Comment on lines 61 to 63
/// Returns true` if the driver was present. This does not necessarily mean
/// that the driver is working, as it may still fail to allocate grant
/// memory.
Copy link
Member

Choose a reason for hiding this comment

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

It might be a good idea to keep the latter half of this comment.

For another day—it's an interesting point more generally. What is the point of an "exists" check? I might think it's to make sure the driver will be available when you want to call it. Following that, there's a case that "exists" syscalls should do grant allocations, but that's a more fundamental design change.

@ppannuto ppannuto added the blocked Blocked on promised changes or other PRs label Oct 6, 2023
@Samir-Rashid
Copy link
Contributor Author

Added ppannuto's suggested change and resquashed.

diff

diff --git a/apis/gpio/src/lib.rs b/apis/gpio/src/lib.rs
index 8328358..bc2d500 100644
--- a/apis/gpio/src/lib.rs
+++ b/apis/gpio/src/lib.rs
@@ -57,7 +57,8 @@ pub struct Gpio<S: Syscalls>(S);
 
 impl<S: Syscalls> Gpio<S> {
     /// Returns Ok() if the driver was present.This does not necessarily mean
-    /// that the driver is working.
+    /// that the driver is working, as it may still fail to allocate grant
+    /// memory.
     pub fn exists() -> Result<(), ErrorCode> {
         S::command(DRIVER_NUM, EXISTS, 0, 0).to_result()
     }

@ppannuto ppannuto removed the blocked Blocked on promised changes or other PRs label Oct 10, 2023
ppannuto
ppannuto previously approved these changes Oct 10, 2023
@ppannuto
Copy link
Member

It looks like some of those CI errors are real — unit tests that need to be updated to match the new expectations.

@Samir-Rashid Samir-Rashid marked this pull request as draft October 25, 2023 18:46
@Samir-Rashid Samir-Rashid marked this pull request as ready for review October 28, 2023 08:18
@Samir-Rashid Samir-Rashid requested a review from ppannuto October 28, 2023 08:19
@Samir-Rashid Samir-Rashid marked this pull request as draft October 30, 2023 17:06
@Samir-Rashid Samir-Rashid marked this pull request as ready for review October 30, 2023 20:08
This PR accompanies tock#3613.
@Samir-Rashid
Copy link
Contributor Author

I rebased to master. The tests are passing, so I think this PR should be merged.

@jrvanwhy jrvanwhy added this pull request to the merge queue Nov 13, 2023
Merged via the queue into tock:master with commit a2c6ad8 Nov 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
upkeep Indicates a PR is upkeep as defined by the code review policy.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants