public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] rust: macros: Add derive Display for enums
@ 2026-01-04 20:07 Maurice Hieronymus
  2026-01-04 20:07 ` [PATCH v2 1/2] " Maurice Hieronymus
  2026-01-04 20:07 ` [PATCH v2 2/2] gpu: nova-core: Use derive Display for Chipset enum Maurice Hieronymus
  0 siblings, 2 replies; 13+ messages in thread
From: Maurice Hieronymus @ 2026-01-04 20:07 UTC (permalink / raw)
  To: dakr
  Cc: aliceryhl, acourbot, airlied, simona, nouveau, dri-devel,
	linux-kernel, ojeda, boqun.feng, gary, bjorn3_gh, lossin,
	a.hindborg, tmgross, mhi, rust-for-linux

This patch series adds a derive macro for implementing kernel::fmt::Display
on enums using the syn crate, and then applies it to the Chipset enum in
the nova-core driver.

Maurice Hieronymus (2):
  rust: macros: Add derive Display for enums
  gpu: nova-core: Use derive Display for Chipset enum

 drivers/gpu/nova-core/gpu.rs | 17 ++----------
 rust/macros/display.rs       | 52 ++++++++++++++++++++++++++++++++++++
 rust/macros/lib.rs           | 42 +++++++++++++++++++++++++++++
 3 files changed, 96 insertions(+), 15 deletions(-)
 create mode 100644 rust/macros/display.rs

---
v1: https://lore.kernel.org/all/20260101184137.80445-1-mhi@mailbox.org/

Changes since v1:
- Instead of using the name() method with lowercase strings, implement
  a proper derive macro using syn as suggested by the reviewer
- The derive macro outputs the exact variant name as written
  (case-preserved)
- Supports all enum variant types: unit, tuple, and struct variants

base-commit: f8f9c1f4d0c7a64600e2ca312dec824a0bc2f1da
-- 
2.51.2


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

end of thread, other threads:[~2026-01-06 12:56 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-04 20:07 [PATCH v2 0/2] rust: macros: Add derive Display for enums Maurice Hieronymus
2026-01-04 20:07 ` [PATCH v2 1/2] " Maurice Hieronymus
2026-01-05  9:02   ` Benno Lossin
2026-01-05 10:29     ` Danilo Krummrich
2026-01-05 14:42       ` Benno Lossin
2026-01-05 15:00         ` Danilo Krummrich
2026-01-05 15:23           ` Maurice Hieronymus
2026-01-05 16:11       ` Gary Guo
2026-01-05 21:11         ` Maurice Hieronymus
2026-01-05 22:03           ` Danilo Krummrich
2026-01-06  5:56             ` Maurice Hieronymus
2026-01-06 12:56               ` Benno Lossin
2026-01-04 20:07 ` [PATCH v2 2/2] gpu: nova-core: Use derive Display for Chipset enum Maurice Hieronymus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox