[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a3f8f89d-be89-4fab-8399-6340ce4db899@nvidia.com>
Date: Thu, 16 Oct 2025 11:05:42 -0400
From: Joel Fernandes <joelagnelf@...dia.com>
To: linux-kernel@...r.kernel.org, rust-for-linux@...r.kernel.org,
dri-devel@...ts.freedesktop.org, dakr@...nel.org, acourbot@...dia.com
Cc: Alistair Popple <apopple@...dia.com>, Miguel Ojeda <ojeda@...nel.org>,
Alex Gaynor <alex.gaynor@...il.com>, Boqun Feng <boqun.feng@...il.com>,
Gary Guo <gary@...yguo.net>, bjorn3_gh@...tonmail.com,
Benno Lossin <lossin@...nel.org>, Andreas Hindborg <a.hindborg@...nel.org>,
Alice Ryhl <aliceryhl@...gle.com>, Trevor Gross <tmgross@...ch.edu>,
David Airlie <airlied@...il.com>, Simona Vetter <simona@...ll.ch>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>, Thomas Zimmermann <tzimmermann@...e.de>,
John Hubbard <jhubbard@...dia.com>, Timur Tabi <ttabi@...dia.com>,
joel@...lfernandes.org, Elle Rhumsaa <elle@...thered-steel.dev>,
Yury Norov <yury.norov@...il.com>,
Daniel Almeida <daniel.almeida@...labora.com>, nouveau@...ts.freedesktop.org
Subject: Re: [PATCH v7 1/4] gpu: nova-core: register: use field type for Into
implementation
On 10/16/2025 11:02 AM, Joel Fernandes wrote:
> From: Alexandre Courbot <acourbot@...dia.com>
>
> The getter method of a field works with the field type, but its setter
> expects the type of the register. This leads to an asymmetry in the
> From/Into implementations required for a field with a dedicated type.
> For instance, a field declared as
>
> pub struct ControlReg(u32) {
> 3:0 mode as u8 ?=> Mode;
> ...
> }
>
> currently requires the following implementations:
>
> impl TryFrom<u8> for Mode {
> ...
> }
>
> impl From<Mode> for u32 {
> ...
> }
>
> Change this so the `From<Mode>` now needs to be implemented for `u8`,
> i.e. the primitive type of the field. This is more consistent, and will
> become a requirement once we start using the TryFrom/Into derive macros
> to implement these automatically.
>
> Reviewed-by: Joel Fernandes <joelagnelf@...dia.com>
> Signed-off-by: Alexandre Courbot <acourbot@...dia.com>
Uff, my SOB is missing.
Signed-off-by: Joel Fernandes <joelagnelf@...dia.com>
Alex, do you mind adding it to the patch when applying?
thanks,
- Joel
Powered by blists - more mailing lists