Rust for Linux List
 help / color / mirror / Atom feed
* [PATCH v1 0/3] rust: add missing newlines in printing calls
@ 2026-08-28  1:50 Mehmet Koseoglu
  2026-08-28  1:50 ` [PATCH v1 1/3] rust: samples: add missing newlines in rust_print_main Mehmet Koseoglu
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Mehmet Koseoglu @ 2026-08-28  1:50 UTC (permalink / raw)
  To: Miguel Ojeda, Danilo Krummrich, Alice Ryhl, Daniel Almeida
  Cc: rust-for-linux, linux-kernel, driver-core, Mehmet Koseoglu

This patch series adds missing trailing newlines (`\n`) in Rust `pr_*!`
and `dev_*!` calls across sample drivers and documentation examples.

Missing newlines cause kernel log lines to not be properly terminated,
leading to unexpected concatenation of consecutive log messages.

Mehmet Koseoglu (3):
  rust: samples: add missing newlines in rust_print_main
  dma-mapping: rust: samples: add missing newline in rust_dma
  rust: io: register: add missing newline in doc example

 rust/kernel/io/register.rs      | 2 +-
 samples/rust/rust_dma.rs        | 2 +-
 samples/rust/rust_print_main.rs | 8 ++++----
 3 files changed, 6 insertions(+), 6 deletions(-)

-- 
2.55.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v1 1/3] rust: samples: add missing newlines in rust_print_main
  2026-08-28  1:50 [PATCH v1 0/3] rust: add missing newlines in printing calls Mehmet Koseoglu
@ 2026-08-28  1:50 ` Mehmet Koseoglu
  2026-08-28  6:18   ` Miguel Ojeda
  2026-08-28  1:50 ` [PATCH v1 2/3] dma-mapping: rust: samples: add missing newline in rust_dma Mehmet Koseoglu
  2026-08-28  1:50 ` [PATCH v1 3/3] rust: io: register: add missing newline in doc example Mehmet Koseoglu
  2 siblings, 1 reply; 5+ messages in thread
From: Mehmet Koseoglu @ 2026-08-28  1:50 UTC (permalink / raw)
  To: Miguel Ojeda, Danilo Krummrich, Alice Ryhl, Daniel Almeida
  Cc: rust-for-linux, linux-kernel, driver-core, Mehmet Koseoglu

Calls to `pr_info!` in `arc_print` are missing trailing newlines, which
causes consecutive messages to not be properly line-terminated.

Add the missing `\n` to all four formatting strings.

Fixes: f431c5c581fa ("samples: rust: print: Add sample code for Arc printing")
Fixes: 47cb6bf7860c ("rust: use derive(CoercePointee) on rustc >= 1.84.0")
Suggested-by: Miguel Ojeda <ojeda@kernel.org>
Link: https://github.com/Rust-for-Linux/linux/issues/1139
Signed-off-by: Mehmet Koseoglu <mehmet.mkoseoglu@gmail.com>
---
 samples/rust/rust_print_main.rs | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/samples/rust/rust_print_main.rs b/samples/rust/rust_print_main.rs
index 682207c81fc2..01729e87d6b5 100644
--- a/samples/rust/rust_print_main.rs
+++ b/samples/rust/rust_print_main.rs
@@ -23,10 +23,10 @@ fn arc_print() -> Result {
     let b = UniqueArc::new("hello, world", GFP_KERNEL)?;
 
     // Prints the value of data in `a`.
-    pr_info!("{}", a);
+    pr_info!("{}\n", a);
 
     // Uses ":?" to print debug fmt of `b`.
-    pr_info!("{:?}", b);
+    pr_info!("{:?}\n", b);
 
     let a: Arc<&str> = b.into();
     let c = a.clone();
@@ -42,7 +42,7 @@ fn arc_print() -> Result {
 
         use kernel::fmt::Display;
         fn arc_dyn_print(arc: &Arc<dyn Display>) {
-            pr_info!("Arc<dyn Display> says {arc}");
+            pr_info!("Arc<dyn Display> says {arc}\n");
         }
 
         let a_i32_display: Arc<dyn Display> = Arc::new(42i32, GFP_KERNEL)?;
@@ -53,7 +53,7 @@ fn arc_dyn_print(arc: &Arc<dyn Display>) {
     }
 
     // Pretty-prints the debug formatting with lower-case hexadecimal integers.
-    pr_info!("{:#x?}", a);
+    pr_info!("{:#x?}\n", a);
 
     Ok(())
 }
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v1 2/3] dma-mapping: rust: samples: add missing newline in rust_dma
  2026-08-28  1:50 [PATCH v1 0/3] rust: add missing newlines in printing calls Mehmet Koseoglu
  2026-08-28  1:50 ` [PATCH v1 1/3] rust: samples: add missing newlines in rust_print_main Mehmet Koseoglu
@ 2026-08-28  1:50 ` Mehmet Koseoglu
  2026-08-28  1:50 ` [PATCH v1 3/3] rust: io: register: add missing newline in doc example Mehmet Koseoglu
  2 siblings, 0 replies; 5+ messages in thread
