From: Wedson Almeida Filho Date: Thu, 10 Nov 2022 16:41:23 +0000 (+0100) Subject: rust: prelude: add `error::code::*` constant items X-Git-Tag: io_uring-6.2-2022-12-19~78^2~17 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=25d176a4fad5841de1f85d2a4d69ce87416abc26;p=linux-2.6-block.git rust: prelude: add `error::code::*` constant items It is convenient to have all the `Error` constant items (such as `EINVAL`) available as-is everywhere (i.e. for code using the kernel prelude such as kernel modules). Therefore, add all of them to the prelude. For instance, this allows to write `Err(EINVAL)` to create a kernel `Result`: fn f() -> Result<...> { ... Err(EINVAL) } Signed-off-by: Wedson Almeida Filho Reviewed-by: Gary Guo [Reworded, adapted for upstream and applied latest changes] Signed-off-by: Miguel Ojeda --- diff --git a/rust/kernel/prelude.rs b/rust/kernel/prelude.rs index 7c4c35bf3c66..1e08b08e9420 100644 --- a/rust/kernel/prelude.rs +++ b/rust/kernel/prelude.rs @@ -19,6 +19,6 @@ pub use macros::{module, vtable}; pub use super::{pr_alert, pr_crit, pr_debug, pr_emerg, pr_err, pr_info, pr_notice, pr_warn}; -pub use super::error::{Error, Result}; +pub use super::error::{code::*, Error, Result}; pub use super::ThisModule;