Skip to content

Commit 8846b19

Browse files
albankurtiopsiff
authored andcommitted
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]> (cherry picked from commit 2592a62)
1 parent 351f6c2 commit 8846b19

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
@@ -258,7 +258,7 @@ pub mod macros;
258258
/// },
259259
/// }));
260260
/// let foo: Pin<&mut Foo> = foo;
261-
/// pr_info!("a: {}", &*foo.a.lock());
261+
/// pr_info!("a: {}\n", &*foo.a.lock());
262262
/// ```
263263
///
264264
/// # Syntax
@@ -310,7 +310,7 @@ macro_rules! stack_pin_init {
310310
/// })?,
311311
/// }));
312312
/// let foo = foo.unwrap();
313-
/// pr_info!("a: {}", &*foo.a.lock());
313+
/// pr_info!("a: {}\n", &*foo.a.lock());
314314
/// ```
315315
///
316316
/// ```rust,ignore
@@ -335,7 +335,7 @@ macro_rules! stack_pin_init {
335335
/// x: 64,
336336
/// })?,
337337
/// }));
338-
/// pr_info!("a: {}", &*foo.a.lock());
338+
/// pr_info!("a: {}\n", &*foo.a.lock());
339339
/// # Ok::<_, AllocError>(())
340340
/// ```
341341
///
@@ -800,7 +800,7 @@ pub unsafe trait PinInit<T: ?Sized, E = Infallible>: Sized {
800800
///
801801
/// impl Foo {
802802
/// fn setup(self: Pin<&mut Self>) {
803-
/// pr_info!("Setting up foo");
803+
/// pr_info!("Setting up foo\n");
804804
/// }
805805
/// }
806806
///
@@ -906,7 +906,7 @@ pub unsafe trait Init<T: ?Sized, E = Infallible>: PinInit<T, E> {
906906
///
907907
/// impl Foo {
908908
/// fn setup(&mut self) {
909-
/// pr_info!("Setting up foo");
909+
/// pr_info!("Setting up foo\n");
910910
/// }
911911
/// }
912912
///
@@ -1229,7 +1229,7 @@ impl<T> InPlaceInit<T> for UniqueArc<T> {
12291229
/// #[pinned_drop]
12301230
/// impl PinnedDrop for Foo {
12311231
/// fn drop(self: Pin<&mut Self>) {
1232-
/// pr_info!("Foo is being dropped!");
1232+
/// pr_info!("Foo is being dropped!\n");
12331233
/// }
12341234
/// }
12351235
/// ```

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)