From: Tamir Duberstein <tamird@gmail.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>,
"Viresh Kumar" <viresh.kumar@linaro.org>,
"Miguel Ojeda" <ojeda@kernel.org>,
"Alex Gaynor" <alex.gaynor@gmail.com>,
"Boqun Feng" <boqun.feng@gmail.com>,
"Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <lossin@kernel.org>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Alice Ryhl" <aliceryhl@google.com>,
"Trevor Gross" <tmgross@umich.edu>,
"Danilo Krummrich" <dakr@kernel.org>,
"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
"Maxime Ripard" <mripard@kernel.org>,
"Thomas Zimmermann" <tzimmermann@suse.de>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
"FUJITA Tomonori" <fujita.tomonori@gmail.com>,
"Andrew Lunn" <andrew@lunn.ch>,
"Heiner Kallweit" <hkallweit1@gmail.com>,
"Russell King" <linux@armlinux.org.uk>,
"David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@google.com>,
"Jakub Kicinski" <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>,
"Michael Turquette" <mturquette@baylibre.com>,
"Stephen Boyd" <sboyd@kernel.org>,
"Breno Leitao" <leitao@debian.org>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Luis Chamberlain" <mcgrof@kernel.org>,
"Russ Weight" <russ.weight@linux.dev>,
"Dave Ertman" <david.m.ertman@intel.com>,
"Ira Weiny" <ira.weiny@intel.com>,
"Leon Romanovsky" <leon@kernel.org>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
"Arnd Bergmann" <arnd@arndb.de>,
"Brendan Higgins" <brendan.higgins@linux.dev>,
"David Gow" <davidgow@google.com>, "Rae Moar" <rmoar@google.com>,
"Jens Axboe" <axboe@kernel.dk>,
"Alexandre Courbot" <acourbot@nvidia.com>,
"Alexander Viro" <viro@zeniv.linux.org.uk>,
"Christian Brauner" <brauner@kernel.org>,
"Jan Kara" <jack@suse.cz>, "Liam Girdwood" <lgirdwood@gmail.com>,
"Mark Brown" <broonie@kernel.org>
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
rust-for-linux@vger.kernel.org, nouveau@lists.freedesktop.org,
dri-devel@lists.freedesktop.org, netdev@vger.kernel.org,
linux-clk@vger.kernel.org, linux-pci@vger.kernel.org,
linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com,
linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org,
Tamir Duberstein <tamird@gmail.com>
Subject: [PATCH v2 17/19] rust: sync: replace `kernel::c_str!` with C-Strings
Date: Thu, 25 Sep 2025 09:54:05 -0400 [thread overview]
Message-ID: <20250925-core-cstr-cstrings-v2-17-78e0aaace1cd@gmail.com> (raw)
In-Reply-To: <20250925-core-cstr-cstrings-v2-0-78e0aaace1cd@gmail.com>
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>
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 00f9b558a3ad..672411058a92 100644
--- a/rust/kernel/sync.rs
+++ b/rust/kernel/sync.rs
@@ -44,7 +44,6 @@ impl LockClassKey {
///
/// # Examples
/// ```
- /// # use kernel::c_str;
/// # use kernel::alloc::KBox;
/// # use kernel::types::ForeignOwnable;
/// # use kernel::sync::{LockClassKey, SpinLock};
@@ -56,7 +55,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) }
@@ -115,6 +114,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 b9343d5bc00f..261b827235ae 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)
//! }
//! }
@@ -337,7 +337,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),
});
--
2.51.0
next prev parent reply other threads:[~2025-09-25 13:56 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-25 13:53 [PATCH v2 00/19] rust: replace `kernel::c_str!` with C-Strings Tamir Duberstein
2025-09-25 13:53 ` [PATCH v2 01/19] drivers: net: " Tamir Duberstein
2025-09-25 13:53 ` [PATCH v2 02/19] gpu: nova-core: " Tamir Duberstein
2025-09-25 13:53 ` [PATCH v2 03/19] rust: auxiliary: " Tamir Duberstein
2025-09-25 13:53 ` [PATCH v2 04/19] rust: clk: " Tamir Duberstein
2025-09-25 13:53 ` [PATCH v2 05/19] rust: configfs: " Tamir Duberstein
2025-09-25 13:53 ` [PATCH v2 06/19] rust: cpufreq: " Tamir Duberstein
2025-09-25 13:53 ` [PATCH v2 07/19] rust: device: " Tamir Duberstein
2025-09-25 13:53 ` [PATCH v2 08/19] rust: firmware: " Tamir Duberstein
2025-09-25 13:53 ` [PATCH v2 09/19] rust: kunit: " Tamir Duberstein
2025-09-25 13:53 ` [PATCH v2 10/19] rust: macros: " Tamir Duberstein
2025-09-25 13:53 ` [PATCH v2 11/19] rust: miscdevice: " Tamir Duberstein
2025-09-25 13:54 ` [PATCH v2 12/19] rust: net: " Tamir Duberstein
2025-09-25 13:54 ` [PATCH v2 13/19] rust: pci: " Tamir Duberstein
2025-09-25 13:54 ` [PATCH v2 14/19] rust: platform: " Tamir Duberstein
2025-09-25 13:54 ` [PATCH v2 15/19] rust: seq_file: " Tamir Duberstein
2025-09-25 13:54 ` [PATCH v2 16/19] rust: str: " Tamir Duberstein
2025-09-25 13:54 ` Tamir Duberstein [this message]
2025-10-16 10:42 ` [PATCH v2 17/19] rust: sync: " Andreas Hindborg
2025-09-25 13:54 ` [PATCH v2 18/19] rust: io: " Tamir Duberstein
2025-09-25 22:12 ` Benno Lossin
2025-09-25 22:25 ` Danilo Krummrich
2025-10-01 9:28 ` Alice Ryhl
2025-09-25 13:54 ` [PATCH v2 19/19] rust: regulator: " Tamir Duberstein
2025-09-25 22:12 ` Benno Lossin
2025-10-01 9:29 ` Alice Ryhl
2025-10-15 9:48 ` Mark Brown
2025-09-25 14:01 ` [PATCH v2 00/19] rust: " Mark Brown
2025-09-26 18:46 ` Miguel Ojeda
2025-09-29 19:57 ` Miguel Ojeda
2025-12-22 20:04 ` (subset) " Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250925-core-cstr-cstrings-v2-17-78e0aaace1cd@gmail.com \
--to=tamird@gmail.com \
--cc=a.hindborg@kernel.org \
--cc=acourbot@nvidia.com \
--cc=airlied@gmail.com \
--cc=alex.gaynor@gmail.com \
--cc=aliceryhl@google.com \
--cc=andrew@lunn.ch \
--cc=arnd@arndb.de \
--cc=axboe@kernel.dk \
--cc=bhelgaas@google.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=brauner@kernel.org \
--cc=brendan.higgins@linux.dev \
--cc=broonie@kernel.org \
--cc=dakr@kernel.org \
--cc=davem@davemloft.net \
--cc=david.m.ertman@intel.com \
--cc=davidgow@google.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=edumazet@google.com \
--cc=fujita.tomonori@gmail.com \
--cc=gary@garyguo.net \
--cc=gregkh@linuxfoundation.org \
--cc=hkallweit1@gmail.com \
--cc=ira.weiny@intel.com \
--cc=jack@suse.cz \
--cc=kuba@kernel.org \
--cc=kunit-dev@googlegroups.com \
--cc=kwilczynski@kernel.org \
--cc=leitao@debian.org \
--cc=leon@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=lossin@kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mcgrof@kernel.org \
--cc=mripard@kernel.org \
--cc=mturquette@baylibre.com \
--cc=netdev@vger.kernel.org \
--cc=nouveau@lists.freedesktop.org \
--cc=ojeda@kernel.org \
--cc=pabeni@redhat.com \
--cc=rafael@kernel.org \
--cc=rmoar@google.com \
--cc=russ.weight@linux.dev \
--cc=rust-for-linux@vger.kernel.org \
--cc=sboyd@kernel.org \
--cc=simona@ffwll.ch \
--cc=tmgross@umich.edu \
--cc=tzimmermann@suse.de \
--cc=viresh.kumar@linaro.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.