rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rust: printing macros sample: add missing newlines
@ 2025-02-03 13:37 albankurti
  2025-02-03 21:38 ` Charalampos Mitrodimas
  2025-02-05 12:52 ` Miguel Ojeda
  0 siblings, 2 replies; 4+ messages in thread
From: albankurti @ 2025-02-03 13:37 UTC (permalink / raw)
  To: rust-for-linux; +Cc: ojeda

Fixes calls to pr_*! to include \n

Reported-by: ojeda <ojeda@kernel.org>
Closes: https://github.com/Rust-for-Linux/linux/issues/1139
Signed-off-by: albankurti <kurti@invicto.ai>
---
 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 7e8af5f176a3..7ef3cecc65a1 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 core::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.48.1


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

* Re: [PATCH] rust: printing macros sample: add missing newlines
  2025-02-03 13:37 [PATCH] rust: printing macros sample: add missing newlines albankurti
@ 2025-02-03 21:38 ` Charalampos Mitrodimas
  2025-02-05 12:52   ` Miguel Ojeda
  2025-02-05 12:52 ` Miguel Ojeda
  1 sibling, 1 reply; 4+ messages in thread
From: Charalampos Mitrodimas @ 2025-02-03 21:38 UTC (permalink / raw)
  To: albankurti; +Cc: rust-for-linux, ojeda

albankurti <kurti@invicto.ai> writes:

> Fixes calls to pr_*! to include \n
>
> Reported-by: ojeda <ojeda@kernel.org>
> Closes: https://github.com/Rust-for-Linux/linux/issues/1139
> Signed-off-by: albankurti <kurti@invicto.ai>
> ---
>  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 7e8af5f176a3..7ef3cecc65a1 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 core::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(())
>  }

Hi Alban,

We also have these, but not sure if we care about them, since they are
comments.

  rust/kernel/print.rs
  408:/// pr_info!("hello");

  rust/kernel/init.rs
  885:    ///         pr_info!("Setting up foo");
  989:    ///         pr_info!("Setting up foo");
  1339:///         pr_info!("Foo is being dropped!");

  rust/kernel/init/macros.rs
  48://!         pr_info!("{self:p} is getting dropped.");
  415://!         pr_info!("{self:p} is getting dropped.");
  426://!         pr_info!("{self:p} is getting dropped.");

Otherwise,
Reviewed-by: Charalampos Mitrodimas <charmitro.posteo.net>


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

* Re: [PATCH] rust: printing macros sample: add missing newlines
  2025-02-03 13:37 [PATCH] rust: printing macros sample: add missing newlines albankurti
  2025-02-03 21:38 ` Charalampos Mitrodimas
@ 2025-02-05 12:52 ` Miguel Ojeda
  1 sibling, 0 replies; 4+ messages in thread
From: Miguel Ojeda @ 2025-02-05 12:52 UTC (permalink / raw)
  To: albankurti; +Cc: rust-for-linux, ojeda

On Mon, Feb 3, 2025 at 2:37 PM albankurti <kurti@invicto.ai> wrote:
>
> Signed-off-by: albankurti <kurti@invicto.ai>

The kernel requires a "known identity" for signatures. For instance,
the name you use to sign documents in real life. Please let us know if
that is a problem -- see:

    https://docs.kernel.org/process/submitting-patches.html#developer-s-certificate-of-origin-1-1

Cheers,
Miguel

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

* Re: [PATCH] rust: printing macros sample: add missing newlines
  2025-02-03 21:38 ` Charalampos Mitrodimas
@ 2025-02-05 12:52   ` Miguel Ojeda
  0 siblings, 0 replies; 4+ messages in thread
From: Miguel Ojeda @ 2025-02-05 12:52 UTC (permalink / raw)
  To: Charalampos Mitrodimas; +Cc: albankurti, rust-for-linux, ojeda

On Mon, Feb 3, 2025 at 10:38 PM Charalampos Mitrodimas
<charmitro@posteo.net> wrote:
>
> We also have these, but not sure if we care about them, since they are
> comments.

Yeah, we care about those -- albankurti: please fix all across the
tree if possible.

Thanks!

Cheers,
Miguel

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

end of thread, other threads:[~2025-02-05 12:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-03 13:37 [PATCH] rust: printing macros sample: add missing newlines albankurti
2025-02-03 21:38 ` Charalampos Mitrodimas
2025-02-05 12:52   ` Miguel Ojeda
2025-02-05 12:52 ` Miguel Ojeda

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).