summaryrefslogtreecommitdiff
path: root/drivers/gpu/nova-core/bitfield.rs
diff options
context:
space:
mode:
authorAlexandre Courbot <acourbot@nvidia.com>2025-10-16 11:13:20 -0400
committerAlexandre Courbot <acourbot@nvidia.com>2025-10-21 22:37:37 +0900
commit3f674dc4ef1b3783f9d8dae33b46bf50eaac7c79 (patch)
tree4af9063709571bf3a7537f1a9a91e36a470db9aa /drivers/gpu/nova-core/bitfield.rs
parent91321980923477044eaf91ca6445a409c4b9712e (diff)
gpu: nova-core: register: use field type for Into implementation
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. Reported-by: Edwin Peer <epeer@nvidia.com> Closes: https://lore.kernel.org/rust-for-linux/F3853912-2C1C-4F9B-89B0-3168689F35B3@nvidia.com/ Reviewed-by: Joel Fernandes <joelagnelf@nvidia.com> Signed-off-by: Joel Fernandes <joelagnelf@nvidia.com> Signed-off-by: Alexandre Courbot <acourbot@nvidia.com> Message-ID: <20251016151323.1201196-2-joelagnelf@nvidia.com>
Diffstat (limited to 'drivers/gpu/nova-core/bitfield.rs')
0 files changed, 0 insertions, 0 deletions