forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 430
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
Change pub(crate)
methods in kernel::error
to be pub
#1105
Labels
Comments
intel-lab-lkp
pushed a commit
to intel-lab-lkp/linux
that referenced
this issue
Sep 9, 2024
Change visibility to public of functions in error.rs: from_err_ptr, from_result and to_ptr. Additionally, remove dead_code annotations. Link: Rust-for-Linux#1105 Signed-off-by: Filipe Xavier <felipe_life@live.com>
intel-lab-lkp
pushed a commit
to intel-lab-lkp/linux
that referenced
this issue
Sep 13, 2024
Change visibility to public of functions in error.rs: from_err_ptr, from_errno, from_result and to_ptr. Additionally, remove dead_code annotations. Link: Rust-for-Linux#1105 Reviewed-by: Alice Ryhl <aliceryhl@google.com> Signed-off-by: Filipe Xavier <felipe_life@live.com>
ojeda
pushed a commit
to ojeda/linux
that referenced
this issue
Oct 3, 2024
Change visibility to public of functions in error.rs: from_err_ptr, from_errno, from_result and to_ptr. Additionally, remove dead_code annotations. Link: Rust-for-Linux#1105 Reviewed-by: Alice Ryhl <aliceryhl@google.com> Signed-off-by: Filipe Xavier <felipe_life@live.com> Reviewed-by: Benno Lossin <benno.lossin@proton.me> Reviewed-by: Gary Guo <gary@garyguo.net> Link: https://lore.kernel.org/r/DM4PR14MB7276E6948E67B3B23D8EA847E9652@DM4PR14MB7276.namprd14.prod.outlook.com Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
ojeda
pushed a commit
to ojeda/linux
that referenced
this issue
Oct 3, 2024
Change visibility to public of functions in error.rs: from_err_ptr, from_errno, from_result and to_ptr. Additionally, remove dead_code annotations. Link: Rust-for-Linux#1105 Reviewed-by: Alice Ryhl <aliceryhl@google.com> Signed-off-by: Filipe Xavier <felipe_life@live.com> Reviewed-by: Benno Lossin <benno.lossin@proton.me> Reviewed-by: Gary Guo <gary@garyguo.net> Link: https://lore.kernel.org/r/DM4PR14MB7276E6948E67B3B23D8EA847E9652@DM4PR14MB7276.namprd14.prod.outlook.com Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Applied to |
ojeda
pushed a commit
that referenced
this issue
Oct 7, 2024
Change visibility to public of functions in error.rs: from_err_ptr, from_errno, from_result and to_ptr. Additionally, remove dead_code annotations. Link: #1105 Reviewed-by: Alice Ryhl <aliceryhl@google.com> Signed-off-by: Filipe Xavier <felipe_life@live.com> Reviewed-by: Benno Lossin <benno.lossin@proton.me> Reviewed-by: Gary Guo <gary@garyguo.net> Link: https://lore.kernel.org/r/DM4PR14MB7276E6948E67B3B23D8EA847E9652@DM4PR14MB7276.namprd14.prod.outlook.com Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
ojeda
pushed a commit
that referenced
this issue
Oct 7, 2024
Change visibility to public of functions in error.rs: from_err_ptr, from_errno, from_result and to_ptr. Additionally, remove dead_code annotations. Link: #1105 Reviewed-by: Alice Ryhl <aliceryhl@google.com> Signed-off-by: Filipe Xavier <felipe_life@live.com> Reviewed-by: Benno Lossin <benno.lossin@proton.me> Reviewed-by: Gary Guo <gary@garyguo.net> Link: https://lore.kernel.org/r/DM4PR14MB7276E6948E67B3B23D8EA847E9652@DM4PR14MB7276.namprd14.prod.outlook.com Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
alistair23
pushed a commit
to alistair23/linux
that referenced
this issue
Nov 11, 2024
Change visibility to public of functions in error.rs: from_err_ptr, from_errno, from_result and to_ptr. Additionally, remove dead_code annotations. Link: Rust-for-Linux#1105 Reviewed-by: Alice Ryhl <aliceryhl@google.com> Signed-off-by: Filipe Xavier <felipe_life@live.com> Reviewed-by: Benno Lossin <benno.lossin@proton.me> Reviewed-by: Gary Guo <gary@garyguo.net> Link: https://lore.kernel.org/r/DM4PR14MB7276E6948E67B3B23D8EA847E9652@DM4PR14MB7276.namprd14.prod.outlook.com Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
alistair23
pushed a commit
to alistair23/linux
that referenced
this issue
Nov 12, 2024
Change visibility to public of functions in error.rs: from_err_ptr, from_errno, from_result and to_ptr. Additionally, remove dead_code annotations. Link: Rust-for-Linux#1105 Reviewed-by: Alice Ryhl <aliceryhl@google.com> Signed-off-by: Filipe Xavier <felipe_life@live.com> Reviewed-by: Benno Lossin <benno.lossin@proton.me> Reviewed-by: Gary Guo <gary@garyguo.net> Link: https://lore.kernel.org/r/DM4PR14MB7276E6948E67B3B23D8EA847E9652@DM4PR14MB7276.namprd14.prod.outlook.com Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Change the following methods from
pub(crate)
topub
:from_result
from_err_ptr
to_ptr
These methods will most likely be used from outside of the kernel crate, so using the
pub
marker is the correct way to mark them. Furthermore, using thepub
marker instead ofpub(crate)
has the advantage that it doesn't produce dead-code warnings, avoiding the need for #[allow] and TODO annotations:linux/rust/kernel/error.rs
Lines 271 to 273 in e26fa54
One could argue that these methods shouldn't be used outside of the kernel crate because that means that someone is writing an abstraction directly in their driver. However, there are reasons to do that in some cases, so we cannot apply that rule so strictly that we can make these methods
pub(crate)
. (And if we did apply that rule that strictly, thento_result
should be changed to bepub(crate)
.)We could make this change later when the methods gain a user outside of rust/kernel directory. However, I propose changing it now because:
error.rs
simplifies it, making the code easier to read.I don't know whether all three methods will gain a user outside of the rust/kernel directory, but I expect that
from_err_ptr
will. However, I don't think there's any harm in changing all of them for consistency. After all, apub
marker is not incorrect for something only used in rust/kernel if we don't need to prevent users outside of rust/kernel from using it.The text was updated successfully, but these errors were encountered: