From nobody Sat Feb 7 23:48:19 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2E3EB29A312; Mon, 22 Dec 2025 12:35:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766406940; cv=none; b=mQ6YflbvgPzYcbeHK2G/eHFkeXU7Ubtz2Yv4r9saAPyySUxFONyv0uOO1JY8G9cuA8LSKwUt7BLZyj+s8ljoW58Un3TOQ5ot1UNIIr1vlt0FJ7YzmonmBOC0sM8c9W6VYqyTblSIuPoUTAA+8bL7+H2iaJQuXzMNYs15WUiogHs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766406940; c=relaxed/simple; bh=drUNuwKRIeYo3aZL0WqkYRPMSOhXeSndodp4MXIUrt8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=cOleTWc32GM6elLVB6yaiooltDWFhWR56mwVXPXvHJE+JkYkHVTm/7sraQWaimOk41TjPs/rpUibGd3QQqmMz6mIqDGi5Asxb4uB0xq8dZ5SAM8ijATNwAZvVB0FHDxLJLaOEvqf4Yl5LMp55A68Zmg2FDE0KItaEyRckOCXGkQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=qYIwghCd; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="qYIwghCd" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 15E4EC4CEF1; Mon, 22 Dec 2025 12:35:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1766406939; bh=drUNuwKRIeYo3aZL0WqkYRPMSOhXeSndodp4MXIUrt8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=qYIwghCdrvOOb4RCD2GsOTYCwiBSQCle9Np6YC3PQ21XmMrIIxkWvLI3kBYGnDf3H 04oI5edw4g/RsZPxwDxTr7TDA00AWkAIaPcIFCCWqUTwstgtu/HzzPbKR69MrdR3M7 WFU9NLh9eoCKFGGqHGNxHgwxEc9x3hQ5zooksTfX3IjxYj0sFsI7ap+NapFsdidcoe HXCBHWPhDXlnjr9Yx6QAV27DLWCyF22AYfuqbu0fhtyZZ96XMCOhordMEE5QD4O2TI qBa76wFK4U6j3JJhgQSr95Abe050GaTqTju0sxzUkdyEc7xaVO56BvCquOpfe/ozRS 65xtb3mfKl1CA== From: Tamir Duberstein Date: Mon, 22 Dec 2025 13:35:27 +0100 Subject: [PATCH 1/7] rust: auxiliary: replace `kernel::c_str!` with C-Strings Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251222-cstr-driver-core-v1-1-1142a177d0fd@gmail.com> References: <20251222-cstr-driver-core-v1-0-1142a177d0fd@gmail.com> In-Reply-To: <20251222-cstr-driver-core-v1-0-1142a177d0fd@gmail.com> To: Greg Kroah-Hartman , Dave Ertman , Ira Weiny , Leon Romanovsky , Miguel Ojeda , Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , Danilo Krummrich , "Rafael J. Wysocki" , Daniel Almeida Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, Tamir Duberstein X-Mailer: b4 0.15-dev X-Developer-Signature: v=1; a=openssh-sha256; t=1766406930; l=1194; i=tamird@gmail.com; h=from:subject:message-id; bh=BVDdV23Nh6e2Ckn6TwYKXo68sSRbr3pGInAvEOSVe/w=; b=U1NIU0lHAAAAAQAAADMAAAALc3NoLWVkMjU1MTkAAAAgtYz36g7iDMSkY5K7Ab51ksGX7hJgs MRt+XVZTrIzMVIAAAAGcGF0YXR0AAAAAAAAAAZzaGE1MTIAAABTAAAAC3NzaC1lZDI1NTE5AAAA QDsKWgMARMDErf9c+y1rdphqPMwTb3TZ7XuXhDp7tuBVTxIOOyOILuTsPZlVK+wcH0IAhQ0okug 9NHeqCJ/2oQc= X-Developer-Key: i=tamird@gmail.com; a=openssh; fpr=SHA256:264rPmnnrb+ERkS7DDS3tuwqcJss/zevJRzoylqMsbc From: Tamir Duberstein 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 Reviewed-by: Alice Ryhl Reviewed-by: Benno Lossin Acked-by: Danilo Krummrich Signed-off-by: Tamir Duberstein Reviewed-by: Daniel Almeida --- samples/rust/rust_driver_auxiliary.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/rust/rust_driver_auxiliary.rs b/samples/rust/rust_driv= er_auxiliary.rs index 5761ea314f44..1e4fb23cfcb0 100644 --- a/samples/rust/rust_driver_auxiliary.rs +++ b/samples/rust/rust_driver_auxiliary.rs @@ -5,7 +5,7 @@ //! To make this driver probe, QEMU must be run with `-device pci-testdev`. =20 use kernel::{ - auxiliary, c_str, + auxiliary, device::{Bound, Core}, devres::Devres, driver, @@ -19,7 +19,7 @@ use pin_init::PinInit; =20 const MODULE_NAME: &CStr =3D ::NAME; -const AUXILIARY_NAME: &CStr =3D c_str!("auxiliary"); +const AUXILIARY_NAME: &CStr =3D c"auxiliary"; =20 struct AuxiliaryDriver; =20 --=20 2.52.0 From nobody Sat Feb 7 23:48:19 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E43CD299952; Mon, 22 Dec 2025 12:35:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766406944; cv=none; b=hGleR43xRM/oZuysF/UyI4aGw3ciVGFXGXCUh4L4DH15GxwJvJhe7lI+RERAquR2m+k8K39+RFGAGTv1EbMtcfZptBZzSIsHl+6cRIafupE/M5JSqARZDd7BAzyitUYd+5yLpxkDprj2Q4rsNlCV0fsjr/j/FKrXTTuQ4w+f6EI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766406944; c=relaxed/simple; bh=Ld5AMvq8OJucAYk0l6FmF7jpWtheRCiDax246Pt3bCo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=qerilF67eebKc+BAHErf1N2wUcwDJ4KLog50C/7VC4t9W1LLVPB22xhtJIEEiP81u51FhkUusDeuDJhnMLY+G1NGrnEz4RvOO9RVxqe8AgMHoaEaeigI3Xw1Lv0YcNBOCHgZvlgDOoHk3rH3vZsYa42ximf4pLAN2sSSWxmKtP4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=oqNTTB7J; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="oqNTTB7J" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2A7D5C113D0; Mon, 22 Dec 2025 12:35:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1766406943; bh=Ld5AMvq8OJucAYk0l6FmF7jpWtheRCiDax246Pt3bCo=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=oqNTTB7JuixL7DC5vuaVEcIZ6xQOPwyrT20UVZzmGeL41Qn060eP7hErSU9oQvsyV EIPUU79xHPwHUwZbEB8OdJtwmwjHGKOua4DFVZpVGLWD8ohNgZ8jsuHBOaS+fYqzpe ZS9gZAVQJP2kAbv65RoR4D/qnFRGUFfpNxVds9Jsd7aj7gc39alXmMMXlxOb7CU3b3 ss4pHYL+Z0slxwxOAxw5LeTu6u6ltlYsM1xbZJXQXrVvGcWIUIChnIu4qNUI395mKz NAIU4UBwe1xIKrHuFG496a3GYoy9Ptu2aqGPIUFnRc/z5zKP8l+r+dtG3AuF78K4NX jeRX6wJrZWZnQ== From: Tamir Duberstein Date: Mon, 22 Dec 2025 13:35:28 +0100 Subject: [PATCH 2/7] rust: device: replace `kernel::c_str!` with C-Strings Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251222-cstr-driver-core-v1-2-1142a177d0fd@gmail.com> References: <20251222-cstr-driver-core-v1-0-1142a177d0fd@gmail.com> In-Reply-To: <20251222-cstr-driver-core-v1-0-1142a177d0fd@gmail.com> To: Greg Kroah-Hartman , Dave Ertman , Ira Weiny , Leon Romanovsky , Miguel Ojeda , Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , Danilo Krummrich , "Rafael J. Wysocki" , Daniel Almeida Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, Tamir Duberstein X-Mailer: b4 0.15-dev X-Developer-Signature: v=1; a=openssh-sha256; t=1766406930; l=2310; i=tamird@gmail.com; h=from:subject:message-id; bh=nWAn8MY6906Q4EishesDMMvYRfPHt+KKPvTZXz4jgBk=; b=U1NIU0lHAAAAAQAAADMAAAALc3NoLWVkMjU1MTkAAAAgtYz36g7iDMSkY5K7Ab51ksGX7hJgs MRt+XVZTrIzMVIAAAAGcGF0YXR0AAAAAAAAAAZzaGE1MTIAAABTAAAAC3NzaC1lZDI1NTE5AAAA QDRTJNH8AXR+X+JXg/Z19XhYiMYJrRpyN43mwAJfW138EgM52X9zYujTw3znehfTfGtpPCnt5Hj ea768GFgJNAQ= X-Developer-Key: i=tamird@gmail.com; a=openssh; fpr=SHA256:264rPmnnrb+ERkS7DDS3tuwqcJss/zevJRzoylqMsbc From: Tamir Duberstein 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 Reviewed-by: Alice Ryhl Reviewed-by: Benno Lossin Acked-by: Danilo Krummrich Signed-off-by: Tamir Duberstein Reviewed-by: Daniel Almeida --- rust/kernel/device.rs | 4 +--- rust/kernel/device/property.rs | 6 +++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/rust/kernel/device.rs b/rust/kernel/device.rs index c79be2e2bfe3..d4edceaf3020 100644 --- a/rust/kernel/device.rs +++ b/rust/kernel/device.rs @@ -12,8 +12,6 @@ }; use core::{any::TypeId, marker::PhantomData, ptr}; =20 -#[cfg(CONFIG_PRINTK)] -use crate::c_str; use crate::str::CStrExt as _; =20 pub mod property; @@ -463,7 +461,7 @@ unsafe fn printk(&self, klevel: &[u8], msg: fmt::Argume= nts<'_>) { bindings::_dev_printk( klevel.as_ptr().cast::(), self.as_raw(), - c_str!("%pA").as_char_ptr(), + c"%pA".as_char_ptr(), core::ptr::from_ref(&msg).cast::(), ) }; diff --git a/rust/kernel/device/property.rs b/rust/kernel/device/property.rs index 3a332a8c53a9..3eb3f36d66d0 100644 --- a/rust/kernel/device/property.rs +++ b/rust/kernel/device/property.rs @@ -178,11 +178,11 @@ pub fn property_count_elem(&self, nam= e: &CStr) -> Result /// # Examples /// /// ``` - /// # use kernel::{c_str, device::{Device, property::FwNode}, str::CSt= ring}; + /// # use kernel::{device::{Device, property::FwNode}, str::CString}; /// fn examples(dev: &Device) -> Result { /// let fwnode =3D dev.fwnode().ok_or(ENOENT)?; - /// let b: u32 =3D fwnode.property_read(c_str!("some-number")).req= uired_by(dev)?; - /// if let Some(s) =3D fwnode.property_read::(c_str!("som= e-str")).optional() { + /// let b: u32 =3D fwnode.property_read(c"some-number").required_b= y(dev)?; + /// if let Some(s) =3D fwnode.property_read::(c"some-str"= ).optional() { /// // ... /// } /// Ok(()) --=20 2.52.0 From nobody Sat Feb 7 23:48:19 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 58337299A8F; Mon, 22 Dec 2025 12:35:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766406948; cv=none; b=NNyq44sc1/kHOKRXshSGODJbxpLTVoJeQxhlMxcqsGb7S/cuidhKcSX/2LCFkK4iB8H4v93emStBr5aj/aLiVR8R8o034V9q6Vg9SPp4ZHx6p1HFez+S35PnOCjGwlKmHsjjc7hBOk7cJw6ESqfi6CEjxOQoD5fM+dR/P3+lhbo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766406948; c=relaxed/simple; bh=wczg3gxdWuvvrPdCGIwbc3VRTJlOe0wnMFC/o5HTNRk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=SUQJmiEII1OdAKK9/UX0lMxcFiS8vsl4bUTwDn6B1jfNJBb5+nVv+4UKPxhyR6FsLSRDGNK8x36MtcHwJO8kHIXWENmQkN4ZSChaW96FMSZaaImzbVfSYNoD3iZc7NJTQPu6hOtogv2zeyp2TTXsnwJKPEXf5TShFS6PQom4ftM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Jtumiqxg; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Jtumiqxg" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 407B8C113D0; Mon, 22 Dec 2025 12:35:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1766406947; bh=wczg3gxdWuvvrPdCGIwbc3VRTJlOe0wnMFC/o5HTNRk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=JtumiqxgLd0r6JTZCpsRlxWq5Al63GT1Zw5bmyFekuFx31Xer9T197+fjHD4PoPqu dJFdBFovNWJRoZyIzst7CHHRQeG3yAA0hAT4LihtaaCzxg2l8SiJc8wQ12Ch2iCK7U IMyrYuq2uYVeJLy/+GfevYP6Ad+TNDiQ2rN7oSpzIAha8lF9XozocqA4/TPlgm09Fx OkycMB/n0Mvq3bdxzQMmN6IXoWfyRlVJpw1F/2zbeUfddfchUDXOLFQr1SdnSrajy1 tOCfFm3ksrgBxY2dwl4QaXPdMjp4P39cGXGJGUlc3B5OaSHLLzYUAZYoHo0vaZBmp+ 9/CqJlJdtKgTw== From: Tamir Duberstein Date: Mon, 22 Dec 2025 13:35:29 +0100 Subject: [PATCH 3/7] rust: platform: replace `kernel::c_str!` with C-Strings Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251222-cstr-driver-core-v1-3-1142a177d0fd@gmail.com> References: <20251222-cstr-driver-core-v1-0-1142a177d0fd@gmail.com> In-Reply-To: <20251222-cstr-driver-core-v1-0-1142a177d0fd@gmail.com> To: Greg Kroah-Hartman , Dave Ertman , Ira Weiny , Leon Romanovsky , Miguel Ojeda , Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , Danilo Krummrich , "Rafael J. Wysocki" , Daniel Almeida Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, Tamir Duberstein X-Mailer: b4 0.15-dev X-Developer-Signature: v=1; a=openssh-sha256; t=1766406930; l=6208; i=tamird@gmail.com; h=from:subject:message-id; bh=h/sRZfx3QwnPveZU7T8G3CkwT5gXbXtgWKtN6SPI+7U=; b=U1NIU0lHAAAAAQAAADMAAAALc3NoLWVkMjU1MTkAAAAgtYz36g7iDMSkY5K7Ab51ksGX7hJgs MRt+XVZTrIzMVIAAAAGcGF0YXR0AAAAAAAAAAZzaGE1MTIAAABTAAAAC3NzaC1lZDI1NTE5AAAA QK8iQqIXtLmsMk1B5MtEVatxRm+peIT0xGOFWtdgcBg+uU8IqOOg+Zry5MMgC+C4AnrFEgZ77Ad I97UO0cgQRgE= X-Developer-Key: i=tamird@gmail.com; a=openssh; fpr=SHA256:264rPmnnrb+ERkS7DDS3tuwqcJss/zevJRzoylqMsbc From: Tamir Duberstein 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 Reviewed-by: Alice Ryhl Reviewed-by: Benno Lossin Acked-by: Danilo Krummrich Signed-off-by: Tamir Duberstein Reviewed-by: Daniel Almeida --- rust/kernel/platform.rs | 6 +++--- samples/rust/rust_driver_faux.rs | 4 ++-- samples/rust/rust_driver_platform.rs | 30 ++++++++++++++---------------- 3 files changed, 19 insertions(+), 21 deletions(-) diff --git a/rust/kernel/platform.rs b/rust/kernel/platform.rs index ed889f079cab..abb22a787131 100644 --- a/rust/kernel/platform.rs +++ b/rust/kernel/platform.rs @@ -137,7 +137,7 @@ macro_rules! module_platform_driver { /// # Examples /// ///``` -/// # use kernel::{acpi, bindings, c_str, device::Core, of, platform}; +/// # use kernel::{acpi, bindings, device::Core, of, platform}; /// /// struct MyDriver; /// @@ -146,7 +146,7 @@ macro_rules! module_platform_driver { /// MODULE_OF_TABLE, /// ::IdInfo, /// [ -/// (of::DeviceId::new(c_str!("test,device")), ()) +/// (of::DeviceId::new(c"test,device"), ()) /// ] /// ); /// @@ -155,7 +155,7 @@ macro_rules! module_platform_driver { /// MODULE_ACPI_TABLE, /// ::IdInfo, /// [ -/// (acpi::DeviceId::new(c_str!("LNUXBEEF")), ()) +/// (acpi::DeviceId::new(c"LNUXBEEF"), ()) /// ] /// ); /// diff --git a/samples/rust/rust_driver_faux.rs b/samples/rust/rust_driver_fa= ux.rs index ecc9fd378cbd..23add3160693 100644 --- a/samples/rust/rust_driver_faux.rs +++ b/samples/rust/rust_driver_faux.rs @@ -2,7 +2,7 @@ =20 //! Rust faux device sample. =20 -use kernel::{c_str, faux, prelude::*, Module}; +use kernel::{faux, prelude::*, Module}; =20 module! { type: SampleModule, @@ -20,7 +20,7 @@ impl Module for SampleModule { fn init(_module: &'static ThisModule) -> Result { pr_info!("Initialising Rust Faux Device Sample\n"); =20 - let reg =3D faux::Registration::new(c_str!("rust-faux-sample-devic= e"), None)?; + let reg =3D faux::Registration::new(c"rust-faux-sample-device", No= ne)?; =20 dev_info!(reg.as_ref(), "Hello from faux device!\n"); =20 diff --git a/samples/rust/rust_driver_platform.rs b/samples/rust/rust_drive= r_platform.rs index 6bf4f0c9633d..a3044d773176 100644 --- a/samples/rust/rust_driver_platform.rs +++ b/samples/rust/rust_driver_platform.rs @@ -63,7 +63,7 @@ //! =20 use kernel::{ - acpi, c_str, + acpi, device::{ self, property::{FwNodeReferenceArgs, NArgs}, @@ -85,14 +85,14 @@ struct SampleDriver { OF_TABLE, MODULE_OF_TABLE, ::IdInfo, - [(of::DeviceId::new(c_str!("test,rust-device")), Info(42))] + [(of::DeviceId::new(c"test,rust-device"), Info(42))] ); =20 kernel::acpi_device_table!( ACPI_TABLE, MODULE_ACPI_TABLE, ::IdInfo, - [(acpi::DeviceId::new(c_str!("LNUXBEEF")), Info(0))] + [(acpi::DeviceId::new(c"LNUXBEEF"), Info(0))] ); =20 impl platform::Driver for SampleDriver { @@ -124,49 +124,47 @@ impl SampleDriver { fn properties_parse(dev: &device::Device) -> Result { let fwnode =3D dev.fwnode().ok_or(ENOENT)?; =20 - if let Ok(idx) =3D - fwnode.property_match_string(c_str!("compatible"), c_str!("tes= t,rust-device")) - { + if let Ok(idx) =3D fwnode.property_match_string(c"compatible", c"t= est,rust-device") { dev_info!(dev, "matched compatible string idx =3D {}\n", idx); } =20 - let name =3D c_str!("compatible"); + let name =3D c"compatible"; let prop =3D fwnode.property_read::(name).required_by(dev= )?; dev_info!(dev, "'{name}'=3D'{prop:?}'\n"); =20 - let name =3D c_str!("test,bool-prop"); - let prop =3D fwnode.property_read_bool(c_str!("test,bool-prop")); + let name =3D c"test,bool-prop"; + let prop =3D fwnode.property_read_bool(c"test,bool-prop"); dev_info!(dev, "'{name}'=3D'{prop}'\n"); =20 - if fwnode.property_present(c_str!("test,u32-prop")) { + if fwnode.property_present(c"test,u32-prop") { dev_info!(dev, "'test,u32-prop' is present\n"); } =20 - let name =3D c_str!("test,u32-optional-prop"); + let name =3D c"test,u32-optional-prop"; let prop =3D fwnode.property_read::(name).or(0x12); dev_info!(dev, "'{name}'=3D'{prop:#x}' (default =3D 0x12)\n"); =20 // A missing required property will print an error. Discard the er= ror to // prevent properties_parse from failing in that case. - let name =3D c_str!("test,u32-required-prop"); + let name =3D c"test,u32-required-prop"; let _ =3D fwnode.property_read::(name).required_by(dev); =20 - let name =3D c_str!("test,u32-prop"); + let name =3D c"test,u32-prop"; let prop: u32 =3D fwnode.property_read(name).required_by(dev)?; dev_info!(dev, "'{name}'=3D'{prop:#x}'\n"); =20 - let name =3D c_str!("test,i16-array"); + let name =3D c"test,i16-array"; let prop: [i16; 4] =3D fwnode.property_read(name).required_by(dev)= ?; dev_info!(dev, "'{name}'=3D'{prop:?}'\n"); let len =3D fwnode.property_count_elem::(name)?; dev_info!(dev, "'{name}' length is {len}\n"); =20 - let name =3D c_str!("test,i16-array"); + let name =3D c"test,i16-array"; let prop: KVec =3D fwnode.property_read_array_vec(name, 4)?.r= equired_by(dev)?; dev_info!(dev, "'{name}'=3D'{prop:?}' (KVec)\n"); =20 for child in fwnode.children() { - let name =3D c_str!("test,ref-arg"); + let name =3D c"test,ref-arg"; let nargs =3D NArgs::N(2); let prop: FwNodeReferenceArgs =3D child.property_get_reference= _args(name, nargs, 0)?; dev_info!(dev, "'{name}'=3D'{prop:?}'\n"); --=20 2.52.0 From nobody Sat Feb 7 23:48:19 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 695D6299A8F; Mon, 22 Dec 2025 12:35:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766406952; cv=none; b=TVe8A60e+8/NoWWDlXNheCGiSraetzLk/tfpqdwOx0A3woDS5UusqtsUsqzG3O88J7SEmN15kN5hQLAO5RvCQMhZiHLxeXBJlbSlxZjaZAdmhfzg2NyjjRqDx80ihIf2xyPf1DLp/bG91lEW9ri2+FmGYvdFdrEBTBbM950Qy/4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766406952; c=relaxed/simple; bh=MFh6mggRYW3+kj5WDpGpaaaM7+3cG6rn3t7+x13dnTc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=QIM2lfHWBvaZ7lbN7gTwM35JO1YrKmTrAdR8sBS61BXSmQt23NXWAibenzRqrhStD7TPwhLyfWrU+m/ucHizG9FjWHtXmRqT+fAV2tcK2ihcWoWyoLXW0Ux5HP8T4Tg5tLfpr+NCoJms78BlVSnR3/V37hsHtf6oUMGIwj3CxYY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=m/y4zDMM; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="m/y4zDMM" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5841AC4CEF1; Mon, 22 Dec 2025 12:35:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1766406952; bh=MFh6mggRYW3+kj5WDpGpaaaM7+3cG6rn3t7+x13dnTc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=m/y4zDMMjepLhYLxi+xqbjp+eatZ7aUlVuKQEB7Hx4S9k0R3VQbxJabpVMNR5mgaC qsyOqXC1VAdbBlSYVTw+IQrtDymPP39FGVnHX7vuHYQutdIXDKhnRLdaKt0ky8AF6Z rZEhrW0yiPtV1hzG+ClDazc/KSecKfVcjwWivLc5VYZQ7gnuWa8/SGZroNlKPMjNWZ MpiF//tti70MkpqT+mXp0RYzo8PuEFnhBlWyd+Men1HiZYO7tx6NAptxuuTkHbBqmB Lo45kyhepETgYiTLysYGX06HxpScsy05VEu/f+dF2vi2WHO4jdmKQ3PKb4GNvl4CJW arrib+hOuvGEA== From: Tamir Duberstein Date: Mon, 22 Dec 2025 13:35:30 +0100 Subject: [PATCH 4/7] rust: io: replace `kernel::c_str!` with C-Strings Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251222-cstr-driver-core-v1-4-1142a177d0fd@gmail.com> References: <20251222-cstr-driver-core-v1-0-1142a177d0fd@gmail.com> In-Reply-To: <20251222-cstr-driver-core-v1-0-1142a177d0fd@gmail.com> To: Greg Kroah-Hartman , Dave Ertman , Ira Weiny , Leon Romanovsky , Miguel Ojeda , Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , Danilo Krummrich , "Rafael J. Wysocki" , Daniel Almeida Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, Tamir Duberstein X-Mailer: b4 0.15-dev X-Developer-Signature: v=1; a=openssh-sha256; t=1766406930; l=1697; i=tamird@gmail.com; h=from:subject:message-id; bh=XRqPEc+02APN7oufULgtA4lYVdXfRUqvkbUWAXMp5AE=; b=U1NIU0lHAAAAAQAAADMAAAALc3NoLWVkMjU1MTkAAAAgtYz36g7iDMSkY5K7Ab51ksGX7hJgs MRt+XVZTrIzMVIAAAAGcGF0YXR0AAAAAAAAAAZzaGE1MTIAAABTAAAAC3NzaC1lZDI1NTE5AAAA QCW84UhhUAPsc7t+I4FrOEVUp608OXG+5Ez1004s9XKoB730WzzVi5xrzcCWtQ3b70/j3QlIWbs lLzpXQpF8WQM= X-Developer-Key: i=tamird@gmail.com; a=openssh; fpr=SHA256:264rPmnnrb+ERkS7DDS3tuwqcJss/zevJRzoylqMsbc From: Tamir Duberstein 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 Reviewed-by: Daniel Almeida --- rust/kernel/io/mem.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/rust/kernel/io/mem.rs b/rust/kernel/io/mem.rs index b03b82cd531b..3b131f6f7733 100644 --- a/rust/kernel/io/mem.rs +++ b/rust/kernel/io/mem.rs @@ -5,7 +5,6 @@ use core::ops::Deref; =20 use crate::{ - c_str, device::{ Bound, Device, // @@ -52,7 +51,7 @@ pub(crate) unsafe fn new(device: &'a Device, resou= rce: &'a Resource) -> S /// illustration purposes. /// /// ```no_run - /// use kernel::{bindings, c_str, platform, of, device::Core}; + /// use kernel::{bindings, platform, of, device::Core}; /// struct SampleDriver; /// /// impl platform::Driver for SampleDriver { @@ -110,7 +109,7 @@ pub fn iomap_exclusive_sized( /// illustration purposes. /// /// ```no_run - /// use kernel::{bindings, c_str, platform, of, device::Core}; + /// use kernel::{bindings, platform, of, device::Core}; /// struct SampleDriver; /// /// impl platform::Driver for SampleDriver { @@ -172,7 +171,7 @@ impl ExclusiveIoMem { fn ioremap(resource: &Resource) -> Result { let start =3D resource.start(); let size =3D resource.size(); - let name =3D resource.name().unwrap_or(c_str!("")); + let name =3D resource.name().unwrap_or_default(); =20 let region =3D resource .request_region( --=20 2.52.0 From nobody Sat Feb 7 23:48:19 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 878C829A32D; Mon, 22 Dec 2025 12:35:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766406956; cv=none; b=ZQfaWvvHI6nQocchhBcAkQHwd9N9s9DMBRHtr99vTz7TGhvYx+OsqSktwKRUy9gDueGsHsVgwUF6JgYzQu11wFQxNKYVm4l6VM7C1BA52UDhZwFEKn7Rjq4lfPB59A68MJzDLKdxsPhbKckXV5mX6fh14rgEVvJXCnyls43TIvI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766406956; c=relaxed/simple; bh=dYSg3oVdufgzL/W13arMrKcCV9A5JJmzSffp3kHFq2Q=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=AmW1hAwlYNPyJIe8zwz4cJUFxqFafwEFxkxvswViKNL2B3B92TgDqcbs0be0PfMX94D6bF9Clqc9GFQGnS050gYzKh5NBeK/9/iABce3efps/UYA1LyE7ZC0Yq7Jyiozy5KsPTVL9XBi70cnDaxTfKi+sA7zb9BPIzIfBRDH+Ak= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=bQJ3rFx9; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="bQJ3rFx9" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E1AEC113D0; Mon, 22 Dec 2025 12:35:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1766406956; bh=dYSg3oVdufgzL/W13arMrKcCV9A5JJmzSffp3kHFq2Q=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=bQJ3rFx9gdZltXZP5dI/b4heuDpQYfRDq8bl06P0xY0Qj7D6U+5L4Jv2QFuVlxY5d y6AzXtJXe3YzzznTSlssJSWQ1eS5oEW99631jV4r4kwL7u+Xn9t6G5CryyXZAnI7X1 roNNhB2EC/CnSwV87jhipE8x1WMk70srzfaxYHhoaGjs+5JJIJTZ+Pus6SLFlaZDFQ pDeq52SnfjJr0znYGOu+0H8f3D9uIdmMH73oUZH8OeLsiCWyUCYdt+3QSkaiAWTbGV tNQKP17bpSnEiuGuXoBLcHGEVbbPGu9gAy/DzmkgTRQWX2PqcYmHh1yinmtQjlOpkl BpvvcpFzs8ivg== From: Tamir Duberstein Date: Mon, 22 Dec 2025 13:35:31 +0100 Subject: [PATCH 5/7] rust: irq: replace `kernel::c_str!` with C-Strings Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251222-cstr-driver-core-v1-5-1142a177d0fd@gmail.com> References: <20251222-cstr-driver-core-v1-0-1142a177d0fd@gmail.com> In-Reply-To: <20251222-cstr-driver-core-v1-0-1142a177d0fd@gmail.com> To: Greg Kroah-Hartman , Dave Ertman , Ira Weiny , Leon Romanovsky , Miguel Ojeda , Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , Danilo Krummrich , "Rafael J. Wysocki" , Daniel Almeida Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, Tamir Duberstein X-Mailer: b4 0.15-dev X-Developer-Signature: v=1; a=openssh-sha256; t=1766406931; l=2062; i=tamird@gmail.com; h=from:subject:message-id; bh=L02rHNwqlKnpUDu9cZ6amzsQm+VwhgqPRTW13V9PPFY=; b=U1NIU0lHAAAAAQAAADMAAAALc3NoLWVkMjU1MTkAAAAgtYz36g7iDMSkY5K7Ab51ksGX7hJgs MRt+XVZTrIzMVIAAAAGcGF0YXR0AAAAAAAAAAZzaGE1MTIAAABTAAAAC3NzaC1lZDI1NTE5AAAA QAndKJlAuFBouzwIkP/nWdHkSbKLG9+X1dNneKVFcKXvJWT2QhHGrqr4ZNGsYH/np9kyxmFjuMx XhkMiHAA6+wA= X-Developer-Key: i=tamird@gmail.com; a=openssh; fpr=SHA256:264rPmnnrb+ERkS7DDS3tuwqcJss/zevJRzoylqMsbc From: Tamir Duberstein 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 Reviewed-by: Daniel Almeida --- rust/kernel/irq/request.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/rust/kernel/irq/request.rs b/rust/kernel/irq/request.rs index b150563fdef8..67769800117c 100644 --- a/rust/kernel/irq/request.rs +++ b/rust/kernel/irq/request.rs @@ -139,7 +139,6 @@ pub fn irq(&self) -> u32 { /// [`Completion::wait_for_completion()`]: kernel::sync::Completion::wait_= for_completion /// /// ``` -/// use kernel::c_str; /// use kernel::device::{Bound, Device}; /// use kernel::irq::{self, Flags, IrqRequest, IrqReturn, Registration}; /// use kernel::prelude::*; @@ -167,7 +166,7 @@ pub fn irq(&self) -> u32 { /// handler: impl PinInit, /// request: IrqRequest<'_>, /// ) -> Result>> { -/// let registration =3D Registration::new(request, Flags::SHARED, c_s= tr!("my_device"), handler); +/// let registration =3D Registration::new(request, Flags::SHARED, c"m= y_device", handler); /// /// let registration =3D Arc::pin_init(registration, GFP_KERNEL)?; /// @@ -340,7 +339,6 @@ fn handle_threaded(&self, device: &Device) -> Ir= qReturn { /// [`Mutex`](kernel::sync::Mutex) to provide interior mutability. /// /// ``` -/// use kernel::c_str; /// use kernel::device::{Bound, Device}; /// use kernel::irq::{ /// self, Flags, IrqRequest, IrqReturn, ThreadedHandler, ThreadedIrqRetu= rn, @@ -381,7 +379,7 @@ fn handle_threaded(&self, device: &Device) -> Ir= qReturn { /// request: IrqRequest<'_>, /// ) -> Result>> { /// let registration =3D -/// ThreadedRegistration::new(request, Flags::SHARED, c_str!("my_d= evice"), handler); +/// ThreadedRegistration::new(request, Flags::SHARED, c"my_device"= , handler); /// /// let registration =3D Arc::pin_init(registration, GFP_KERNEL)?; /// --=20 2.52.0 From nobody Sat Feb 7 23:48:19 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7CBA2299952; Mon, 22 Dec 2025 12:36:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766406960; cv=none; b=g1RJlnOxqr/RGeHimF6qLsZ/HpyvngrrjgFM2xjv0dQLg75LwCEXzRoaf9ANNWwJ1+vwKl6aT2lH+88hGl6PVMs/ZSD3953DOxXJrYLPUZGaOglkCe9+KHzKvhs1kl+vT8/qIFWiYSzkmZ9CsZcnEKTixTsVOvEVWtjEpVWAlOc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766406960; c=relaxed/simple; bh=GZefr2miDJVPz7/AUrQZGGN8nlgyECV12X9IsaSBhCc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ieQTkoX5wF96Sadc/HixGLIF9cLzuFMxmwCrgooIYJMEbO5ByV6m4f/TOPKrju+XlzLmaf8694FH0LJGwRcyvHY9PpnEA6rU01DRTytxr47EqeobwA54LdMHJCAmwFCcf4tGbTlizyTPHcq/HEZqtM4mGv8HGLPLOy0d0FlOA3U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ixjllw0w; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ixjllw0w" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8282CC4CEF1; Mon, 22 Dec 2025 12:35:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1766406960; bh=GZefr2miDJVPz7/AUrQZGGN8nlgyECV12X9IsaSBhCc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=ixjllw0wAHsjklLaIb3kMcqfoa3UeqL5PKLzncxqgiW3PH2yxeUHFPCFXVwpzoKsj k898X6+CjAm8Q97Y3TRHUnVLaBaXa6Yq/vuu7zecO198swOvIjDtElOIfsStdaFsvm szi592WB+7oQ06+cvBoNf/WQx5+gjn9PZEzui/D3oH+wo0nEeE9fFmjNTcoH0ogjbn +uYgJeR3kDxqZennDRzibNbIoSUrPNho4vKtkLkb8MAFlLqbeWk2h8MezSgy468BYi LiCwMwQaifkKPqxgfH0Zm0xiYUOfDrlB7N+saxeIF0IaoC+7pK5MqACW+tRIaTxTse mh/yBPee+pxmw== From: Tamir Duberstein Date: Mon, 22 Dec 2025 13:35:32 +0100 Subject: [PATCH 6/7] rust: debugfs: replace `kernel::c_str!` with C-Strings Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251222-cstr-driver-core-v1-6-1142a177d0fd@gmail.com> References: <20251222-cstr-driver-core-v1-0-1142a177d0fd@gmail.com> In-Reply-To: <20251222-cstr-driver-core-v1-0-1142a177d0fd@gmail.com> To: Greg Kroah-Hartman , Dave Ertman , Ira Weiny , Leon Romanovsky , Miguel Ojeda , Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , Danilo Krummrich , "Rafael J. Wysocki" , Daniel Almeida Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, Tamir Duberstein X-Mailer: b4 0.15-dev X-Developer-Signature: v=1; a=openssh-sha256; t=1766406931; l=3123; i=tamird@gmail.com; h=from:subject:message-id; bh=wnJzdd7Q/TsdMm0CR2JTey0rC7wKqMRx7YZzm8OaozQ=; b=U1NIU0lHAAAAAQAAADMAAAALc3NoLWVkMjU1MTkAAAAgtYz36g7iDMSkY5K7Ab51ksGX7hJgs MRt+XVZTrIzMVIAAAAGcGF0YXR0AAAAAAAAAAZzaGE1MTIAAABTAAAAC3NzaC1lZDI1NTE5AAAA QNQv54f8lXcI0JW5/+ZgOT0kqH5VnR7sBAanDaln/RB63mYRHhl/n7qd8XPaTIPr/iCytWIAmIL sYV/J/kcrXA0= X-Developer-Key: i=tamird@gmail.com; a=openssh; fpr=SHA256:264rPmnnrb+ERkS7DDS3tuwqcJss/zevJRzoylqMsbc From: Tamir Duberstein 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 Reviewed-by: Daniel Almeida --- rust/kernel/debugfs.rs | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/rust/kernel/debugfs.rs b/rust/kernel/debugfs.rs index facad81e8290..fe7c8c5e3301 100644 --- a/rust/kernel/debugfs.rs +++ b/rust/kernel/debugfs.rs @@ -102,9 +102,8 @@ fn create_file<'a, T, E: 'a>( /// # Examples /// /// ``` - /// # use kernel::c_str; /// # use kernel::debugfs::Dir; - /// let debugfs =3D Dir::new(c_str!("parent")); + /// let debugfs =3D Dir::new(c"parent"); /// ``` pub fn new(name: &CStr) -> Self { Dir::create(name, None) @@ -115,10 +114,9 @@ pub fn new(name: &CStr) -> Self { /// # Examples /// /// ``` - /// # use kernel::c_str; /// # use kernel::debugfs::Dir; - /// let parent =3D Dir::new(c_str!("parent")); - /// let child =3D parent.subdir(c_str!("child")); + /// let parent =3D Dir::new(c"parent"); + /// let child =3D parent.subdir(c"child"); /// ``` pub fn subdir(&self, name: &CStr) -> Self { Dir::create(name, Some(self)) @@ -132,11 +130,10 @@ pub fn subdir(&self, name: &CStr) -> Self { /// # Examples /// /// ``` - /// # use kernel::c_str; /// # use kernel::debugfs::Dir; /// # use kernel::prelude::*; - /// # let dir =3D Dir::new(c_str!("my_debugfs_dir")); - /// let file =3D KBox::pin_init(dir.read_only_file(c_str!("foo"), 200)= , GFP_KERNEL)?; + /// # let dir =3D Dir::new(c"my_debugfs_dir"); + /// let file =3D KBox::pin_init(dir.read_only_file(c"foo", 200), GFP_K= ERNEL)?; /// // "my_debugfs_dir/foo" now contains the number 200. /// // The file is removed when `file` is dropped. /// # Ok::<(), Error>(()) @@ -161,11 +158,10 @@ pub fn read_only_file<'a, T, E: 'a>( /// # Examples /// /// ``` - /// # use kernel::c_str; /// # use kernel::debugfs::Dir; /// # use kernel::prelude::*; - /// # let dir =3D Dir::new(c_str!("my_debugfs_dir")); - /// let file =3D KBox::pin_init(dir.read_binary_file(c_str!("foo"), [0= x1, 0x2]), GFP_KERNEL)?; + /// # let dir =3D Dir::new(c"my_debugfs_dir"); + /// let file =3D KBox::pin_init(dir.read_binary_file(c"foo", [0x1, 0x2= ]), GFP_KERNEL)?; /// # Ok::<(), Error>(()) /// ``` pub fn read_binary_file<'a, T, E: 'a>( @@ -188,12 +184,11 @@ pub fn read_binary_file<'a, T, E: 'a>( /// /// ``` /// # use core::sync::atomic::{AtomicU32, Ordering}; - /// # use kernel::c_str; /// # use kernel::debugfs::Dir; /// # use kernel::prelude::*; - /// # let dir =3D Dir::new(c_str!("foo")); + /// # let dir =3D Dir::new(c"foo"); /// let file =3D KBox::pin_init( - /// dir.read_callback_file(c_str!("bar"), + /// dir.read_callback_file(c"bar", /// AtomicU32::new(3), /// &|val, f| { /// let out =3D val.load(Ordering::Relaxed); --=20 2.52.0 From nobody Sat Feb 7 23:48:19 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9F59B299952; Mon, 22 Dec 2025 12:36:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766406964; cv=none; b=C2oP73lolXx9bzPe8HrZVWJhpmWMAZPfejxO2uI2t/yhqks6tiivfZ3K534if8LmgoixGe0SVLi+vE0heP50kv0l+2xQyk08Nc1jdpov4pQVoGKWEfPUxnFaCg21/4QIuP8tHUcMQ179OVa1ADuBQ+3XRSc2agQ0OcaKTjwbQBw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766406964; c=relaxed/simple; bh=8DQ/FR0EAoq7PDZ/SgyPus1AoqbyZO25KcfK/QGVXsI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=lbEGGwGRvqVZ7OcdB4ejGlojzpsF5h+LxIgpmvMd+idh3prhySeJ/DwmsGuRb/521JIeQMMLbx1TPkBEf+NFthazCcUVxhQNiE/xWy/wkKBqnQP66C0ouFWONa4d7LSS/FXZFOfYAWqQwXyv5vVmRSiEkf5IPz2+8KnkPgDHJTA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Q/GSrRbX; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Q/GSrRbX" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9702DC113D0; Mon, 22 Dec 2025 12:36:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1766406964; bh=8DQ/FR0EAoq7PDZ/SgyPus1AoqbyZO25KcfK/QGVXsI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Q/GSrRbXMMmybHtwZJpyTtUXmAqu6G1xCXKTR90ULLFwfUmo5+aRNNzzjZ1zh+7IW 6EZ8bAbnkCUXLtiQ23C8yNevxDEzCAlIQKj2Jvx7B7K1yxww4hvkpe1iFnL60Y+dvc D4PrwC0LQ4K3rz4dPpzZx5eYbWiNkLQLuSpT8BzlJPjTfp68J5bfWUXO8wNgV7g5qU UwXxL84HnMFrkaCsRgEyDgKyF4zM6hOATjJzxSPgxBZ0bry8AIzseRUG88BL/wxqpo t2Ih3D+HwSuugSCCOQvPOQqJ6uBqV0ix091UHQuShWySgGHIZvqu2b0SFPb+OclyU1 fOc/E5bWD+CSw== From: Tamir Duberstein Date: Mon, 22 Dec 2025 13:35:33 +0100 Subject: [PATCH 7/7] samples: rust: debugfs: replace `kernel::c_str!` with C-Strings Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251222-cstr-driver-core-v1-7-1142a177d0fd@gmail.com> References: <20251222-cstr-driver-core-v1-0-1142a177d0fd@gmail.com> In-Reply-To: <20251222-cstr-driver-core-v1-0-1142a177d0fd@gmail.com> To: Greg Kroah-Hartman , Dave Ertman , Ira Weiny , Leon Romanovsky , Miguel Ojeda , Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , Danilo Krummrich , "Rafael J. Wysocki" , Daniel Almeida Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, Tamir Duberstein X-Mailer: b4 0.15-dev X-Developer-Signature: v=1; a=openssh-sha256; t=1766406931; l=4838; i=tamird@gmail.com; h=from:subject:message-id; bh=mqXYZLE8JU4rujJv0HsYLd4wAnkasrCISB5W8jpNYxM=; b=U1NIU0lHAAAAAQAAADMAAAALc3NoLWVkMjU1MTkAAAAgtYz36g7iDMSkY5K7Ab51ksGX7hJgs MRt+XVZTrIzMVIAAAAGcGF0YXR0AAAAAAAAAAZzaGE1MTIAAABTAAAAC3NzaC1lZDI1NTE5AAAA QMUGgCsZl99Mn//Bri041qr3BeQnX2BRwTwL68uHBvH2I0a3BegqDksFKDC2IuKmuie9xLKLC/6 BFHiPvXjSWwg= X-Developer-Key: i=tamird@gmail.com; a=openssh; fpr=SHA256:264rPmnnrb+ERkS7DDS3tuwqcJss/zevJRzoylqMsbc From: Tamir Duberstein 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 Reviewed-by: Daniel Almeida --- samples/rust/rust_debugfs.rs | 17 ++++++++--------- samples/rust/rust_debugfs_scoped.rs | 20 ++++++++------------ 2 files changed, 16 insertions(+), 21 deletions(-) diff --git a/samples/rust/rust_debugfs.rs b/samples/rust/rust_debugfs.rs index 025e8f9d12de..2888619443d3 100644 --- a/samples/rust/rust_debugfs.rs +++ b/samples/rust/rust_debugfs.rs @@ -32,7 +32,6 @@ //! ``` =20 use core::str::FromStr; -use kernel::c_str; use kernel::debugfs::{Dir, File}; use kernel::new_mutex; use kernel::prelude::*; @@ -98,7 +97,7 @@ fn from_str(s: &str) -> Result { ACPI_TABLE, MODULE_ACPI_TABLE, ::IdInfo, - [(acpi::DeviceId::new(c_str!("LNUXBEEF")), ())] + [(acpi::DeviceId::new(c"LNUXBEEF"), ())] ); =20 impl platform::Driver for RustDebugFs { @@ -125,34 +124,34 @@ fn probe( =20 impl RustDebugFs { fn build_counter(dir: &Dir) -> impl PinInit>> + '_ { - dir.read_write_file(c_str!("counter"), Atomic::::new(0)) + dir.read_write_file(c"counter", Atomic::::new(0)) } =20 fn build_inner(dir: &Dir) -> impl PinInit>> + '_ { - dir.read_write_file(c_str!("pair"), new_mutex!(Inner { x: 3, y: 10= })) + dir.read_write_file(c"pair", new_mutex!(Inner { x: 3, y: 10 })) } =20 fn new(pdev: &platform::Device) -> impl PinInit + '= _ { - let debugfs =3D Dir::new(c_str!("sample_debugfs")); + let debugfs =3D Dir::new(c"sample_debugfs"); let dev =3D pdev.as_ref(); =20 try_pin_init! { Self { _compatible <- debugfs.read_only_file( - c_str!("compatible"), + c"compatible", dev.fwnode() .ok_or(ENOENT)? - .property_read::(c_str!("compatible")) + .property_read::(c"compatible") .required_by(dev)?, ), counter <- Self::build_counter(&debugfs), inner <- Self::build_inner(&debugfs), array_blob <- debugfs.read_write_binary_file( - c_str!("array_blob"), + c"array_blob", new_mutex!([0x62, 0x6c, 0x6f, 0x62]), ), vector_blob <- debugfs.read_write_binary_file( - c_str!("vector_blob"), + c"vector_blob", new_mutex!(kernel::kvec!(0x42; SZ_4K)?), ), _debugfs: debugfs, diff --git a/samples/rust/rust_debugfs_scoped.rs b/samples/rust/rust_debugf= s_scoped.rs index 702a6546d3fb..358c47bae4d0 100644 --- a/samples/rust/rust_debugfs_scoped.rs +++ b/samples/rust/rust_debugfs_scoped.rs @@ -11,7 +11,7 @@ use kernel::sizes::*; use kernel::sync::atomic::Atomic; use kernel::sync::Mutex; -use kernel::{c_str, new_mutex, str::CString}; +use kernel::{new_mutex, str::CString}; =20 module! { type: RustScopedDebugFs, @@ -80,7 +80,7 @@ fn create_file_write( }; dir.read_write_file(&name, val); } - dir.read_write_binary_file(c_str!("blob"), &dev_data.blob); + dir.read_write_binary_file(c"blob", &dev_data.blob); }, ), GFP_KERNEL, @@ -119,20 +119,16 @@ struct DeviceData { } =20 fn init_control(base_dir: &Dir, dyn_dirs: Dir) -> impl PinInit> + '_ { - base_dir.scope( - ModuleData::init(dyn_dirs), - c_str!("control"), - |data, dir| { - dir.write_only_callback_file(c_str!("create"), data, &create_f= ile_write); - dir.write_only_callback_file(c_str!("remove"), data, &remove_f= ile_write); - }, - ) + base_dir.scope(ModuleData::init(dyn_dirs), c"control", |data, dir| { + dir.write_only_callback_file(c"create", data, &create_file_write); + dir.write_only_callback_file(c"remove", data, &remove_file_write); + }) } =20 impl kernel::Module for RustScopedDebugFs { fn init(_module: &'static kernel::ThisModule) -> Result { - let base_dir =3D Dir::new(c_str!("rust_scoped_debugfs")); - let dyn_dirs =3D base_dir.subdir(c_str!("dynamic")); + let base_dir =3D Dir::new(c"rust_scoped_debugfs"); + let dyn_dirs =3D base_dir.subdir(c"dynamic"); Ok(Self { _data: KBox::pin_init(init_control(&base_dir, dyn_dirs), GFP_K= ERNEL)?, }) --=20 2.52.0