Re: [PATCH v2 08/16] drm/tyr: specify base type for registers

"Gary Guo" <[email protected]> Wed, 05 Aug 2026 17:59:09 +0100
Newsgroups org.kernel.vger.rust-for-linux,dev.linux.lists.driver-core,dev.linux.lists.nova-gpu,org.freedesktop.lists.dri-devel,org.kernel.vger.linux-kernel,org.kernel.vger.linux-pci
Message-ID <[email protected]>
On Wed Aug 5, 2026 at 5:35 PM BST, Gary Guo wrote:
> All registers use the same base type, which is `<IoMem as IO>::Target`.
> Thus add the base parameter to `register!` invocation.

This is missing a few `register!` invocation that's introduced in the new
linux-next base, as Sashiko points out. Will include in the next version.

Best,
Gary

>
> Signed-off-by: Gary Guo <[email protected]>
> ---
>  drivers/gpu/drm/tyr/driver.rs |  1 +
>  drivers/gpu/drm/tyr/regs.rs   | 43 ++++++++++++++++++++++++++++++++++++++++++-
>  2 files changed, 43 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/tyr/driver.rs b/drivers/gpu/drm/tyr/driver.rs
> index bfb0ba19caff..730b84e37a54 100644
> --- a/drivers/gpu/drm/tyr/driver.rs
> +++ b/drivers/gpu/drm/tyr/driver.rs
> @@ -46,6 +46,7 @@
>  };
>  
>  pub(crate) type IoMem<'a> = kernel::io::mem::IoMem<'a, SZ_2M>;
> +pub(crate) type TyrRegisters = kernel::io::Region<SZ_2M>;
>  
>  pub(crate) struct TyrDrmDriver;
>  
> diff --git a/drivers/gpu/drm/tyr/regs.rs b/drivers/gpu/drm/tyr/regs.rs
> index a62724378ced..3e6edae6e27f 100644
> --- a/drivers/gpu/drm/tyr/regs.rs
> +++ b/drivers/gpu/drm/tyr/regs.rs
> @@ -57,7 +57,11 @@ pub(crate) mod gpu_control {
>          uapi, //
>      };
>  
> +    use crate::driver::TyrRegisters;
> +
>      register! {
> +        base: TyrRegisters;
> +
>          /// GPU identification register.
>          pub(crate) GPU_ID(u32) @ 0x0 {
>              /// Status of the GPU release.
> @@ -315,6 +319,8 @@ fn from(mode: FlushMode) -> Self {
>      }
>  
>      register! {
> +        base: TyrRegisters;
> +
>          /// GPU command register.
>          ///
>          /// Use the constructor methods to create commands:
> @@ -380,6 +386,8 @@ pub(crate) fn clear_fault() -> Self {
>      }