From: Mehmet Koseoglu @ 2026-08-28  1:50 UTC (permalink / raw)
  To: Miguel Ojeda, Danilo Krummrich, Alice Ryhl, Daniel Almeida
  Cc: rust-for-linux, linux-kernel, driver-core, Mehmet Koseoglu

The `dev_info!` call iterating over scatter-gather table entries in
`DmaSampleDriver::drop` is missing a trailing newline, causing the
printed message to not be properly line-terminated.

Add the missing `\n` to the format string.

Fixes: 5444799d701c ("samples: rust: dma: add sample code for SGTable")
Suggested-by: Miguel Ojeda <ojeda@kernel.org>
Link: https://github.com/Rust-for-Linux/linux/issues/1139
Signed-off-by: Mehmet Koseoglu <mehmet.mkoseoglu@gmail.com>
---
 samples/rust/rust_dma.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/samples/rust/rust_dma.rs b/samples/rust/rust_dma.rs
index bd60034ded23..aa454e4841a7 100644
--- a/samples/rust/rust_dma.rs
+++ b/samples/rust/rust_dma.rs
@@ -125,7 +125,7 @@ fn drop(self: Pin<&mut Self>) {
         for (i, entry) in self.sgt.iter().enumerate() {
             dev_info!(
                 self.pdev,
-                "Entry[{}]: DMA address: {:#x}",
+                "Entry[{}]: DMA address: {:#x}\n",
                 i,
                 entry.dma_address(),
             );
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v1 3/3] rust: io: register: add missing newline in doc example
  2026-08-28  1:50 [PATCH v1 0/3] rust: add missing newlines in printing calls Mehmet Koseoglu
  2026-08-28  1:50 ` [PATCH v1 1/3] rust: samples: add missing newlines in rust_print_main Mehmet Koseoglu
  2026-08-28  1:50 ` [PATCH v1 2/3] dma-mapping: rust: samples: add missing newline in rust_dma Mehmet Koseoglu
@ 2026-08-28  1:50 ` Mehmet Koseoglu
  2 siblings, 0 replies; 5+ messages in thread
From: Mehmet Koseoglu @ 2026-08-28  1:50 UTC (permalink / raw)
  To: Miguel Ojeda, Danilo Krummrich, Alice Ryhl, Daniel Almeida
  Cc: rust-for-linux, linux-kernel, driver-core, Mehmet Koseoglu

The `pr_info!` call in the register module documentation code example
is missing a trailing newline.

Add the missing `\n` to the format string.

Fixes: 20ba6a1dbcb9 ("rust: io: add `register!` macro")
Link: https://github.com/Rust-for-Linux/linux/issues/1139
Signed-off-by: Mehmet Koseoglu <mehmet.mkoseoglu@gmail.com>
---
 rust/kernel/io/register.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/rust/kernel/io/register.rs b/rust/kernel/io/register.rs
index 03dfd2ff48c7..31e084a4aa9f 100644
--- a/rust/kernel/io/register.rs
+++ b/rust/kernel/io/register.rs
@@ -71,7 +71,7 @@
 //!
 //! // Read from the register's defined offset (0x100).
 //! let boot0 = io.read(BOOT_0);
-//! pr_info!("chip revision: {}.{}", boot0.major_revision().get(), boot0.minor_revision().get());
+//! pr_info!("chip revision: {}.{}\n", boot0.major_revision().get(), boot0.minor_revision().get());
 //!
 //! // Update some fields and write the new value back.
 //! let new_boot0 = boot0
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v1 1/3] rust: samples: add missing newlines in rust_print_main
  2026-08-28  1:50 ` [PATCH v1 1/3] rust: samples: add missing newlines in rust_print_main Mehmet Koseoglu
@ 2026-08-28  6:18   ` Miguel Ojeda
  0 siblings, 0 replies; 5+ messages in thread
From: Miguel Ojeda @ 2026-08-28  6:18 UTC (permalink / raw)
  To: Mehmet Koseoglu
  Cc: Miguel Ojeda, Danilo Krummrich, Alice Ryhl, Daniel Almeida,
	rust-for-linux, linux-kernel, driver-core

On Fri, Aug 28, 2026 at 3:52 AM Mehmet Koseoglu
<mehmet.mkoseoglu@gmail.com> wrote:
>
> Fixes: f431c5c581fa ("samples: rust: print: Add sample code for Arc printing")
> Fixes: 47cb6bf7860c ("rust: use derive(CoercePointee) on rustc >= 1.84.0")

Thanks!

These Fixes tags point to different set of stable releases, but we
probably don't care about backporting this, so it is not a big deal
(otherwise; we would have needed to split the patch).

Cheers,
Miguel

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-08-28  6:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-28  1:50 [PATCH v1 0/3] rust: add missing newlines in printing calls Mehmet Koseoglu
2026-08-28  1:50 ` [PATCH v1 1/3] rust: samples: add missing newlines in rust_print_main Mehmet Koseoglu
2026-08-28  6:18   ` Miguel Ojeda
2026-08-28  1:50 ` [PATCH v1 2/3] dma-mapping: rust: samples: add missing newline in rust_dma Mehmet Koseoglu
2026-08-28  1:50 ` [PATCH v1 3/3] rust: io: register: add missing newline in doc example Mehmet Koseoglu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox