Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

rust: io: replace `kernel::c_str!` with C-Strings

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>

authored by

Tamir Duberstein and committed by
Danilo Krummrich
0250ea32 1114c87e

+13 -4
+13 -4
rust/kernel/io/mem.rs
··· 5 5 use core::ops::Deref; 6 6 7 7 use crate::{ 8 - c_str, 9 8 device::{ 10 9 Bound, 11 10 Device, // ··· 51 52 /// illustration purposes. 52 53 /// 53 54 /// ```no_run 54 - /// use kernel::{bindings, c_str, platform, of, device::Core}; 55 + /// use kernel::{ 56 + /// bindings, 57 + /// device::Core, 58 + /// of, 59 + /// platform, 60 + /// }; 55 61 /// struct SampleDriver; 56 62 /// 57 63 /// impl platform::Driver for SampleDriver { ··· 114 110 /// illustration purposes. 115 111 /// 116 112 /// ```no_run 117 - /// use kernel::{bindings, c_str, platform, of, device::Core}; 113 + /// use kernel::{ 114 + /// bindings, 115 + /// device::Core, 116 + /// of, 117 + /// platform, 118 + /// }; 118 119 /// struct SampleDriver; 119 120 /// 120 121 /// impl platform::Driver for SampleDriver { ··· 181 172 fn ioremap(resource: &Resource) -> Result<Self> { 182 173 let start = resource.start(); 183 174 let size = resource.size(); 184 - let name = resource.name().unwrap_or(c_str!("")); 175 + let name = resource.name().unwrap_or_default(); 185 176 186 177 let region = resource 187 178 .request_region(