rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rust: drm: gem: add missing handle_free to the object vtables
@ 2026-09-09  9:47 Mike Lothian
  2026-09-09 15:51 ` Gary Guo
  2026-09-09 15:57 ` Alex Deucher
  0 siblings, 2 replies; 4+ messages in thread
From: Mike Lothian @ 2026-09-09  9:47 UTC (permalink / raw)
  To: dri-devel
  Cc: dakr, aliceryhl, alexander.deucher, mukul.joshi, rust-for-linux,
	amd-gfx, Mike Lothian

Both OBJECT_FUNCS and the shmem VTABLE initialise every member of
drm_gem_object_funcs explicitly, so adding a field to the C struct
breaks the Rust build:

  error[E0063]: missing field `handle_free` in initializer of
  `drm_gem_object_funcs`

The callback is optional and the Rust abstraction has no equivalent
DriverObject method, so leave it unset.

The shmem copy is only built with CONFIG_RUST_DRM_GEM_SHMEM_HELPER,
which DRM_TYR selects.

Fixes: b67d2d039f64 ("drm/gem: Add callback for when handle count goes to 0")
Signed-off-by: Mike Lothian <mike@fireburn.co.uk>
Assisted-by: Claude:Opus-5 [Claude Code]
---

b67d2d039f64 is only in agd5f/drm-next, so this can be squashed into it
instead if you would rather keep that branch bisectable.

The shmem hunk is by inspection - CONFIG_RUST_DRM_GEM_SHMEM_HELPER is
not set in my config, so only the mod.rs copy is compile-tested.

 rust/kernel/drm/gem/mod.rs   | 1 +
 rust/kernel/drm/gem/shmem.rs | 1 +
 2 files changed, 2 insertions(+)

diff --git a/rust/kernel/drm/gem/mod.rs b/rust/kernel/drm/gem/mod.rs
index 80d8f524f9d5..ae61ca7e1246 100644
--- a/rust/kernel/drm/gem/mod.rs
+++ b/rust/kernel/drm/gem/mod.rs
@@ -278,6 +278,7 @@ impl<T: DriverObject, Ctx: DeviceContext> Object<T, Ctx> {
         vm_ops: core::ptr::null_mut(),
         evict: None,
         rss: None,
+        handle_free: None,
     };
 
     /// Returns the `Device` that owns this GEM object.
diff --git a/rust/kernel/drm/gem/shmem.rs b/rust/kernel/drm/gem/shmem.rs
index a687d46d170d..d08a03cb7a13 100644
--- a/rust/kernel/drm/gem/shmem.rs
+++ b/rust/kernel/drm/gem/shmem.rs
@@ -145,6 +145,7 @@ impl<T: DriverObject> Object<T> {
         // SAFETY: `drm_gem_shmem_vm_ops` is a valid, static const on the C side.
         vm_ops: unsafe { &raw const bindings::drm_gem_shmem_vm_ops },
         evict: None,
+        handle_free: None,
     };
 
     /// Return a raw pointer to the embedded drm_gem_shmem_object.
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-09-09 17:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-09  9:47 [PATCH] rust: drm: gem: add missing handle_free to the object vtables Mike Lothian
2026-09-09 15:51 ` Gary Guo
2026-09-09 15:57 ` Alex Deucher
2026-09-09 17:45   ` Klara Modin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).