Skip to content

Commit b5bde82

Browse files
albankurtiSasha Levin
authored and
Sasha Levin
committed
rust: init: add missing newline to pr_info! calls
[ Upstream commit 6933c10 ] 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") Fixes: 4af84c6 ("rust: init: update expanded macro explanation") Reported-by: Miguel Ojeda <[email protected]> Link: Rust-for-Linux/linux#1139 Signed-off-by: Alban Kurti <[email protected]> Link: https://lore.kernel.org/r/[email protected] [ Replaced Closes with Link since it fixes part of the issue. Added one more Fixes tag (still same set of stable kernels). - Miguel ] Signed-off-by: Miguel Ojeda <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent ddb13ac commit b5bde82

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

rust/kernel/init.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ pub mod macros;
259259
/// },
260260
/// }));
261261
/// let foo: Pin<&mut Foo> = foo;
262-
/// pr_info!("a: {}", &*foo.a.lock());
262+
/// pr_info!("a: {}\n", &*foo.a.lock());
263263
/// ```
264264
///
265265
/// # Syntax
@@ -311,7 +311,7 @@ macro_rules! stack_pin_init {
311311
/// }, GFP_KERNEL)?,
312312
/// }));
313313
/// let foo = foo.unwrap();
314-
/// pr_info!("a: {}", &*foo.a.lock());
314+
/// pr_info!("a: {}\n", &*foo.a.lock());
315315
/// ```
316316
///
317317
/// ```rust,ignore
@@ -336,7 +336,7 @@ macro_rules! stack_pin_init {
336336
/// x: 64,
337337
/// }, GFP_KERNEL)?,
338338
/// }));
339-
/// pr_info!("a: {}", &*foo.a.lock());
339+
/// pr_info!("a: {}\n", &*foo.a.lock());
340340
/// # Ok::<_, AllocError>(())
341341
/// ```
342342
///
@@ -866,7 +866,7 @@ pub unsafe trait PinInit<T: ?Sized, E = Infallible>: Sized {
866866
///
867867
/// impl Foo {
868868
/// fn setup(self: Pin<&mut Self>) {
869-
/// pr_info!("Setting up foo");
869+
/// pr_info!("Setting up foo\n");
870870
/// }
871871
/// }
872872
///
@@ -970,7 +970,7 @@ pub unsafe trait Init<T: ?Sized, E = Infallible>: PinInit<T, E> {
970970
///
971971
/// impl Foo {
972972
/// fn setup(&mut self) {
973-
/// pr_info!("Setting up foo");
973+
/// pr_info!("Setting up foo\n");
974974
/// }
975975
/// }
976976
///
@@ -1318,7 +1318,7 @@ impl<T> InPlaceWrite<T> for UniqueArc<MaybeUninit<T>> {
13181318
/// #[pinned_drop]
13191319
/// impl PinnedDrop for Foo {
13201320
/// fn drop(self: Pin<&mut Self>) {
1321-
/// pr_info!("Foo is being dropped!");
1321+
/// pr_info!("Foo is being dropped!\n");
13221322
/// }
13231323
/// }
13241324
/// ```

rust/kernel/init/macros.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
//! #[pinned_drop]
4646
//! impl PinnedDrop for Foo {
4747
//! fn drop(self: Pin<&mut Self>) {
48-
//! pr_info!("{self:p} is getting dropped.");
48+
//! pr_info!("{self:p} is getting dropped.\n");
4949
//! }
5050
//! }
5151
//!
@@ -412,7 +412,7 @@
412412
//! #[pinned_drop]
413413
//! impl PinnedDrop for Foo {
414414
//! fn drop(self: Pin<&mut Self>) {
415-
//! pr_info!("{self:p} is getting dropped.");
415+
//! pr_info!("{self:p} is getting dropped.\n");
416416
//! }
417417
//! }
418418
//! ```
@@ -423,7 +423,7 @@
423423
//! // `unsafe`, full path and the token parameter are added, everything else stays the same.
424424
//! unsafe impl ::kernel::init::PinnedDrop for Foo {
425425
//! fn drop(self: Pin<&mut Self>, _: ::kernel::init::__internal::OnlyCallFromDrop) {
426-
//! pr_info!("{self:p} is getting dropped.");
426+
//! pr_info!("{self:p} is getting dropped.\n");
427427
//! }
428428
//! }
429429
//! ```

0 commit comments

Comments
 (0)