Skip to content

Commit 305b795

Browse files
tamirdojeda
authored andcommitted
rust: firmware: 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. Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by: Alice Ryhl <aliceryhl@google.com> Reviewed-by: Benno Lossin <lossin@kernel.org> Acked-by: Danilo Krummrich <dakr@kernel.org> Signed-off-by: Tamir Duberstein <tamird@gmail.com> Link: https://patch.msgid.link/20251113-core-cstr-cstrings-v3-1-411b34002774@gmail.com Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
1 parent f56b131 commit 305b795

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

rust/kernel/firmware.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@ impl FwFunc {
5151
/// # Examples
5252
///
5353
/// ```no_run
54-
/// # use kernel::{c_str, device::Device, firmware::Firmware};
54+
/// # use kernel::{device::Device, firmware::Firmware};
5555
///
5656
/// # fn no_run() -> Result<(), Error> {
5757
/// # // SAFETY: *NOT* safe, just for the example to get an `ARef<Device>` instance
5858
/// # let dev = unsafe { Device::get_device(core::ptr::null_mut()) };
5959
///
60-
/// let fw = Firmware::request(c_str!("path/to/firmware.bin"), &dev)?;
60+
/// let fw = Firmware::request(c"path/to/firmware.bin", &dev)?;
6161
/// let blob = fw.data();
6262
///
6363
/// # Ok(())
@@ -204,7 +204,7 @@ macro_rules! module_firmware {
204204
($($builder:tt)*) => {
205205
const _: () = {
206206
const __MODULE_FIRMWARE_PREFIX: &'static $crate::str::CStr = if cfg!(MODULE) {
207-
$crate::c_str!("")
207+
c""
208208
} else {
209209
<LocalModule as $crate::ModuleMetadata>::NAME
210210
};

0 commit comments

Comments
 (0)