]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
rust: io: replace `kernel::c_str!` with C-Strings
authorTamir Duberstein <tamird@gmail.com>
Mon, 22 Dec 2025 12:35:30 +0000 (13:35 +0100)
committerDanilo Krummrich <dakr@kernel.org>
Mon, 22 Dec 2025 16:30:31 +0000 (17:30 +0100)
C-String literals were added in Rust 1.77. Replace instances of
`kernel::c_str!` with C-String literals where possible.

Signed-off-by: Tamir Duberstein <tamird@gmail.com>
Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com>
Link: https://patch.msgid.link/20251222-cstr-driver-core-v1-4-1142a177d0fd@gmail.com
[ Use kernel vertical import style. - Danilo ]
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
rust/kernel/io/mem.rs

index b03b82cd531b2d68d462bbd2ca15b554a5de9ef9..e4878c131c6d897bdfd6020feaf5c26a96ad3a53 100644 (file)
@@ -5,7 +5,6 @@
 use core::ops::Deref;
 
 use crate::{
-    c_str,
     device::{
         Bound,
         Device, //
@@ -52,7 +51,12 @@ impl<'a> IoRequest<'a> {
     /// illustration purposes.
     ///
     /// ```no_run
-    /// use kernel::{bindings, c_str, platform, of, device::Core};
+    /// use kernel::{
+    ///     bindings,
+    ///     device::Core,
+    ///     of,
+    ///     platform,
+    /// };
     /// struct SampleDriver;
     ///
     /// impl platform::Driver for SampleDriver {
@@ -110,7 +114,12 @@ impl<'a> IoRequest<'a> {
     /// illustration purposes.
     ///
     /// ```no_run
-    /// use kernel::{bindings, c_str, platform, of, device::Core};
+    /// use kernel::{
+    ///     bindings,
+    ///     device::Core,
+    ///     of,
+    ///     platform,
+    /// };
     /// struct SampleDriver;
     ///
     /// impl platform::Driver for SampleDriver {
@@ -172,7 +181,7 @@ impl<const SIZE: usize> ExclusiveIoMem<SIZE> {
     fn ioremap(resource: &Resource) -> Result<Self> {
         let start = resource.start();
         let size = resource.size();
-        let name = resource.name().unwrap_or(c_str!(""));
+        let name = resource.name().unwrap_or_default();
 
         let region = resource
             .request_region(