Skip to content

Commit

Permalink
rust: init: add missing newline to pr_info! calls
Browse files Browse the repository at this point in the history
Several pr_info! calls in rust/kernel/init.rs (both in code examples
and macro documentation) were missing a newline, causing logs to
run together. This commit updates these calls to include a trailing
newline, improving readability and consistency with the C side.

Fixes: 6841d45 ("rust: init: add `stack_pin_init!` macro")
Fixes: 7f8977a ("rust: init: add `{pin_}chain` functions to `{Pin}Init<T, E>`")
Fixes: d0fdc39 ("rust: init: add `PinnedDrop` trait and macros")
Reported-by: Miguel Ojeda <ojeda@kernel.org>
Closes: Rust-for-Linux#1139
Signed-off-by: Alban Kurti <kurti@invicto.ai>
  • Loading branch information
albankurti authored and intel-lab-lkp committed Feb 6, 2025
1 parent d84e48e commit f42db2a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions rust/kernel/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ pub mod macros;
/// },
/// }));
/// let foo: Pin<&mut Foo> = foo;
/// pr_info!("a: {}", &*foo.a.lock());
/// pr_info!("a: {}\n", &*foo.a.lock());
/// ```
///
/// # Syntax
Expand Down Expand Up @@ -319,7 +319,7 @@ macro_rules! stack_pin_init {
/// }, GFP_KERNEL)?,
/// }));
/// let foo = foo.unwrap();
/// pr_info!("a: {}", &*foo.a.lock());
/// pr_info!("a: {}\n", &*foo.a.lock());
/// ```
///
/// ```rust,ignore
Expand Down Expand Up @@ -352,7 +352,7 @@ macro_rules! stack_pin_init {
/// x: 64,
/// }, GFP_KERNEL)?,
/// }));
/// pr_info!("a: {}", &*foo.a.lock());
/// pr_info!("a: {}\n", &*foo.a.lock());
/// # Ok::<_, AllocError>(())
/// ```
///
Expand Down Expand Up @@ -882,7 +882,7 @@ pub unsafe trait PinInit<T: ?Sized, E = Infallible>: Sized {
///
/// impl Foo {
/// fn setup(self: Pin<&mut Self>) {
/// pr_info!("Setting up foo");
/// pr_info!("Setting up foo\n");
/// }
/// }
///
Expand Down Expand Up @@ -986,7 +986,7 @@ pub unsafe trait Init<T: ?Sized, E = Infallible>: PinInit<T, E> {
///
/// impl Foo {
/// fn setup(&mut self) {
/// pr_info!("Setting up foo");
/// pr_info!("Setting up foo\n");
/// }
/// }
///
Expand Down Expand Up @@ -1336,7 +1336,7 @@ impl<T> InPlaceWrite<T> for UniqueArc<MaybeUninit<T>> {
/// #[pinned_drop]
/// impl PinnedDrop for Foo {
/// fn drop(self: Pin<&mut Self>) {
/// pr_info!("Foo is being dropped!");
/// pr_info!("Foo is being dropped!\n");
/// }
/// }
/// ```
Expand Down
6 changes: 3 additions & 3 deletions rust/kernel/init/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
//! #[pinned_drop]
//! impl PinnedDrop for Foo {
//! fn drop(self: Pin<&mut Self>) {
//! pr_info!("{self:p} is getting dropped.");
//! pr_info!("{self:p} is getting dropped.\n");
//! }
//! }
//!
Expand Down Expand Up @@ -412,7 +412,7 @@
//! #[pinned_drop]
//! impl PinnedDrop for Foo {
//! fn drop(self: Pin<&mut Self>) {
//! pr_info!("{self:p} is getting dropped.");
//! pr_info!("{self:p} is getting dropped.\n");
//! }
//! }
//! ```
Expand All @@ -423,7 +423,7 @@
//! // `unsafe`, full path and the token parameter are added, everything else stays the same.
//! unsafe impl ::kernel::init::PinnedDrop for Foo {
//! fn drop(self: Pin<&mut Self>, _: ::kernel::init::__internal::OnlyCallFromDrop) {
//! pr_info!("{self:p} is getting dropped.");
//! pr_info!("{self:p} is getting dropped.\n");
//! }
//! }
//! ```
Expand Down

0 comments on commit f42db2a

Please sign in to comment.