mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "tip-bot2 for Boqun Feng" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: David Gow <davidgow@google.com>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	Boqun Feng <boqun.feng@gmail.com>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: locking/core] rust: sync: atomic: Implement Debug for Atomic<Debug>
Date: Fri, 14 Nov 2025 15:33:10 -0000	[thread overview]
Message-ID: <176313439079.498.4521363360222860326.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20251022035324.70785-3-boqun.feng@gmail.com>

The following commit has been merged into the locking/core branch of tip:

Commit-ID:     013f912eb5fa7c06b3648ca630acfc4ff26456fa
Gitweb:        https://git.kernel.org/tip/013f912eb5fa7c06b3648ca630acfc4ff26456fa
Author:        Boqun Feng <boqun.feng@gmail.com>
AuthorDate:    Tue, 21 Oct 2025 23:53:23 -04:00
Committer:     Boqun Feng <boqun.feng@gmail.com>
CommitterDate: Wed, 12 Nov 2025 08:56:41 -08:00

rust: sync: atomic: Implement Debug for Atomic<Debug>

If `Atomic<T>` is `Debug` then it's a `debugfs::Writer`, therefore make
it so since 1) debugfs needs to support `Atomic<T>` and 2) it's rather
trivial to implement `Debug` for `Atomic<Debug>`.

Tested-by: David Gow <davidgow@google.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
Link: https://patch.msgid.link/20251022035324.70785-3-boqun.feng@gmail.com
---
 rust/kernel/sync/atomic.rs |  9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/rust/kernel/sync/atomic.rs b/rust/kernel/sync/atomic.rs
index 0bc6e7b..3afc376 100644
--- a/rust/kernel/sync/atomic.rs
+++ b/rust/kernel/sync/atomic.rs
@@ -307,6 +307,15 @@ where
     }
 }
 
+impl<T: AtomicType + core::fmt::Debug> core::fmt::Debug for Atomic<T>
+where
+    T::Repr: AtomicBasicOps,
+{
+    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
+        core::fmt::Debug::fmt(&self.load(Relaxed), f)
+    }
+}
+
 impl<T: AtomicType> Atomic<T>
 where
     T::Repr: AtomicExchangeOps,

  reply	other threads:[~2025-11-14 15:33 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-22  3:53 [PATCH 0/3] Remove the usage of Rust native atomics in debugfs Boqun Feng
2025-10-22  3:53 ` [PATCH 1/3] rust: sync: atomic: Make Atomic*Ops pub(crate) Boqun Feng
2025-11-14 15:33   ` [tip: locking/core] " tip-bot2 for Boqun Feng
2025-10-22  3:53 ` [PATCH 2/3] rust: sync: atomic: Implement Debug for Atomic<Debug> Boqun Feng
2025-11-14 15:33   ` tip-bot2 for Boqun Feng [this message]
2025-10-22  3:53 ` [PATCH 3/3] rust: debugfs: Replace the usage of Rust native atomics Boqun Feng
2025-10-22  9:52   ` Danilo Krummrich
2025-10-22 16:25   ` Matthew Maurer
2025-11-14 15:33   ` [tip: locking/core] " tip-bot2 for Boqun Feng
2025-10-22  8:07 ` [PATCH 0/3] Remove the usage of Rust native atomics in debugfs Peter Zijlstra
2025-10-22  8:27   ` Alice Ryhl
2025-10-22 13:19   ` Boqun Feng
2025-10-22 10:29 ` Greg Kroah-Hartman
2025-10-24  5:49 ` David Gow
2025-10-24 14:57 ` Danilo Krummrich
2025-11-05 20:01   ` Boqun Feng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=176313439079.498.4521363360222860326.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=boqun.feng@gmail.com \
    --cc=davidgow@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®