[PATCH] rust: error.rs: Remove dead_code marker and make from_err_=

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Remove dead_code annotation from from_err_ptr, from_result and to_ptr funct=
ions in error.rs file and change visibility to public, making it accessible=
 outside the kernel crate(issue #1105).

Signed-off-by: Filipe Xavier <felipe_life@xxxxxxxx>
---
diff --git a/rust/kernel/error.rs b/rust/kernel/error.rs
index 6f1587a2524e..ecfa6aa41034 100644
--- a/rust/kernel/error.rs
+++ b/rust/kernel/error.rs
@@ -133,8 +133,7 @@ pub(crate) fn to_blk_status(self) -> bindings::blk_stat=
us_t {
     }

     /// Returns the error encoded as a pointer.
-    #[allow(dead_code)]
-    pub(crate) fn to_ptr<T>(self) -> *mut T {
+    pub fn to_ptr<T>(self) -> *mut T {
         #[cfg_attr(target_pointer_width =3D "32", allow(clippy::useless_co=
nversion))]
         // SAFETY: `self.0` is a valid error due to its invariant.
         unsafe {
@@ -268,9 +267,7 @@ pub fn to_result(err: core::ffi::c_int) -> Result {
 ///     from_err_ptr(unsafe { bindings::devm_platform_ioremap_resource(pde=
v.to_ptr(), index) })
 /// }
 /// ```
-// TODO: Remove `dead_code` marker once an in-kernel client is available.
-#[allow(dead_code)]
-pub(crate) fn from_err_ptr<T>(ptr: *mut T) -> Result<*mut T> {
+pub fn from_err_ptr<T>(ptr: *mut T) -> Result<*mut T> {
     // CAST: Casting a pointer to `*const core::ffi::c_void` is always val=
id.
     let const_ptr: *const core::ffi::c_void =3D ptr.cast();
     // SAFETY: The FFI function does not deref the pointer.
@@ -315,9 +312,7 @@ pub(crate) fn from_err_ptr<T>(ptr: *mut T) -> Result<*m=
ut T> {
 ///     })
 /// }
 /// ```
-// TODO: Remove `dead_code` marker once an in-kernel client is available.
-#[allow(dead_code)]
-pub(crate) fn from_result<T, F>(f: F) -> T
+pub fn from_result<T, F>(f: F) -> T
 where
     T: From<i16>,
     F: FnOnce() -> Result<T>,

--_000_DM4PR14MB72760296911674F92C7A6C01E99F2DM4PR14MB7276namp_
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<html>
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Diso-8859-=
1">
<style type=3D"text/css" style=3D"display:none;"> P {margin-top:0;margin-bo=
ttom:0;} </style>
</head>
<body dir=3D"ltr">
<div style=3D"background-color: rgb(31, 31, 31);">
<div style=3D"line-height: 19px; white-space: pre; font-family: &quot;Droid=
 Sans Mono&quot;, &quot;monospace&quot;, monospace; font-size: 14px; color:=
 rgb(204, 204, 204);">

[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux