[PATCH] drm: nova-drm: fix 32-bit arm build

Danilo Krummrich dakr at kernel.org
Thu Jul 24 17:05:26 UTC 2025


On Thu Jul 24, 2025 at 6:54 PM CEST, Miguel Ojeda wrote:
> In 32-bit arm, the build fails with:
>
>     error[E0308]: mismatched types
>       --> drivers/gpu/drm/nova/file.rs:42:28
>        |
>     42 |         getparam.set_value(value);
>        |                  --------- ^^^^^ expected `u64`, found `u32`
>        |                  |
>        |                  arguments to this method are incorrect
>        |
>     note: method defined here
>       --> drivers/gpu/drm/nova/uapi.rs:29:12
>        |
>     29 |     pub fn set_value(&self, v: u64) {
>        |            ^^^^^^^^^        ------
>     help: you can convert a `u32` to a `u64`
>        |
>     42 |         getparam.set_value(value.into());
>        |                                 +++++++
>
> The reason is that `Getparam::set_value` takes a `u64` (from the UAPI),
> but `pci::Device::resource_len()` returns a `resource_size_t`, which is a
> `phys_addr_t`, which may be 32- or 64-bit.
>
> Thus add an `into()` call to support the 32-bit case, while allowing the
> Clippy lint that complains in the 64-bit case where the type is the same.
>
> Fixes: cdeaeb9dd762 ("drm: nova-drm: add initial driver skeleton")
> Signed-off-by: Miguel Ojeda <ojeda at kernel.org>

Thanks -- will take it through -fixes once rc-1 is out.

> ---
> As discussed, it may be best to have a newtype, or at least a function
> to perform this -- here it is the minimal fix nevertheless.

I think I will follow up with a function to perform the conversion in a single
place, but I really like the idea of a special clippy annotation to tell clippy
to not warn about unnecessary into() conversions for a specific type alias, such
as ResourceSize.

Do we agree that we want something like this? Do we even have a feature request
for this already?


More information about the dri-devel mailing list