* [PATCH 0/9] rust: use `kernel::{fmt,prelude::fmt!}`
@ 2025-07-09 19:59 Tamir Duberstein
2025-07-09 20:00 ` [PATCH 1/9] gpu: nova-core: " Tamir Duberstein
` (10 more replies)
0 siblings, 11 replies; 18+ messages in thread
From: Tamir Duberstein @ 2025-07-09 19:59 UTC (permalink / raw)
To: Danilo Krummrich, David Airlie, Simona Vetter, Miguel Ojeda,
Alex Gaynor, Boqun Feng, Gary Guo, Björn Roy Baron,
Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
Jens Axboe, Greg Kroah-Hartman, Rafael J. Wysocki,
Brendan Higgins, David Gow, Rae Moar
Cc: nouveau, dri-devel, linux-kernel, rust-for-linux, linux-block,
linux-kselftest, kunit-dev, Tamir Duberstein
This is series 2a/5 of the migration to `core::ffi::CStr`[0].
20250704-core-cstr-prepare-v1-0-a91524037783@gmail.com.
This series depends on the prior series[0] and is intended to go through
the rust tree to reduce the number of release cycles required to
complete the work.
Subsystem maintainers: I would appreciate your `Acked-by`s so that this
can be taken through Miguel's tree (where the other series must go).
[0] https://lore.kernel.org/all/20250704-core-cstr-prepare-v1-0-a91524037783@gmail.com/
Signed-off-by: Tamir Duberstein <tamird@gmail.com>
---
Tamir Duberstein (9):
gpu: nova-core: use `kernel::{fmt,prelude::fmt!}`
rust: alloc: use `kernel::{fmt,prelude::fmt!}`
rust: block: use `kernel::{fmt,prelude::fmt!}`
rust: device: use `kernel::{fmt,prelude::fmt!}`
rust: file: use `kernel::{fmt,prelude::fmt!}`
rust: kunit: use `kernel::{fmt,prelude::fmt!}`
rust: pin-init: use `kernel::{fmt,prelude::fmt!}`
rust: seq_file: use `kernel::{fmt,prelude::fmt!}`
rust: sync: use `kernel::{fmt,prelude::fmt!}`
drivers/block/rnull.rs | 2 +-
drivers/gpu/nova-core/gpu.rs | 3 +--
drivers/gpu/nova-core/regs/macros.rs | 6 +++---
rust/kernel/alloc/kbox.rs | 2 +-
rust/kernel/alloc/kvec.rs | 2 +-
rust/kernel/alloc/kvec/errors.rs | 2 +-
rust/kernel/block/mq.rs | 2 +-
rust/kernel/block/mq/gen_disk.rs | 2 +-
rust/kernel/block/mq/raw_writer.rs | 3 +--
rust/kernel/device.rs | 6 +++---
rust/kernel/fs/file.rs | 5 +++--
rust/kernel/init.rs | 4 ++--
rust/kernel/kunit.rs | 8 ++++----
rust/kernel/seq_file.rs | 6 +++---
rust/kernel/sync/arc.rs | 3 +--
scripts/rustdoc_test_gen.rs | 2 +-
16 files changed, 28 insertions(+), 30 deletions(-)
---
base-commit: 769e324b66b0d92d04f315d0c45a0f72737c7494
change-id: 20250709-core-cstr-fanout-1-f20611832272
prerequisite-change-id: 20250704-core-cstr-prepare-9b9e6a7bd57e:v1
prerequisite-patch-id: 83b1239d1805f206711a5a936bbb61c83227d573
prerequisite-patch-id: a0355dd0efcc945b0565dc4e5a0f42b5a3d29c7e
prerequisite-patch-id: 8585bf441cfab705181f5606c63483c2e88d25aa
prerequisite-patch-id: 04ec344c0bc23f90dbeac10afe26df1a86ce53ec
prerequisite-patch-id: a2fc6cd05fce6d6da8d401e9f8a905bb5c0b2f27
prerequisite-patch-id: f14c099c87562069f25fb7aea6d9aae4086c49a8
Best regards,
--
Tamir Duberstein <tamird@gmail.com>
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 1/9] gpu: nova-core: use `kernel::{fmt,prelude::fmt!}`
2025-07-09 19:59 [PATCH 0/9] rust: use `kernel::{fmt,prelude::fmt!}` Tamir Duberstein
@ 2025-07-09 20:00 ` Tamir Duberstein
2025-07-09 20:00 ` [PATCH 2/9] rust: alloc: " Tamir Duberstein
` (9 subsequent siblings)
10 siblings, 0 replies; 18+ messages in thread
From: Tamir Duberstein @ 2025-07-09 20:00 UTC (permalink / raw)
To: Danilo Krummrich, David Airlie, Simona Vetter, Miguel Ojeda,
Alex Gaynor, Boqun Feng, Gary Guo, Björn Roy Baron,
Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
Jens Axboe, Greg Kroah-Hartman, Rafael J. Wysocki,
Brendan Higgins, David Gow, Rae Moar
Cc: nouveau, dri-devel, linux-kernel, rust-for-linux, linux-block,
linux-kselftest, kunit-dev, Tamir Duberstein
Reduce coupling to implementation details of the formatting machinery by
avoiding direct use for `core`'s formatting traits and macros.
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Signed-off-by: Tamir Duberstein <tamird@gmail.com>
---
drivers/gpu/nova-core/gpu.rs | 3 +--
drivers/gpu/nova-core/regs/macros.rs | 6 +++---
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/nova-core/gpu.rs b/drivers/gpu/nova-core/gpu.rs
index 60b86f370284..f1d72da7fddd 100644
--- a/drivers/gpu/nova-core/gpu.rs
+++ b/drivers/gpu/nova-core/gpu.rs
@@ -1,12 +1,11 @@
// SPDX-License-Identifier: GPL-2.0
-use kernel::{device, devres::Devres, error::code::*, pci, prelude::*};
+use kernel::{device, devres::Devres, error::code::*, fmt, pci, prelude::*};
use crate::driver::Bar0;
use crate::firmware::{Firmware, FIRMWARE_VERSION};
use crate::regs;
use crate::util;
-use core::fmt;
macro_rules! define_chipset {
({ $($variant:ident = $value:expr),* $(,)* }) =>
diff --git a/drivers/gpu/nova-core/regs/macros.rs b/drivers/gpu/nova-core/regs/macros.rs
index 6851af8b5885..759773a19480 100644
--- a/drivers/gpu/nova-core/regs/macros.rs
+++ b/drivers/gpu/nova-core/regs/macros.rs
@@ -106,10 +106,10 @@ macro_rules! register {
// TODO: display the raw hex value, then the value of all the fields. This requires
// matching the fields, which will complexify the syntax considerably...
- impl ::core::fmt::Debug for $name {
- fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
+ impl ::kernel::fmt::Debug for $name {
+ fn fmt(&self, f: &mut ::kernel::fmt::Formatter<'_>) -> ::kernel::fmt::Result {
f.debug_tuple(stringify!($name))
- .field(&format_args!("0x{0:x}", &self.0))
+ .field(&::kernel::prelude::fmt!("0x{0:x}", &self.0))
.finish()
}
}
--
2.50.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 2/9] rust: alloc: use `kernel::{fmt,prelude::fmt!}`
2025-07-09 19:59 [PATCH 0/9] rust: use `kernel::{fmt,prelude::fmt!}` Tamir Duberstein
2025-07-09 20:00 ` [PATCH 1/9] gpu: nova-core: " Tamir Duberstein
@ 2025-07-09 20:00 ` Tamir Duberstein
2025-07-09 20:00 ` [PATCH 3/9] rust: block: " Tamir Duberstein
` (8 subsequent siblings)
10 siblings, 0 replies; 18+ messages in thread
From: Tamir Duberstein @ 2025-07-09 20:00 UTC (permalink / raw)
To: Danilo Krummrich, David Airlie, Simona Vetter, Miguel Ojeda,
Alex Gaynor, Boqun Feng, Gary Guo, Björn Roy Baron,
Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
Jens Axboe, Greg Kroah-Hartman, Rafael J. Wysocki,
Brendan Higgins, David Gow, Rae Moar
Cc: nouveau, dri-devel, linux-kernel, rust-for-linux, linux-block,
linux-kselftest, kunit-dev, Tamir Duberstein
Reduce coupling to implementation details of the formatting machinery by
avoiding direct use for `core`'s formatting traits and macros.
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Signed-off-by: Tamir Duberstein <tamird@gmail.com>
---
rust/kernel/alloc/kbox.rs | 2 +-
rust/kernel/alloc/kvec.rs | 2 +-
rust/kernel/alloc/kvec/errors.rs | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/rust/kernel/alloc/kbox.rs b/rust/kernel/alloc/kbox.rs
index ccf1df7da96c..96db3cf8d782 100644
--- a/rust/kernel/alloc/kbox.rs
+++ b/rust/kernel/alloc/kbox.rs
@@ -7,7 +7,6 @@
use super::{AllocError, Allocator, Flags};
use core::alloc::Layout;
use core::borrow::{Borrow, BorrowMut};
-use core::fmt;
use core::marker::PhantomData;
use core::mem::ManuallyDrop;
use core::mem::MaybeUninit;
@@ -16,6 +15,7 @@
use core::ptr::NonNull;
use core::result::Result;
+use crate::fmt;
use crate::init::InPlaceInit;
use crate::types::ForeignOwnable;
use pin_init::{InPlaceWrite, Init, PinInit, ZeroableOption};
diff --git a/rust/kernel/alloc/kvec.rs b/rust/kernel/alloc/kvec.rs
index 0477041cbc03..a642bdc9cea2 100644
--- a/rust/kernel/alloc/kvec.rs
+++ b/rust/kernel/alloc/kvec.rs
@@ -7,8 +7,8 @@
layout::ArrayLayout,
AllocError, Allocator, Box, Flags,
};
+use crate::fmt;
use core::{
- fmt,
marker::PhantomData,
mem::{ManuallyDrop, MaybeUninit},
ops::Deref,
diff --git a/rust/kernel/alloc/kvec/errors.rs b/rust/kernel/alloc/kvec/errors.rs
index 348b8d27e102..21a920a4b09b 100644
--- a/rust/kernel/alloc/kvec/errors.rs
+++ b/rust/kernel/alloc/kvec/errors.rs
@@ -2,7 +2,7 @@
//! Errors for the [`Vec`] type.
-use core::fmt::{self, Debug, Formatter};
+use kernel::fmt::{self, Debug, Formatter};
use kernel::prelude::*;
/// Error type for [`Vec::push_within_capacity`].
--
2.50.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 3/9] rust: block: use `kernel::{fmt,prelude::fmt!}`
2025-07-09 19:59 [PATCH 0/9] rust: use `kernel::{fmt,prelude::fmt!}` Tamir Duberstein
2025-07-09 20:00 ` [PATCH 1/9] gpu: nova-core: " Tamir Duberstein
2025-07-09 20:00 ` [PATCH 2/9] rust: alloc: " Tamir Duberstein
@ 2025-07-09 20:00 ` Tamir Duberstein
2025-07-09 20:00 ` [PATCH 4/9] rust: device: " Tamir Duberstein
` (7 subsequent siblings)
10 siblings, 0 replies; 18+ messages in thread
From: Tamir Duberstein @ 2025-07-09 20:00 UTC (permalink / raw)
To: Danilo Krummrich, David Airlie, Simona Vetter, Miguel Ojeda,
Alex Gaynor, Boqun Feng, Gary Guo, Björn Roy Baron,
Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
Jens Axboe, Greg Kroah-Hartman, Rafael J. Wysocki,
Brendan Higgins, David Gow, Rae Moar
Cc: nouveau, dri-devel, linux-kernel, rust-for-linux, linux-block,
linux-kselftest, kunit-dev, Tamir Duberstein
Reduce coupling to implementation details of the formatting machinery by
avoiding direct use for `core`'s formatting traits and macros.
Suggested-by: Alice Ryhl <aliceryhl@google.com>
Link: https://rust-for-linux.zulipchat.com/#narrow/channel/288089-General/topic/Custom.20formatting/with/516476467
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/block/mq.rs | 2 +-
rust/kernel/block/mq/gen_disk.rs | 2 +-
rust/kernel/block/mq/raw_writer.rs | 3 +--
4 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/block/rnull.rs b/drivers/block/rnull.rs
index d07e76ae2c13..6366da12c5a5 100644
--- a/drivers/block/rnull.rs
+++ b/drivers/block/rnull.rs
@@ -51,7 +51,7 @@ fn init(_module: &'static ThisModule) -> impl PinInit<Self, Error> {
.logical_block_size(4096)?
.physical_block_size(4096)?
.rotational(false)
- .build(format_args!("rnullb{}", 0), tagset)
+ .build(fmt!("rnullb{}", 0), tagset)
})();
try_pin_init!(Self {
diff --git a/rust/kernel/block/mq.rs b/rust/kernel/block/mq.rs
index 831445d37181..61ea35bba7d5 100644
--- a/rust/kernel/block/mq.rs
+++ b/rust/kernel/block/mq.rs
@@ -82,7 +82,7 @@
//! Arc::pin_init(TagSet::new(1, 256, 1), flags::GFP_KERNEL)?;
//! let mut disk = gen_disk::GenDiskBuilder::new()
//! .capacity_sectors(4096)
-//! .build(format_args!("myblk"), tagset)?;
+//! .build(fmt!("myblk"), tagset)?;
//!
//! # Ok::<(), kernel::error::Error>(())
//! ```
diff --git a/rust/kernel/block/mq/gen_disk.rs b/rust/kernel/block/mq/gen_disk.rs
index cd54cd64ea88..494c95623b97 100644
--- a/rust/kernel/block/mq/gen_disk.rs
+++ b/rust/kernel/block/mq/gen_disk.rs
@@ -6,9 +6,9 @@
//! C header: [`include/linux/blk_mq.h`](srctree/include/linux/blk_mq.h)
use crate::block::mq::{raw_writer::RawWriter, Operations, TagSet};
+use crate::fmt::{self, Write};
use crate::{bindings, error::from_err_ptr, error::Result, sync::Arc};
use crate::{error, static_lock_class};
-use core::fmt::{self, Write};
/// A builder for [`GenDisk`].
///
diff --git a/rust/kernel/block/mq/raw_writer.rs b/rust/kernel/block/mq/raw_writer.rs
index 7e2159e4f6a6..d311e24e2595 100644
--- a/rust/kernel/block/mq/raw_writer.rs
+++ b/rust/kernel/block/mq/raw_writer.rs
@@ -1,8 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
-use core::fmt::{self, Write};
-
use crate::error::Result;
+use crate::fmt::{self, Write};
use crate::prelude::EINVAL;
/// A mutable reference to a byte buffer where a string can be written into.
--
2.50.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 4/9] rust: device: use `kernel::{fmt,prelude::fmt!}`
2025-07-09 19:59 [PATCH 0/9] rust: use `kernel::{fmt,prelude::fmt!}` Tamir Duberstein
` (2 preceding siblings ...)
2025-07-09 20:00 ` [PATCH 3/9] rust: block: " Tamir Duberstein
@ 2025-07-09 20:00 ` Tamir Duberstein
2025-07-09 20:00 ` [PATCH 5/9] rust: file: " Tamir Duberstein
` (6 subsequent siblings)
10 siblings, 0 replies; 18+ messages in thread
From: Tamir Duberstein @ 2025-07-09 20:00 UTC (permalink / raw)
To: Danilo Krummrich, David Airlie, Simona Vetter, Miguel Ojeda,
Alex Gaynor, Boqun Feng, Gary Guo, Björn Roy Baron,
Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
Jens Axboe, Greg Kroah-Hartman, Rafael J. Wysocki,
Brendan Higgins, David Gow, Rae Moar
Cc: nouveau, dri-devel, linux-kernel, rust-for-linux, linux-block,
linux-kselftest, kunit-dev, Tamir Duberstein
Reduce coupling to implementation details of the formatting machinery by
avoiding direct use for `core`'s formatting traits and macros.
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Signed-off-by: Tamir Duberstein <tamird@gmail.com>
---
rust/kernel/device.rs | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/rust/kernel/device.rs b/rust/kernel/device.rs
index 5c946af3a4d5..9e9ecdb1beec 100644
--- a/rust/kernel/device.rs
+++ b/rust/kernel/device.rs
@@ -5,11 +5,11 @@
//! C header: [`include/linux/device.h`](srctree/include/linux/device.h)
use crate::{
- bindings,
+ bindings, fmt,
str::CStr,
types::{ARef, Opaque},
};
-use core::{fmt, marker::PhantomData, ptr};
+use core::{marker::PhantomData, ptr};
#[cfg(CONFIG_PRINTK)]
use crate::c_str;
@@ -345,7 +345,7 @@ macro_rules! impl_device_context_into_aref {
macro_rules! dev_printk {
($method:ident, $dev:expr, $($f:tt)*) => {
{
- ($dev).$method(::core::format_args!($($f)*));
+ ($dev).$method($crate::prelude::fmt!($($f)*));
}
}
}
--
2.50.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 5/9] rust: file: use `kernel::{fmt,prelude::fmt!}`
2025-07-09 19:59 [PATCH 0/9] rust: use `kernel::{fmt,prelude::fmt!}` Tamir Duberstein
` (3 preceding siblings ...)
2025-07-09 20:00 ` [PATCH 4/9] rust: device: " Tamir Duberstein
@ 2025-07-09 20:00 ` Tamir Duberstein
2025-07-09 20:00 ` [PATCH 6/9] rust: kunit: " Tamir Duberstein
` (5 subsequent siblings)
10 siblings, 0 replies; 18+ messages in thread
From: Tamir Duberstein @ 2025-07-09 20:00 UTC (permalink / raw)
To: Danilo Krummrich, David Airlie, Simona Vetter, Miguel Ojeda,
Alex Gaynor, Boqun Feng, Gary Guo, Björn Roy Baron,
Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
Jens Axboe, Greg Kroah-Hartman, Rafael J. Wysocki,
Brendan Higgins, David Gow, Rae Moar
Cc: nouveau, dri-devel, linux-kernel, rust-for-linux, linux-block,
linux-kselftest, kunit-dev, Tamir Duberstein
Reduce coupling to implementation details of the formatting machinery by
avoiding direct use for `core`'s formatting traits and macros.
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Signed-off-by: Tamir Duberstein <tamird@gmail.com>
---
rust/kernel/fs/file.rs | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/rust/kernel/fs/file.rs b/rust/kernel/fs/file.rs
index 35fd5db35c46..67a3654f0fd3 100644
--- a/rust/kernel/fs/file.rs
+++ b/rust/kernel/fs/file.rs
@@ -11,6 +11,7 @@
bindings,
cred::Credential,
error::{code::*, Error, Result},
+ fmt,
types::{ARef, AlwaysRefCounted, NotThreadSafe, Opaque},
};
use core::ptr;
@@ -460,8 +461,8 @@ fn from(_: BadFdError) -> Error {
}
}
-impl core::fmt::Debug for BadFdError {
- fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
+impl fmt::Debug for BadFdError {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("EBADF")
}
}
--
2.50.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 6/9] rust: kunit: use `kernel::{fmt,prelude::fmt!}`
2025-07-09 19:59 [PATCH 0/9] rust: use `kernel::{fmt,prelude::fmt!}` Tamir Duberstein
` (4 preceding siblings ...)
2025-07-09 20:00 ` [PATCH 5/9] rust: file: " Tamir Duberstein
@ 2025-07-09 20:00 ` Tamir Duberstein
2025-07-09 20:00 ` [PATCH 7/9] rust: pin-init: " Tamir Duberstein
` (4 subsequent siblings)
10 siblings, 0 replies; 18+ messages in thread
From: Tamir Duberstein @ 2025-07-09 20:00 UTC (permalink / raw)
To: Danilo Krummrich, David Airlie, Simona Vetter, Miguel Ojeda,
Alex Gaynor, Boqun Feng, Gary Guo, Björn Roy Baron,
Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
Jens Axboe, Greg Kroah-Hartman, Rafael J. Wysocki,
Brendan Higgins, David Gow, Rae Moar
Cc: nouveau, dri-devel, linux-kernel, rust-for-linux, linux-block,
linux-kselftest, kunit-dev, Tamir Duberstein
Reduce coupling to implementation details of the formatting machinery by
avoiding direct use for `core`'s formatting traits and macros.
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Signed-off-by: Tamir Duberstein <tamird@gmail.com>
---
rust/kernel/kunit.rs | 8 ++++----
scripts/rustdoc_test_gen.rs | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/rust/kernel/kunit.rs b/rust/kernel/kunit.rs
index 099a61bbb8f4..42498cb93f33 100644
--- a/rust/kernel/kunit.rs
+++ b/rust/kernel/kunit.rs
@@ -6,8 +6,8 @@
//!
//! Reference: <https://docs.kernel.org/dev-tools/kunit/index.html>
+use crate::fmt;
use crate::prelude::*;
-use core::fmt;
#[cfg(CONFIG_PRINTK)]
use crate::c_str;
@@ -74,14 +74,14 @@ macro_rules! kunit_assert {
// mistake (it is hidden to prevent that).
//
// This mimics KUnit's failed assertion format.
- $crate::kunit::err(format_args!(
+ $crate::kunit::err($crate::prelude::fmt!(
" # {}: ASSERTION FAILED at {FILE}:{LINE}\n",
$name
));
- $crate::kunit::err(format_args!(
+ $crate::kunit::err($crate::prelude::fmt!(
" Expected {CONDITION} to be true, but is false\n"
));
- $crate::kunit::err(format_args!(
+ $crate::kunit::err($crate::prelude::fmt!(
" Failure not reported to KUnit since this is a non-KUnit task\n"
));
break 'out;
diff --git a/scripts/rustdoc_test_gen.rs b/scripts/rustdoc_test_gen.rs
index 1ca253594d38..507d36875196 100644
--- a/scripts/rustdoc_test_gen.rs
+++ b/scripts/rustdoc_test_gen.rs
@@ -201,7 +201,7 @@ macro_rules! assert_eq {{
// This follows the syntax for declaring test metadata in the proposed KTAP v2 spec, which may
// be used for the proposed KUnit test attributes API. Thus hopefully this will make migration
// easier later on.
- ::kernel::kunit::info(format_args!(" # {kunit_name}.location: {real_path}:{line}\n"));
+ ::kernel::kunit::info(fmt!(" # {kunit_name}.location: {real_path}:{line}\n"));
/// The anchor where the test code body starts.
#[allow(unused)]
--
2.50.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 7/9] rust: pin-init: use `kernel::{fmt,prelude::fmt!}`
2025-07-09 19:59 [PATCH 0/9] rust: use `kernel::{fmt,prelude::fmt!}` Tamir Duberstein
` (5 preceding siblings ...)
2025-07-09 20:00 ` [PATCH 6/9] rust: kunit: " Tamir Duberstein
@ 2025-07-09 20:00 ` Tamir Duberstein
2025-07-09 20:18 ` Benno Lossin
2025-07-09 20:00 ` [PATCH 8/9] rust: seq_file: " Tamir Duberstein
` (3 subsequent siblings)
10 siblings, 1 reply; 18+ messages in thread
From: Tamir Duberstein @ 2025-07-09 20:00 UTC (permalink / raw)
To: Danilo Krummrich, David Airlie, Simona Vetter, Miguel Ojeda,
Alex Gaynor, Boqun Feng, Gary Guo, Björn Roy Baron,
Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
Jens Axboe, Greg Kroah-Hartman, Rafael J. Wysocki,
Brendan Higgins, David Gow, Rae Moar
Cc: nouveau, dri-devel, linux-kernel, rust-for-linux, linux-block,
linux-kselftest, kunit-dev, Tamir Duberstein
Reduce coupling to implementation details of the formatting machinery by
avoiding direct use for `core`'s formatting traits and macros.
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Signed-off-by: Tamir Duberstein <tamird@gmail.com>
---
rust/kernel/init.rs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/rust/kernel/init.rs b/rust/kernel/init.rs
index 8d228c237954..aa3fc90d32d1 100644
--- a/rust/kernel/init.rs
+++ b/rust/kernel/init.rs
@@ -68,7 +68,7 @@
//!
//! ```rust,ignore
//! # #![allow(unreachable_pub, clippy::disallowed_names)]
-//! use kernel::{prelude::*, types::Opaque};
+//! use kernel::{fmt, prelude::*, types::Opaque};
//! use core::{ptr::addr_of_mut, marker::PhantomPinned, pin::Pin};
//! # mod bindings {
//! # #![allow(non_camel_case_types)]
@@ -81,7 +81,7 @@
//! # trait FromErrno {
//! # fn from_errno(errno: core::ffi::c_int) -> Error {
//! # // Dummy error that can be constructed outside the `kernel` crate.
-//! # Error::from(core::fmt::Error)
+//! # Error::from(fmt::Error)
//! # }
//! # }
//! # impl FromErrno for Error {}
--
2.50.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 8/9] rust: seq_file: use `kernel::{fmt,prelude::fmt!}`
2025-07-09 19:59 [PATCH 0/9] rust: use `kernel::{fmt,prelude::fmt!}` Tamir Duberstein
` (6 preceding siblings ...)
2025-07-09 20:00 ` [PATCH 7/9] rust: pin-init: " Tamir Duberstein
@ 2025-07-09 20:00 ` Tamir Duberstein
2025-07-14 21:08 ` Tamir Duberstein
2025-07-09 20:00 ` [PATCH 9/9] rust: sync: " Tamir Duberstein
` (2 subsequent siblings)
10 siblings, 1 reply; 18+ messages in thread
From: Tamir Duberstein @ 2025-07-09 20:00 UTC (permalink / raw)
To: Danilo Krummrich, David Airlie, Simona Vetter, Miguel Ojeda,
Alex Gaynor, Boqun Feng, Gary Guo, Björn Roy Baron,
Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
Jens Axboe, Greg Kroah-Hartman, Rafael J. Wysocki,
Brendan Higgins, David Gow, Rae Moar
Cc: nouveau, dri-devel, linux-kernel, rust-for-linux, linux-block,
linux-kselftest, kunit-dev, Tamir Duberstein
Reduce coupling to implementation details of the formatting machinery by
avoiding direct use for `core`'s formatting traits and macros.
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Signed-off-by: Tamir Duberstein <tamird@gmail.com>
---
rust/kernel/seq_file.rs | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/rust/kernel/seq_file.rs b/rust/kernel/seq_file.rs
index 8f199b1a3bb1..59fbfc2473f8 100644
--- a/rust/kernel/seq_file.rs
+++ b/rust/kernel/seq_file.rs
@@ -4,7 +4,7 @@
//!
//! C header: [`include/linux/seq_file.h`](srctree/include/linux/seq_file.h)
-use crate::{bindings, c_str, types::NotThreadSafe, types::Opaque};
+use crate::{bindings, c_str, fmt, types::NotThreadSafe, types::Opaque};
/// A utility for generating the contents of a seq file.
#[repr(transparent)]
@@ -31,7 +31,7 @@ pub unsafe fn from_raw<'a>(ptr: *mut bindings::seq_file) -> &'a SeqFile {
/// Used by the [`seq_print`] macro.
#[inline]
- pub fn call_printf(&self, args: core::fmt::Arguments<'_>) {
+ pub fn call_printf(&self, args: fmt::Arguments<'_>) {
// SAFETY: Passing a void pointer to `Arguments` is valid for `%pA`.
unsafe {
bindings::seq_printf(
@@ -47,7 +47,7 @@ pub fn call_printf(&self, args: core::fmt::Arguments<'_>) {
#[macro_export]
macro_rules! seq_print {
($m:expr, $($arg:tt)+) => (
- $m.call_printf(format_args!($($arg)+))
+ $m.call_printf($crate::prelude::fmt!($($arg)+))
);
}
pub use seq_print;
--
2.50.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 9/9] rust: sync: use `kernel::{fmt,prelude::fmt!}`
2025-07-09 19:59 [PATCH 0/9] rust: use `kernel::{fmt,prelude::fmt!}` Tamir Duberstein
` (7 preceding siblings ...)
2025-07-09 20:00 ` [PATCH 8/9] rust: seq_file: " Tamir Duberstein
@ 2025-07-09 20:00 ` Tamir Duberstein
2025-07-12 8:27 ` [PATCH 0/9] rust: " Benno Lossin
2025-07-14 11:16 ` Danilo Krummrich
10 siblings, 0 replies; 18+ messages in thread
From: Tamir Duberstein @ 2025-07-09 20:00 UTC (permalink / raw)
To: Danilo Krummrich, David Airlie, Simona Vetter, Miguel Ojeda,
Alex Gaynor, Boqun Feng, Gary Guo, Björn Roy Baron,
Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
Jens Axboe, Greg Kroah-Hartman, Rafael J. Wysocki,
Brendan Higgins, David Gow, Rae Moar
Cc: nouveau, dri-devel, linux-kernel, rust-for-linux, linux-block,
linux-kselftest, kunit-dev, Tamir Duberstein
Reduce coupling to implementation details of the formatting machinery by
avoiding direct use for `core`'s formatting traits and macros.
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Signed-off-by: Tamir Duberstein <tamird@gmail.com>
---
rust/kernel/sync/arc.rs | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/rust/kernel/sync/arc.rs b/rust/kernel/sync/arc.rs
index c7af0aa48a0a..b366260f56b3 100644
--- a/rust/kernel/sync/arc.rs
+++ b/rust/kernel/sync/arc.rs
@@ -18,14 +18,13 @@
use crate::{
alloc::{AllocError, Flags, KBox},
- bindings,
+ bindings, fmt,
init::InPlaceInit,
try_init,
types::{ForeignOwnable, Opaque},
};
use core::{
alloc::Layout,
- fmt,
marker::PhantomData,
mem::{ManuallyDrop, MaybeUninit},
ops::{Deref, DerefMut},
--
2.50.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [PATCH 7/9] rust: pin-init: use `kernel::{fmt,prelude::fmt!}`
2025-07-09 20:00 ` [PATCH 7/9] rust: pin-init: " Tamir Duberstein
@ 2025-07-09 20:18 ` Benno Lossin
2025-07-09 21:01 ` Tamir Duberstein
0 siblings, 1 reply; 18+ messages in thread
From: Benno Lossin @ 2025-07-09 20:18 UTC (permalink / raw)
To: Tamir Duberstein, Danilo Krummrich, David Airlie, Simona Vetter,
Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
Björn Roy Baron, Andreas Hindborg, Alice Ryhl, Trevor Gross,
Jens Axboe, Greg Kroah-Hartman, Rafael J. Wysocki,
Brendan Higgins, David Gow, Rae Moar
Cc: nouveau, dri-devel, linux-kernel, rust-for-linux, linux-block,
linux-kselftest, kunit-dev
On Wed Jul 9, 2025 at 10:00 PM CEST, Tamir Duberstein wrote:
> Reduce coupling to implementation details of the formatting machinery by
> avoiding direct use for `core`'s formatting traits and macros.
>
> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Reviewed-by: Alice Ryhl <aliceryhl@google.com>
> Signed-off-by: Tamir Duberstein <tamird@gmail.com>
> ---
> rust/kernel/init.rs | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
I usually prefix patches to init.rs with `rust: init`. I'll fix it up
when picking the patch or Miguel can do it if he takes it:
Acked-by: Benno Lossin <lossin@kernel.org>
---
Cheers,
Benno
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 7/9] rust: pin-init: use `kernel::{fmt,prelude::fmt!}`
2025-07-09 20:18 ` Benno Lossin
@ 2025-07-09 21:01 ` Tamir Duberstein
2025-07-09 21:58 ` Benno Lossin
0 siblings, 1 reply; 18+ messages in thread
From: Tamir Duberstein @ 2025-07-09 21:01 UTC (permalink / raw)
To: Benno Lossin
Cc: Danilo Krummrich, David Airlie, Simona Vetter, Miguel Ojeda,
Alex Gaynor, Boqun Feng, Gary Guo, Björn Roy Baron,
Andreas Hindborg, Alice Ryhl, Trevor Gross, Jens Axboe,
Greg Kroah-Hartman, Rafael J. Wysocki, Brendan Higgins, David Gow,
Rae Moar, nouveau, dri-devel, linux-kernel, rust-for-linux,
linux-block, linux-kselftest, kunit-dev
On Wed, Jul 9, 2025 at 4:18 PM Benno Lossin <lossin@kernel.org> wrote:
>
> On Wed Jul 9, 2025 at 10:00 PM CEST, Tamir Duberstein wrote:
> > Reduce coupling to implementation details of the formatting machinery by
> > avoiding direct use for `core`'s formatting traits and macros.
> >
> > Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > Reviewed-by: Alice Ryhl <aliceryhl@google.com>
> > Signed-off-by: Tamir Duberstein <tamird@gmail.com>
> > ---
> > rust/kernel/init.rs | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
>
> I usually prefix patches to init.rs with `rust: init`. I'll fix it up
> when picking the patch or Miguel can do it if he takes it:
>
> Acked-by: Benno Lossin <lossin@kernel.org>
Actually, squinting at this patch more closely now, I think this isn't
what you had in mind. The comment says "Dummy error that can be
constructed outside the `kernel` crate." but the error now comes from
the kernel crate :(
Perhaps you could suggest a different modification that would both
meet the original intent and allow references to core::fmt to
disappear?
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 7/9] rust: pin-init: use `kernel::{fmt,prelude::fmt!}`
2025-07-09 21:01 ` Tamir Duberstein
@ 2025-07-09 21:58 ` Benno Lossin
2025-07-09 22:36 ` Tamir Duberstein
0 siblings, 1 reply; 18+ messages in thread
From: Benno Lossin @ 2025-07-09 21:58 UTC (permalink / raw)
To: Tamir Duberstein
Cc: Danilo Krummrich, David Airlie, Simona Vetter, Miguel Ojeda,
Alex Gaynor, Boqun Feng, Gary Guo, Björn Roy Baron,
Andreas Hindborg, Alice Ryhl, Trevor Gross, Jens Axboe,
Greg Kroah-Hartman, Rafael J. Wysocki, Brendan Higgins, David Gow,
Rae Moar, nouveau, dri-devel, linux-kernel, rust-for-linux,
linux-block, linux-kselftest, kunit-dev
On Wed Jul 9, 2025 at 11:01 PM CEST, Tamir Duberstein wrote:
> On Wed, Jul 9, 2025 at 4:18 PM Benno Lossin <lossin@kernel.org> wrote:
>>
>> On Wed Jul 9, 2025 at 10:00 PM CEST, Tamir Duberstein wrote:
>> > Reduce coupling to implementation details of the formatting machinery by
>> > avoiding direct use for `core`'s formatting traits and macros.
>> >
>> > Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>> > Reviewed-by: Alice Ryhl <aliceryhl@google.com>
>> > Signed-off-by: Tamir Duberstein <tamird@gmail.com>
>> > ---
>> > rust/kernel/init.rs | 4 ++--
>> > 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> I usually prefix patches to init.rs with `rust: init`. I'll fix it up
>> when picking the patch or Miguel can do it if he takes it:
>>
>> Acked-by: Benno Lossin <lossin@kernel.org>
>
> Actually, squinting at this patch more closely now, I think this isn't
> what you had in mind. The comment says "Dummy error that can be
> constructed outside the `kernel` crate." but the error now comes from
> the kernel crate :(
It's a re-export, so the comment still holds.
> Perhaps you could suggest a different modification that would both
> meet the original intent and allow references to core::fmt to
> disappear?
The code comes from a time when `Error::from_errno` was `pub(crate)`,
but that was changed some time ago... Now we can just remove the
`FromErrno` trait entirely from that example. Feel free to do that in
this series or as a standalone patch.
---
Cheers,
Benno
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 7/9] rust: pin-init: use `kernel::{fmt,prelude::fmt!}`
2025-07-09 21:58 ` Benno Lossin
@ 2025-07-09 22:36 ` Tamir Duberstein
2025-07-09 22:50 ` Tamir Duberstein
0 siblings, 1 reply; 18+ messages in thread
From: Tamir Duberstein @ 2025-07-09 22:36 UTC (permalink / raw)
To: Benno Lossin
Cc: Danilo Krummrich, David Airlie, Simona Vetter, Miguel Ojeda,
Alex Gaynor, Boqun Feng, Gary Guo, Björn Roy Baron,
Andreas Hindborg, Alice Ryhl, Trevor Gross, Jens Axboe,
Greg Kroah-Hartman, Rafael J. Wysocki, Brendan Higgins, David Gow,
Rae Moar, nouveau, dri-devel, linux-kernel, rust-for-linux,
linux-block, linux-kselftest, kunit-dev
On Wed, Jul 9, 2025 at 5:58 PM Benno Lossin <lossin@kernel.org> wrote:
>
> On Wed Jul 9, 2025 at 11:01 PM CEST, Tamir Duberstein wrote:
> > On Wed, Jul 9, 2025 at 4:18 PM Benno Lossin <lossin@kernel.org> wrote:
> >>
> >> On Wed Jul 9, 2025 at 10:00 PM CEST, Tamir Duberstein wrote:
> >> > Reduce coupling to implementation details of the formatting machinery by
> >> > avoiding direct use for `core`'s formatting traits and macros.
> >> >
> >> > Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> >> > Reviewed-by: Alice Ryhl <aliceryhl@google.com>
> >> > Signed-off-by: Tamir Duberstein <tamird@gmail.com>
> >> > ---
> >> > rust/kernel/init.rs | 4 ++--
> >> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >>
> >> I usually prefix patches to init.rs with `rust: init`. I'll fix it up
> >> when picking the patch or Miguel can do it if he takes it:
> >>
> >> Acked-by: Benno Lossin <lossin@kernel.org>
> >
> > Actually, squinting at this patch more closely now, I think this isn't
> > what you had in mind. The comment says "Dummy error that can be
> > constructed outside the `kernel` crate." but the error now comes from
> > the kernel crate :(
>
> It's a re-export, so the comment still holds.
>
> > Perhaps you could suggest a different modification that would both
> > meet the original intent and allow references to core::fmt to
> > disappear?
>
> The code comes from a time when `Error::from_errno` was `pub(crate)`,
> but that was changed some time ago... Now we can just remove the
> `FromErrno` trait entirely from that example. Feel free to do that in
> this series or as a standalone patch.
Ack, sent https://lore.kernel.org/all/20250709-init-remove-old-workaround-v1-1-a922d32338d2@gmail.com/.
With that patch, this one can be dropped (since it is just a comment).
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 7/9] rust: pin-init: use `kernel::{fmt,prelude::fmt!}`
2025-07-09 22:36 ` Tamir Duberstein
@ 2025-07-09 22:50 ` Tamir Duberstein
0 siblings, 0 replies; 18+ messages in thread
From: Tamir Duberstein @ 2025-07-09 22:50 UTC (permalink / raw)
To: Benno Lossin
Cc: Danilo Krummrich, David Airlie, Simona Vetter, Miguel Ojeda,
Alex Gaynor, Boqun Feng, Gary Guo, Björn Roy Baron,
Andreas Hindborg, Alice Ryhl, Trevor Gross, Jens Axboe,
Greg Kroah-Hartman, Rafael J. Wysocki, Brendan Higgins, David Gow,
Rae Moar, nouveau, dri-devel, linux-kernel, rust-for-linux,
linux-block, linux-kselftest, kunit-dev
On Wed, Jul 9, 2025 at 6:36 PM Tamir Duberstein <tamird@gmail.com> wrote:
>
>
> Ack, sent https://lore.kernel.org/all/20250709-init-remove-old-workaround-v1-1-a922d32338d2@gmail.com/.
Messed it up, sent v2:
https://lore.kernel.org/all/20250709-init-remove-old-workaround-v2-0-a3b1be8fd490@gmail.com/.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 0/9] rust: use `kernel::{fmt,prelude::fmt!}`
2025-07-09 19:59 [PATCH 0/9] rust: use `kernel::{fmt,prelude::fmt!}` Tamir Duberstein
` (8 preceding siblings ...)
2025-07-09 20:00 ` [PATCH 9/9] rust: sync: " Tamir Duberstein
@ 2025-07-12 8:27 ` Benno Lossin
2025-07-14 11:16 ` Danilo Krummrich
10 siblings, 0 replies; 18+ messages in thread
From: Benno Lossin @ 2025-07-12 8:27 UTC (permalink / raw)
To: Tamir Duberstein, Danilo Krummrich, David Airlie, Simona Vetter,
Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
Björn Roy Baron, Andreas Hindborg, Alice Ryhl, Trevor Gross,
Jens Axboe, Greg Kroah-Hartman, Rafael J. Wysocki,
Brendan Higgins, David Gow, Rae Moar
Cc: nouveau, dri-devel, linux-kernel, rust-for-linux, linux-block,
linux-kselftest, kunit-dev
On Wed Jul 9, 2025 at 9:59 PM CEST, Tamir Duberstein wrote:
> This is series 2a/5 of the migration to `core::ffi::CStr`[0].
> 20250704-core-cstr-prepare-v1-0-a91524037783@gmail.com.
>
> This series depends on the prior series[0] and is intended to go through
> the rust tree to reduce the number of release cycles required to
> complete the work.
>
> Subsystem maintainers: I would appreciate your `Acked-by`s so that this
> can be taken through Miguel's tree (where the other series must go).
>
> [0] https://lore.kernel.org/all/20250704-core-cstr-prepare-v1-0-a91524037783@gmail.com/
>
> Signed-off-by: Tamir Duberstein <tamird@gmail.com>
> ---
> Tamir Duberstein (9):
> gpu: nova-core: use `kernel::{fmt,prelude::fmt!}`
> rust: alloc: use `kernel::{fmt,prelude::fmt!}`
> rust: block: use `kernel::{fmt,prelude::fmt!}`
> rust: device: use `kernel::{fmt,prelude::fmt!}`
> rust: file: use `kernel::{fmt,prelude::fmt!}`
> rust: kunit: use `kernel::{fmt,prelude::fmt!}`
> rust: pin-init: use `kernel::{fmt,prelude::fmt!}`
> rust: seq_file: use `kernel::{fmt,prelude::fmt!}`
> rust: sync: use `kernel::{fmt,prelude::fmt!}`
>
> drivers/block/rnull.rs | 2 +-
> drivers/gpu/nova-core/gpu.rs | 3 +--
> drivers/gpu/nova-core/regs/macros.rs | 6 +++---
> rust/kernel/alloc/kbox.rs | 2 +-
> rust/kernel/alloc/kvec.rs | 2 +-
> rust/kernel/alloc/kvec/errors.rs | 2 +-
> rust/kernel/block/mq.rs | 2 +-
> rust/kernel/block/mq/gen_disk.rs | 2 +-
> rust/kernel/block/mq/raw_writer.rs | 3 +--
> rust/kernel/device.rs | 6 +++---
> rust/kernel/fs/file.rs | 5 +++--
> rust/kernel/init.rs | 4 ++--
> rust/kernel/kunit.rs | 8 ++++----
> rust/kernel/seq_file.rs | 6 +++---
> rust/kernel/sync/arc.rs | 3 +--
> scripts/rustdoc_test_gen.rs | 2 +-
> 16 files changed, 28 insertions(+), 30 deletions(-)
For the entire series:
Reviewed-by: Benno Lossin <lossin@kernel.org>
---
Cheers,
Benno
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 0/9] rust: use `kernel::{fmt,prelude::fmt!}`
2025-07-09 19:59 [PATCH 0/9] rust: use `kernel::{fmt,prelude::fmt!}` Tamir Duberstein
` (9 preceding siblings ...)
2025-07-12 8:27 ` [PATCH 0/9] rust: " Benno Lossin
@ 2025-07-14 11:16 ` Danilo Krummrich
10 siblings, 0 replies; 18+ messages in thread
From: Danilo Krummrich @ 2025-07-14 11:16 UTC (permalink / raw)
To: Tamir Duberstein
Cc: David Airlie, Simona Vetter, Miguel Ojeda, Alex Gaynor,
Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
Andreas Hindborg, Alice Ryhl, Trevor Gross, Jens Axboe,
Greg Kroah-Hartman, Rafael J. Wysocki, Brendan Higgins, David Gow,
Rae Moar, nouveau, dri-devel, linux-kernel, rust-for-linux,
linux-block, linux-kselftest, kunit-dev
On Wed Jul 9, 2025 at 9:59 PM CEST, Tamir Duberstein wrote:
> This is series 2a/5 of the migration to `core::ffi::CStr`[0].
> 20250704-core-cstr-prepare-v1-0-a91524037783@gmail.com.
For nova-core, alloc and device,
Acked-by: Danilo Krummrich <dakr@kernel.org>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 8/9] rust: seq_file: use `kernel::{fmt,prelude::fmt!}`
2025-07-09 20:00 ` [PATCH 8/9] rust: seq_file: " Tamir Duberstein
@ 2025-07-14 21:08 ` Tamir Duberstein
0 siblings, 0 replies; 18+ messages in thread
From: Tamir Duberstein @ 2025-07-14 21:08 UTC (permalink / raw)
To: Danilo Krummrich, David Airlie, Simona Vetter, Miguel Ojeda,
Alex Gaynor, Boqun Feng, Gary Guo, Björn Roy Baron,
Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
Jens Axboe, Greg Kroah-Hartman, Rafael J. Wysocki,
Brendan Higgins, David Gow, Rae Moar
Cc: nouveau, dri-devel, linux-kernel, rust-for-linux, linux-block,
linux-kselftest, kunit-dev, Christian Brauner
On Wed, Jul 9, 2025 at 4:00 PM Tamir Duberstein <tamird@gmail.com> wrote:
>
> Reduce coupling to implementation details of the formatting machinery by
> avoiding direct use for `core`'s formatting traits and macros.
>
> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Reviewed-by: Alice Ryhl <aliceryhl@google.com>
> Signed-off-by: Tamir Duberstein <tamird@gmail.com>
Oops, forgot to include Christian Brauner. Christian, could you please
take a look?
MAINTAINERS entry being added in
https://lore.kernel.org/all/20250714124637.1905722-1-aliceryhl@google.com/.
(Thanks Alice!)
> ---
> rust/kernel/seq_file.rs | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/rust/kernel/seq_file.rs b/rust/kernel/seq_file.rs
> index 8f199b1a3bb1..59fbfc2473f8 100644
> --- a/rust/kernel/seq_file.rs
> +++ b/rust/kernel/seq_file.rs
> @@ -4,7 +4,7 @@
> //!
> //! C header: [`include/linux/seq_file.h`](srctree/include/linux/seq_file.h)
>
> -use crate::{bindings, c_str, types::NotThreadSafe, types::Opaque};
> +use crate::{bindings, c_str, fmt, types::NotThreadSafe, types::Opaque};
>
> /// A utility for generating the contents of a seq file.
> #[repr(transparent)]
> @@ -31,7 +31,7 @@ pub unsafe fn from_raw<'a>(ptr: *mut bindings::seq_file) -> &'a SeqFile {
>
> /// Used by the [`seq_print`] macro.
> #[inline]
> - pub fn call_printf(&self, args: core::fmt::Arguments<'_>) {
> + pub fn call_printf(&self, args: fmt::Arguments<'_>) {
> // SAFETY: Passing a void pointer to `Arguments` is valid for `%pA`.
> unsafe {
> bindings::seq_printf(
> @@ -47,7 +47,7 @@ pub fn call_printf(&self, args: core::fmt::Arguments<'_>) {
> #[macro_export]
> macro_rules! seq_print {
> ($m:expr, $($arg:tt)+) => (
> - $m.call_printf(format_args!($($arg)+))
> + $m.call_printf($crate::prelude::fmt!($($arg)+))
> );
> }
> pub use seq_print;
>
> --
> 2.50.0
>
^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2025-07-14 21:09 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-09 19:59 [PATCH 0/9] rust: use `kernel::{fmt,prelude::fmt!}` Tamir Duberstein
2025-07-09 20:00 ` [PATCH 1/9] gpu: nova-core: " Tamir Duberstein
2025-07-09 20:00 ` [PATCH 2/9] rust: alloc: " Tamir Duberstein
2025-07-09 20:00 ` [PATCH 3/9] rust: block: " Tamir Duberstein
2025-07-09 20:00 ` [PATCH 4/9] rust: device: " Tamir Duberstein
2025-07-09 20:00 ` [PATCH 5/9] rust: file: " Tamir Duberstein
2025-07-09 20:00 ` [PATCH 6/9] rust: kunit: " Tamir Duberstein
2025-07-09 20:00 ` [PATCH 7/9] rust: pin-init: " Tamir Duberstein
2025-07-09 20:18 ` Benno Lossin
2025-07-09 21:01 ` Tamir Duberstein
2025-07-09 21:58 ` Benno Lossin
2025-07-09 22:36 ` Tamir Duberstein
2025-07-09 22:50 ` Tamir Duberstein
2025-07-09 20:00 ` [PATCH 8/9] rust: seq_file: " Tamir Duberstein
2025-07-14 21:08 ` Tamir Duberstein
2025-07-09 20:00 ` [PATCH 9/9] rust: sync: " Tamir Duberstein
2025-07-12 8:27 ` [PATCH 0/9] rust: " Benno Lossin
2025-07-14 11:16 ` Danilo Krummrich
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).