[PATCH 0/4] drm/tyr: use the conversion derives for the enums

From: Daniel Almeida

Date: Thu Nov 26 2026 - 15:11:42 EST


The `as` cast series [1] leaves 19 casts that convert an enum to its
integer value, each inside a hand-written conversion between the enum
and `Bounded`. This series derives these conversions with the `TryFrom`,
`From` and `Into` derives of Kaiqi's series "rust: add conversion
derives and exhaustive From support" [2], which removes the 19 casts.
Patch 4 also converts `EntryType`, the last enum with a hand-written
conversion, which had no cast.

This is based on drm-rust-next and depends on [1] and on patches 1 to 9
of [2]. I will follow up with a review of [2] soon.

[1] https://lore.kernel.org/all/20261125-b4-tyr-as-casts-v1-0-2b2f53164d86@xxxxxxxxxxxxx/
[2] https://lore.kernel.org/all/20260930002436.21395-1-chaoji_xinren@xxxxxxx/

---
Daniel Almeida (4):
drm/tyr: use the conversion derives for the GPU_CONTROL enums
drm/tyr: use the conversion derives for the MMU_AS_CONTROL enums
drm/tyr: use the conversion derives for `CacheMode`
drm/tyr: use the `TryFrom` derive for `EntryType`

drivers/gpu/drm/tyr/fw.rs | 30 +--
drivers/gpu/drm/tyr/fw/parser.rs | 25 +-
drivers/gpu/drm/tyr/regs.rs | 486 ++++-----------------------------------
3 files changed, 56 insertions(+), 485 deletions(-)
---
base-commit: 7402dd230f4497954b465145a22cff7a5a488629
change-id: 20261126-tyr-enum-derives-cbf729d01e5c
prerequisite-message-id: <20261125-b4-tyr-as-casts-v1-0-2b2f53164d86@xxxxxxxxxxxxx>
prerequisite-patch-id: 1d54819d2dac9c113331baef19e763cedb0ca517
prerequisite-patch-id: 016e94c56c10e511f6ac4c045f620207211b9f02
prerequisite-patch-id: 1899e0445dbd58f2a72b6f9bdcffba70b7e65ac4
prerequisite-patch-id: 4da30d4ec1abd60c6cbc5f5f108437abb4d5e3f3
prerequisite-patch-id: 04ac471e820674330ff6ed854c7691be3f4c7cef
prerequisite-patch-id: b62e387da808817a10df1a2977da60ecc630aeef
prerequisite-patch-id: 17733676a0b8814fabdec83ab20b749729149c4f
prerequisite-patch-id: 7a6862e6c23c43bdf11dff1f84032cd4209afc33
prerequisite-patch-id: f10354893c358db15456a84dc6113d24f03af0c0
prerequisite-patch-id: faee0bac4883bd31a407fb7fc66a40d5c2400c49
prerequisite-patch-id: 8c67c4dd9fc45169d882a349d0b27cf056197c6f
prerequisite-patch-id: b6ddee237c4a24b5c0242097aace0102820ac1db
prerequisite-patch-id: d1a6ccba37c85b7f62a7a06d73ce09813a5c6530
prerequisite-patch-id: c4eb8ca570fef755b66db1d2f5372cb562b8c1ec
prerequisite-patch-id: c997628e4e15a91a1db84772cb92a878d0f624ce
prerequisite-patch-id: d52e3ddfdb2de753538ec5c70acbf9ef5f276301
prerequisite-patch-id: 4000d922c41278ed2f1df0a4873942d21e3c49c0
prerequisite-patch-id: 65006ecf8ae3a3aa4d2439f6d0bf239d4672f208
prerequisite-patch-id: 565696b33359e46ffcba363b3e72c1e8df5584ba
prerequisite-patch-id: 36fd0e809e61e4c4f0d34027dfcabd4434030883
prerequisite-patch-id: e8bf99685c380a6cc232256b160699bf91cbf812
prerequisite-patch-id: 6cca0def1c915ef8a34c21913eee636a57ff6aa6

Best regards,
--
Daniel Almeida <daniel.almeida@xxxxxxxxxxxxx>