Re: [PATCH] rust/drm/gem: initialize callbacks with ..pin_init::zeroed()
From: Gary Guo
Date: Tue Sep 08 2026 - 17:42:51 EST
On Tue Sep 8, 2026 at 6:54 PM BST, Klara Modin wrote:
> When the commit b67d2d039f64 ("drm/gem: Add callback for when handle
> count goes to 0") added the handle_free callback, it did not update the
> rust abstraction, which will cause a build failure when that is enabled.
> Rather than just adding another None initializer, use
> ..pin_init::zeroed() to make all unlisted callbacks None, and remove the
> existing None-initializations.
>
> Fixes: b67d2d039f64 ("drm/gem: Add callback for when handle count goes to 0")
> Reported-by: Thorsten Leemhuis <linux@xxxxxxxxxxxxx>
> Closes: https://lore.kernel.org/all/aaef18cd-ab55-4fb8-8563-ca3a5ea9cbc6@xxxxxxxxxxxxx
> Suggested-by: Gary Guo <gary@xxxxxxxxxxx>
> Signed-off-by: Klara Modin <klarasmodin@xxxxxxxxx>
> ---
> rust/kernel/drm/gem/mod.rs | 12 +-----------
> 1 file changed, 1 insertion(+), 11 deletions(-)
>
> diff --git a/rust/kernel/drm/gem/mod.rs b/rust/kernel/drm/gem/mod.rs
> index 80d8f524f9d5..af8274134a71 100644
> --- a/rust/kernel/drm/gem/mod.rs
> +++ b/rust/kernel/drm/gem/mod.rs
> @@ -266,18 +266,8 @@ impl<T: DriverObject, Ctx: DeviceContext> Object<T, Ctx> {
> free: Some(Self::free_callback),
> open: Some(open_callback::<T>),
> close: Some(close_callback::<T>),
> - print_info: None,
> - export: None,
> - pin: None,
> - unpin: None,
> - get_sg_table: None,
> - vmap: None,
> - vunmap: None,
> - mmap: None,
> - status: None,
> vm_ops: core::ptr::null_mut(),
This line can be gone too.
Best,
Gary
> - evict: None,
> - rss: None,
> + ..pin_init::zeroed()
> };
>
> /// Returns the `Device` that owns this GEM object.