public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Danilo Krummrich" <dakr@kernel.org>
To: "Maurice Hieronymus" <mhi@mailbox.org>
Cc: "Gary Guo" <gary@garyguo.net>, "Benno Lossin" <lossin@kernel.org>,
	<aliceryhl@google.com>, <acourbot@nvidia.com>,
	<airlied@gmail.com>, <simona@ffwll.ch>,
	<nouveau@lists.freedesktop.org>,
	<dri-devel@lists.freedesktop.org>, <linux-kernel@vger.kernel.org>,
	<ojeda@kernel.org>, <boqun.feng@gmail.com>,
	<bjorn3_gh@protonmail.com>, <a.hindborg@kernel.org>,
	<tmgross@umich.edu>, <rust-for-linux@vger.kernel.org>
Subject: Re: [PATCH v2 1/2] rust: macros: Add derive Display for enums
Date: Mon, 05 Jan 2026 23:03:33 +0100	[thread overview]
Message-ID: <DFGZUHLJ3ALF.EZDC85ZEFJA9@kernel.org> (raw)
In-Reply-To: <cd9d7dd56e8191eb2d61dce1c3fd88ccffcff690.camel@mailbox.org>

On Mon Jan 5, 2026 at 10:11 PM CET, Maurice Hieronymus wrote:
> Before I start implementing, I want to reach common ground.
>
> In my opinion a derive macro which implements Display would be
> perfectly fine, as long as the name suggests what it does. So for
> example #[derive(DisplayEnumVariant)]. This would communicate the
> intent clearly to the user.
>
> Benno, would you be okay with that? If not, Gary and Danilo, are you
> fine with the proposed trait implementation (e.g. the variant_name
> function)?

Actually, it might even be reasonable to have both. In the Nova driver we have
the case that we want to print the enum variant exactly as it is defined in the
code and a lowercase version of the enum variant.

> Are there any common use-cases where one wants to change the case of
> the enum variants? If not, I would not implement an argument and rather
> name the macro accordingly, so the intent is clear.

As mentioned above, we do have a case in Nova where we also want a lowercase
representation to construct a firmware path with.

  reply	other threads:[~2026-01-05 22:03 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

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=DFGZUHLJ3ALF.EZDC85ZEFJA9@kernel.org \
    --to=dakr@kernel.org \
    --cc=a.hindborg@kernel.org \
    --cc=acourbot@nvidia.com \
    --cc=airlied@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gary@garyguo.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=mhi@mailbox.org \
    --cc=nouveau@lists.freedesktop.org \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=simona@ffwll.ch \
    --cc=tmgross@umich.edu \
    /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