rust: error: Rename to_kernel_errno() -> to_errno()
authorAsahi Lina <lina@asahilina.net>
Mon, 3 Apr 2023 09:48:10 +0000 (18:48 +0900)
committerMiguel Ojeda <ojeda@kernel.org>
Wed, 12 Apr 2023 16:41:04 +0000 (18:41 +0200)
This is kernel code, so specifying "kernel" is redundant. Let's simplify
things and just call it to_errno().

Reviewed-by: Gary Guo <gary@garyguo.net>
Reviewed-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com>
Signed-off-by: Asahi Lina <lina@asahilina.net>
Link: https://lore.kernel.org/r/20230224-rust-error-v3-1-03779bddc02b@asahilina.net
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
rust/kernel/error.rs
rust/macros/module.rs

index 5b9751d7ff1d9d8f9cc9cc77fdf54b258042964b..35894fa35efe7d423f55278be245dbd8f5c314b4 100644 (file)
@@ -73,7 +73,7 @@ pub struct Error(core::ffi::c_int);
 
 impl Error {
     /// Returns the kernel error code.
-    pub fn to_kernel_errno(self) -> core::ffi::c_int {
+    pub fn to_errno(self) -> core::ffi::c_int {
         self.0
     }
 }
index 5e7ab83908a0dfa83aaeb84d50cb5a1eb007f2af..fb1244f8c2e6948269779ba6636195e2ad8aba26 100644 (file)
@@ -278,7 +278,7 @@ pub(crate) fn module(ts: TokenStream) -> TokenStream {
                         return 0;
                     }}
                     Err(e) => {{
-                        return e.to_kernel_errno();
+                        return e.to_errno();
                     }}
                 }}
             }}