All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Lothian <mike@fireburn.co.uk>
To: dri-devel@lists.freedesktop.org
Cc: dakr@kernel.org, aliceryhl@google.com, alexander.deucher@amd.com,
	mukul.joshi@amd.com, rust-for-linux@vger.kernel.org,
	amd-gfx@lists.freedesktop.org, Mike Lothian <mike@fireburn.co.uk>
Subject: [PATCH] rust: drm: gem: add missing handle_free to the object vtables
Date: Wed,  9 Sep 2026 10:47:29 +0100	[thread overview]
Message-ID: <20260909094729.1593-1-mike@fireburn.co.uk> (raw)

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


             reply	other threads:[~2026-09-09  9:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-09  9:47 Mike Lothian [this message]
2026-09-09 15:51 ` [PATCH] rust: drm: gem: add missing handle_free to the object vtables Gary Guo
2026-09-09 15:57 ` Alex Deucher
2026-09-09 17:45   ` Klara Modin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260909094729.1593-1-mike@fireburn.co.uk \
    --to=mike@fireburn.co.uk \
    --cc=alexander.deucher@amd.com \
    --cc=aliceryhl@google.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=dakr@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=mukul.joshi@amd.com \
    --cc=rust-for-linux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.