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 Signed-off-by: Tamir Duberstein tamird@gmail.com --- drivers/block/rnull.rs | 2 +- rust/kernel/sync.rs | 5 ++--- rust/kernel/sync/completion.rs | 2 +- rust/kernel/workqueue.rs | 8 ++++---- 4 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/drivers/block/rnull.rs b/drivers/block/rnull.rs index 6366da12c5a5..9aa79b862b63 100644 --- a/drivers/block/rnull.rs +++ b/drivers/block/rnull.rs @@ -55,7 +55,7 @@ fn init(_module: &'static ThisModule) -> impl PinInit<Self, Error> { })();
try_pin_init!(Self { - _disk <- new_mutex!(disk?, "nullb:disk"), + _disk <- new_mutex!(disk?, c"nullb:disk"), }) } } diff --git a/rust/kernel/sync.rs b/rust/kernel/sync.rs index 63c99e015ad6..9a6d2753937d 100644 --- a/rust/kernel/sync.rs +++ b/rust/kernel/sync.rs @@ -43,7 +43,6 @@ impl LockClassKey { /// /// # Examples /// ``` - /// # use kernel::c_str; /// # use kernel::alloc::KBox; /// # use kernel::types::ForeignOwnable; /// # use kernel::sync::{LockClassKey, SpinLock}; @@ -55,7 +54,7 @@ impl LockClassKey { /// { /// stack_pin_init!(let num: SpinLock<u32> = SpinLock::new( /// 0, - /// c_str!("my_spinlock"), + /// c"my_spinlock", /// // SAFETY: `key_ptr` is returned by the above `into_foreign()`, whose /// // `from_foreign()` has not yet been called. /// unsafe { <Pin<KBox<LockClassKey>> as ForeignOwnable>::borrow(key_ptr) } @@ -111,6 +110,6 @@ macro_rules! optional_name { $crate::c_str!(::core::concat!(::core::file!(), ":", ::core::line!())) }; ($name:literal) => { - $crate::c_str!($name) + $name }; } diff --git a/rust/kernel/sync/completion.rs b/rust/kernel/sync/completion.rs index c50012a940a3..97d39c248793 100644 --- a/rust/kernel/sync/completion.rs +++ b/rust/kernel/sync/completion.rs @@ -34,7 +34,7 @@ /// impl MyTask { /// fn new() -> Result<Arc<Self>> { /// let this = Arc::pin_init(pin_init!(MyTask { -/// work <- new_work!("MyTask::work"), +/// work <- new_work!(c"MyTask::work"), /// done <- Completion::new(), /// }), GFP_KERNEL)?; /// diff --git a/rust/kernel/workqueue.rs b/rust/kernel/workqueue.rs index cce23684af24..432624c69c72 100644 --- a/rust/kernel/workqueue.rs +++ b/rust/kernel/workqueue.rs @@ -51,7 +51,7 @@ //! fn new(value: i32) -> Result<Arc<Self>> { //! Arc::pin_init(pin_init!(MyStruct { //! value, -//! work <- new_work!("MyStruct::work"), +//! work <- new_work!(c"MyStruct::work"), //! }), GFP_KERNEL) //! } //! } @@ -98,8 +98,8 @@ //! Arc::pin_init(pin_init!(MyStruct { //! value_1, //! value_2, -//! work_1 <- new_work!("MyStruct::work_1"), -//! work_2 <- new_work!("MyStruct::work_2"), +//! work_1 <- new_work!(c"MyStruct::work_1"), +//! work_2 <- new_work!(c"MyStruct::work_2"), //! }), GFP_KERNEL) //! } //! } @@ -215,7 +215,7 @@ pub fn try_spawn<T: 'static + Send + FnOnce()>( func: T, ) -> Result<(), AllocError> { let init = pin_init!(ClosureWork { - work <- new_work!("Queue::try_spawn"), + work <- new_work!(c"Queue::try_spawn"), func: Some(func), });