rust: prelude: add `error::code::*` constant items
authorWedson Almeida Filho <wedsonaf@gmail.com>
Thu, 10 Nov 2022 16:41:23 +0000 (17:41 +0100)
committerMiguel Ojeda <ojeda@kernel.org>
Sun, 4 Dec 2022 00:59:15 +0000 (01:59 +0100)
commit25d176a4fad5841de1f85d2a4d69ce87416abc26
tree4f71d85a8a29dc51e08ac08b36b17d57db2df7e5
parent76e2c2d9a22a402e816607ae575b1a194cc45a31
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 <wedsonaf@gmail.com>
Reviewed-by: Gary Guo <gary@garyguo.net>
[Reworded, adapted for upstream and applied latest changes]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
rust/kernel/prelude.rs