From nobody Mon May 25 03:33:07 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6C1D6305665; Tue, 19 May 2026 06:26:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779171977; cv=none; b=IcJQOM9Llk/MAeakZAntbAhexBTY4nf3gt3eCAjRw1wTv9JusS8VXHSQkJUCz3I6z9rKcdQhRKghie++woWIPuGBvxHXDfftbRcLWO0AqO6gfsGRLyseEqC7A9iV7obnT8kD4v5stHkWAs9ZHTgeugPo6pgSCYD7KhV0x7OfF9A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779171977; c=relaxed/simple; bh=ZxczDP1VleS2E+h97aaS99GWrdXeqA4F9FKMUPVF+a8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=U+qaOx908taT6OqEn3PbTFWR8FcW0LjKlCSoKy3U+lo7Z8uJ/60eT9DZHpBdq6fuC+Fx4esnac4mHoduNa8x+WXGEgsg1PwjTWDMgxJmvSMRUwAotaQ6DiQCMTahUigOOzdGzM1u6RB1PZrKqfIC+3wdqWytShBs9lcg+wMJRkc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=YHElItly; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="YHElItly" Received: by smtp.kernel.org (Postfix) with ESMTPS id 11FE7C2BCC9; Tue, 19 May 2026 06:26:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux.dev; s=korg; t=1779171977; bh=ZxczDP1VleS2E+h97aaS99GWrdXeqA4F9FKMUPVF+a8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=YHElItlyyola2Ig+eyQgiYWn9USci/7TxKtEce+7M1grk06Wd1OA2GW8f/wAnJvDl bDxJJ/3N3nTA1mfZC3+5Kvs3zG/MgP3F6Pj+C3Si/XpeXJzdsPsroK+FdAMXcd/BDM HsMf/ujpJg3r5/2zONWhf8GbD2oPBT1f4PJsU4bU= Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id ECD99CD4F3C; Tue, 19 May 2026 06:26:16 +0000 (UTC) From: Alvin Sun Date: Tue, 19 May 2026 14:26:13 +0800 Subject: [PATCH 1/8] rust: module: add `MODULE_PTR` const to `ModuleMetadata` trait Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260519-fix-fops-owner-v1-1-2ded9830da14@linux.dev> References: <20260519-fix-fops-owner-v1-0-2ded9830da14@linux.dev> In-Reply-To: <20260519-fix-fops-owner-v1-0-2ded9830da14@linux.dev> To: Miguel Ojeda , Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , Danilo Krummrich , Luis Chamberlain , Petr Pavlu , Daniel Gomez , Sami Tolvanen , Aaron Tomlin , Greg Kroah-Hartman , "Rafael J. Wysocki" , David Airlie , Simona Vetter , Daniel Almeida , Arnd Bergmann Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, linux-modules@vger.kernel.org, driver-core@lists.linux.dev, dri-devel@lists.freedesktop.org, nova-gpu@lists.linux.dev, Alvin Sun X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1779171975; l=2011; i=alvin.sun@linux.dev; s=20260317; h=from:subject:message-id; bh=ZxczDP1VleS2E+h97aaS99GWrdXeqA4F9FKMUPVF+a8=; b=nZswdxITOGGBNtXxziHC46ym73dmkEpgBRSKXECBrIkKx63Q6fXF2BcQ9Wu99HlqtRv32iuS7 nenSNwiKIxRDsSSvybK6NrQ/NmLMOgegWv7aRnPdYLyeBWx7+qzexiI X-Developer-Key: i=alvin.sun@linux.dev; a=ed25519; pk=CHcwQp8GSoj25V/L1ZWNSQjWp9eSIb0s9LKr0Nm3WuE= X-Endpoint-Received: by B4 Relay for alvin.sun@linux.dev/20260317 with auth_id=684 Add a `MODULE_PTR` const to the `ModuleMetadata` trait so that modules can provide a constant pointer to their `struct module` usable in const contexts such as static file_operations. Signed-off-by: Alvin Sun --- rust/kernel/lib.rs | 3 +++ rust/macros/module.rs | 14 ++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/rust/kernel/lib.rs b/rust/kernel/lib.rs index b72b2fbe046d6..c7e809636e1a9 100644 --- a/rust/kernel/lib.rs +++ b/rust/kernel/lib.rs @@ -184,6 +184,9 @@ fn init(module: &'static ThisModule) -> impl pin_init::= PinInit Result { =20 impl ::kernel::ModuleMetadata for #type_ { const NAME: &'static ::kernel::str::CStr =3D #name_cstr; + + #[cfg(MODULE)] + const MODULE_PTR: *mut ::kernel::bindings::module =3D { + extern "C" { + static __this_module: ::kernel::types::Opaque<::kernel= ::bindings::module>; + } + + // SAFETY: `__this_module` is constructed by the kernel at= load time + // and lives until the module is unloaded. + unsafe { __this_module.get() } + }; + + #[cfg(not(MODULE))] + const MODULE_PTR: *mut ::kernel::bindings::module =3D ::core::= ptr::null_mut(); } =20 // Double nested modules, since then nobody can access the public = items inside. --=20 2.43.0 From nobody Mon May 25 03:33:07 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6C0431A682A; Tue, 19 May 2026 06:26:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779171977; cv=none; b=HoYoNu4NxSJk1YtNCoD2SAs3RdZ+7P9x6NgohmwIfedIwIDQWKpfB2f8Twy25bsDOZV/Ke3Lc5DgHAkgqgR0R4S64aILH/d6JPSTNGZVTZDfnaYpmqesfcs/DpD4GXJmc7F2J6ZJzzZRgODHpE/ADnSdfy2hdK9xrotq9W//cas= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779171977; c=relaxed/simple; bh=vfc7PEfuAeEjqo+PGe1GnSXUHGllBagvhexmLDwXXe8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=l24E7KggOxUxl8VAta0q8X0Lq565EThJgSpuyCwuWG4+tR4lL52lbrie3+q/iLYal1YRy+VSPzWzeGtw00TIQfOIA6+EY0wmdtSNlasdsb0uS1KBXCYw1Hin3u4OG2EOm7KJ5uNKMKkVgqWhvg1fiNgdnVtCi+mrUfar2KPOJDk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=P8rM12T0; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="P8rM12T0" Received: by smtp.kernel.org (Postfix) with ESMTPS id 1A978C2BCC6; Tue, 19 May 2026 06:26:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux.dev; s=korg; t=1779171977; bh=vfc7PEfuAeEjqo+PGe1GnSXUHGllBagvhexmLDwXXe8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=P8rM12T04+ZuBv6GHundGYtIAaOiFQVmUSH7xably5MuOZQ8r7iLOc9QKjSDnaqHj ffhhMsqcDAfQUTpMlh75x4ZMxFrqOtbIE6ktVNGwnd8YqYIC9l66CN/lrR07iXbABi n7Q3gj5LIToe4RvmN8BIkAX2EuqEmobGxso5P/M8= Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 095DCCD4851; Tue, 19 May 2026 06:26:17 +0000 (UTC) From: Alvin Sun Date: Tue, 19 May 2026 14:26:14 +0800 Subject: [PATCH 2/8] rust: driver: make `DriverModule` struct pub(crate) in `module_driver!` Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260519-fix-fops-owner-v1-2-2ded9830da14@linux.dev> References: <20260519-fix-fops-owner-v1-0-2ded9830da14@linux.dev> In-Reply-To: <20260519-fix-fops-owner-v1-0-2ded9830da14@linux.dev> To: Miguel Ojeda , Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , Danilo Krummrich , Luis Chamberlain , Petr Pavlu , Daniel Gomez , Sami Tolvanen , Aaron Tomlin , Greg Kroah-Hartman , "Rafael J. Wysocki" , David Airlie , Simona Vetter , Daniel Almeida , Arnd Bergmann Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, linux-modules@vger.kernel.org, driver-core@lists.linux.dev, dri-devel@lists.freedesktop.org, nova-gpu@lists.linux.dev, Alvin Sun X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1779171975; l=796; i=alvin.sun@linux.dev; s=20260317; h=from:subject:message-id; bh=vfc7PEfuAeEjqo+PGe1GnSXUHGllBagvhexmLDwXXe8=; b=iHl0SVhJNpVhuwZ7fh48egK9TuW+0iU+YW7qNL4AsNI9HBq33i2CD/EuLLetzk/gmObncqGZY c1YeH3GB4bhDdkz58UDUJs4GIxBetIU7CQNTcDd16LTUVxnj/j/Y7aw X-Developer-Key: i=alvin.sun@linux.dev; a=ed25519; pk=CHcwQp8GSoj25V/L1ZWNSQjWp9eSIb0s9LKr0Nm3WuE= X-Endpoint-Received: by B4 Relay for alvin.sun@linux.dev/20260317 with auth_id=684 Expose the generated `DriverModule` struct as `pub(crate)` so that driver implementations can reference it via `super::DriverModule` for the `ThisModule` associated type. Signed-off-by: Alvin Sun --- rust/kernel/driver.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust/kernel/driver.rs b/rust/kernel/driver.rs index 36de8098754d0..9c7c69c4d2af0 100644 --- a/rust/kernel/driver.rs +++ b/rust/kernel/driver.rs @@ -253,7 +253,7 @@ macro_rules! module_driver { type Ops<$gen_type> =3D $driver_ops; =20 #[$crate::prelude::pin_data] - struct DriverModule { + pub(crate) struct DriverModule { #[pin] _driver: $crate::driver::Registration>, } --=20 2.43.0 From nobody Mon May 25 03:33:07 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6C0C427816C; Tue, 19 May 2026 06:26:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779171977; cv=none; b=Ix3r6682G4emgDycoT5HY1/SrWxD9aiZNaP6VW5A34VGXPhdiH6GdDexWrntrclPV5MlNku2eXnlMRERX/XFi+a5dIP3APwAw40hsUrvQSsQN84ARPiZhLp8NiLeA59kHC3W/vkYqvRlS1IScTIs2lEqaNSwp78CRJlnSU9GzU0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779171977; c=relaxed/simple; bh=M3dpPwalF2NocfqTid6q3XDvlD/d7Tn+i9Og7LQzuig=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=qFb6cSf+5lmS6N6bu5deUr80IsqZhir5rNPTYAe4IFqNyntY4D+QFChjxOGtRB/AtVEZNc0NGyzMP2naVTKSPljAOndBR8G7deo9Ey9MFJRaO4Uimqm3JxuLz5fdMFsB1cn44eJOA8YiUjZte9yGr+Z6743IUeJUK05apzLDs5w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=wwo4GUzM; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="wwo4GUzM" Received: by smtp.kernel.org (Postfix) with ESMTPS id 2B0FBC2BCFB; Tue, 19 May 2026 06:26:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux.dev; s=korg; t=1779171977; bh=M3dpPwalF2NocfqTid6q3XDvlD/d7Tn+i9Og7LQzuig=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=wwo4GUzMgBDhhtPS4J7hT530U+FIJci1rtMF0WfxgcULyFfkxuvTR/Hf6veg7kCSZ Byl4nr+CiuDd7js7gnbt1bzEA7VSTxSQRTA99Uxkp4fD1L6mrCcD3nrU67XTsn03Zn u5rV8JTBdipp9rrGBURR8724/EH8nwn7UlMxarsQ= Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1A420CD4F5B; Tue, 19 May 2026 06:26:17 +0000 (UTC) From: Alvin Sun Date: Tue, 19 May 2026 14:26:15 +0800 Subject: [PATCH 3/8] rust: drm: add `ThisModule` associated type to `Driver` trait Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260519-fix-fops-owner-v1-3-2ded9830da14@linux.dev> References: <20260519-fix-fops-owner-v1-0-2ded9830da14@linux.dev> In-Reply-To: <20260519-fix-fops-owner-v1-0-2ded9830da14@linux.dev> To: Miguel Ojeda , Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , Danilo Krummrich , Luis Chamberlain , Petr Pavlu , Daniel Gomez , Sami Tolvanen , Aaron Tomlin , Greg Kroah-Hartman , "Rafael J. Wysocki" , David Airlie , Simona Vetter , Daniel Almeida , Arnd Bergmann Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, linux-modules@vger.kernel.org, driver-core@lists.linux.dev, dri-devel@lists.freedesktop.org, nova-gpu@lists.linux.dev, Alvin Sun X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1779171975; l=819; i=alvin.sun@linux.dev; s=20260317; h=from:subject:message-id; bh=M3dpPwalF2NocfqTid6q3XDvlD/d7Tn+i9Og7LQzuig=; b=dljVO2vk92ayJATiwozOI2qCWLcVZLtXkz//3VFX2GABwDBBjyg9sQBeD0lchTq996i2OwnoG n7BHGuiImStAmxErDZevujd6j3jUS4LrqRkaP0/+KeO9J+MGxSCUbWp X-Developer-Key: i=alvin.sun@linux.dev; a=ed25519; pk=CHcwQp8GSoj25V/L1ZWNSQjWp9eSIb0s9LKr0Nm3WuE= X-Endpoint-Received: by B4 Relay for alvin.sun@linux.dev/20260317 with auth_id=684 Add a `ThisModule` associated type bound by `ModuleMetadata` to the `drm::Driver` trait, allowing DRM drivers to expose their module pointer for use in file operations. Signed-off-by: Alvin Sun --- rust/kernel/drm/driver.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rust/kernel/drm/driver.rs b/rust/kernel/drm/driver.rs index 5233bdebc9fcd..c798961650c1a 100644 --- a/rust/kernel/drm/driver.rs +++ b/rust/kernel/drm/driver.rs @@ -115,6 +115,9 @@ pub trait Driver { =20 /// IOCTL list. See `kernel::drm::ioctl::declare_drm_ioctls!{}`. const IOCTLS: &'static [drm::ioctl::DrmIoctlDescriptor]; + + /// The module implementing this driver. + type ThisModule: crate::ModuleMetadata; } =20 /// The registration type of a `drm::Device`. --=20 2.43.0 From nobody Mon May 25 03:33:07 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C6E523909AB; Tue, 19 May 2026 06:26:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779171977; cv=none; b=jcPAFUirqq/Fc34zXuOjSexVpw56Sx7tXPxmDAOTwlXp//+8rf8+pD1YcbnNLeKLqgR1cPvI81AUebGhg7U7NJ/XK4BCConapGHIHx6nhvxoYbbW2cyfmz8/4QPPLkafZis7cf7qc/26o83OuIv4npVzHnsY8mTzutwBV3Pqo+k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779171977; c=relaxed/simple; bh=9Z9wAsI6CYGM9qPQGM6HbNxhzSLG4aRh4Z3ixoqvDE8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=osbMrZtph9IIb37n63Vf5DxOfLlQMZzag3v9FC5YsRtSawHmfjJHehso38nBgb2+Mv1Awm9o+Bj6sFPVV29gqUIjwoylytoX71SUW/gYF3RbCf3StZkTEukiBof/RI12Gwg7aYV8LMSY3UJ7LfoZLxhjisuRVn+s/zSF/eM/PYY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=1kiIVOLn; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="1kiIVOLn" Received: by smtp.kernel.org (Postfix) with ESMTPS id 3A60CC2BCFA; Tue, 19 May 2026 06:26:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux.dev; s=korg; t=1779171977; bh=9Z9wAsI6CYGM9qPQGM6HbNxhzSLG4aRh4Z3ixoqvDE8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=1kiIVOLnBUen5Tn1JaIZpays9z+1J0Kybl7WUzAHRh4W4IhG+JLrO202e7qMMharG fAc8djvUVpxV0IJBIjDUYNVCzE5WqUpDDdseUrpUDOVRlzfBSZ8b97Y2YOs98TUyq5 UMl6xUJ6fXHqFcr5SEd0jxvzY/JtIpGTnmZdLUoE= Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2A62FCD4F58; Tue, 19 May 2026 06:26:17 +0000 (UTC) From: Alvin Sun Date: Tue, 19 May 2026 14:26:16 +0800 Subject: [PATCH 4/8] gpu: nova: implement `ThisModule` Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260519-fix-fops-owner-v1-4-2ded9830da14@linux.dev> References: <20260519-fix-fops-owner-v1-0-2ded9830da14@linux.dev> In-Reply-To: <20260519-fix-fops-owner-v1-0-2ded9830da14@linux.dev> To: Miguel Ojeda , Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , Danilo Krummrich , Luis Chamberlain , Petr Pavlu , Daniel Gomez , Sami Tolvanen , Aaron Tomlin , Greg Kroah-Hartman , "Rafael J. Wysocki" , David Airlie , Simona Vetter , Daniel Almeida , Arnd Bergmann Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, linux-modules@vger.kernel.org, driver-core@lists.linux.dev, dri-devel@lists.freedesktop.org, nova-gpu@lists.linux.dev, Alvin Sun X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1779171975; l=694; i=alvin.sun@linux.dev; s=20260317; h=from:subject:message-id; bh=9Z9wAsI6CYGM9qPQGM6HbNxhzSLG4aRh4Z3ixoqvDE8=; b=5tu+ljTbic4iFxV8s9jKyOts11sBxBoViBntzSvf9qqyEQD+HdB1HSeUaRJ6XehDZwXtw/HCj XOplTY2EhRQCkwdT+ebmsCgDQb4BBXxhNMiT7mIAHqaAR0Wd7uZ+o/F X-Developer-Key: i=alvin.sun@linux.dev; a=ed25519; pk=CHcwQp8GSoj25V/L1ZWNSQjWp9eSIb0s9LKr0Nm3WuE= X-Endpoint-Received: by B4 Relay for alvin.sun@linux.dev/20260317 with auth_id=684 Set `ThisModule =3D super::DriverModule` to provide the correct module pointer for file operations ownership. Signed-off-by: Alvin Sun --- drivers/gpu/drm/nova/driver.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/nova/driver.rs b/drivers/gpu/drm/nova/driver.rs index b1af0a099551d..6353c19d319c6 100644 --- a/drivers/gpu/drm/nova/driver.rs +++ b/drivers/gpu/drm/nova/driver.rs @@ -68,6 +68,7 @@ impl drm::Driver for NovaDriver { type Data =3D NovaData; type File =3D File; type Object =3D gem::Object; + type ThisModule =3D super::DriverModule; =20 const INFO: drm::DriverInfo =3D INFO; =20 --=20 2.43.0 From nobody Mon May 25 03:33:07 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C4DDB39099C; Tue, 19 May 2026 06:26:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779171977; cv=none; b=pMuSYogjQC/5L0Nj96YBT8MkLMEs4HpnhVOcBWvrosRvtBHSq0nJw9V7tbb/6TYadQIBtAzz/lDlXj8zOv5cJwZ0nkoncHMIwQz6ofBXaN1IzYNn70puXOOy2esNvDZAEZCbV7EStuU46VCi77wQNLonFB5nQ41h/am2iwpIDuU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779171977; c=relaxed/simple; bh=8USOvLfbex0ZVgy7EUn6ZRwamRf3sFF+arQNn23gw0Y=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=LGDvDD2cfw+PrO6R5mjh86ZdoF2TmITNIYJWGnG3XrJYFbRei9YPC/3wLUjro8emIjxNN+GHfKorO2jdSnktw/XFIkH/uPzdz8ipNbrs3mFCtnkbk/Op+9pI0ncqY62u/EpIKBhqWdAiIVrOZUSi8CnXhfWRdJ5ljQpjSho4LL4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=ipKMJaJa; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="ipKMJaJa" Received: by smtp.kernel.org (Postfix) with ESMTPS id 4D76AC2BCFF; Tue, 19 May 2026 06:26:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux.dev; s=korg; t=1779171977; bh=8USOvLfbex0ZVgy7EUn6ZRwamRf3sFF+arQNn23gw0Y=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=ipKMJaJauk0fA5+yufFLxdJClTPJfZfZxoDxqZwFf6hBI4zENeBWpI6ilS2oXy27R wSz+LAQ4MZPMrTl+6P5kM4uyLAh6cVckALnNqF5sy/Ro6OioOWXO7JDRNSYvC2TRcQ r3wRYNmvyIclj616YQzw6ViydDsB7rSNZPl+46mQ= Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3AE31CD4F3C; Tue, 19 May 2026 06:26:17 +0000 (UTC) From: Alvin Sun Date: Tue, 19 May 2026 14:26:17 +0800 Subject: [PATCH 5/8] gpu: tyr: implement `ThisModule` Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260519-fix-fops-owner-v1-5-2ded9830da14@linux.dev> References: <20260519-fix-fops-owner-v1-0-2ded9830da14@linux.dev> In-Reply-To: <20260519-fix-fops-owner-v1-0-2ded9830da14@linux.dev> To: Miguel Ojeda , Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , Danilo Krummrich , Luis Chamberlain , Petr Pavlu , Daniel Gomez , Sami Tolvanen , Aaron Tomlin , Greg Kroah-Hartman , "Rafael J. Wysocki" , David Airlie , Simona Vetter , Daniel Almeida , Arnd Bergmann Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, linux-modules@vger.kernel.org, driver-core@lists.linux.dev, dri-devel@lists.freedesktop.org, nova-gpu@lists.linux.dev, Alvin Sun X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1779171975; l=715; i=alvin.sun@linux.dev; s=20260317; h=from:subject:message-id; bh=8USOvLfbex0ZVgy7EUn6ZRwamRf3sFF+arQNn23gw0Y=; b=zqldcEI8ohWRFr4EEnWSghpngHLbAEk1qK0dxWah7adUt1/qhUvOGbxqOWwslwUBJfq1ViYr4 Ltl2orxZ0wnDbBTHDTDRkA7cUUqEUeDZ15HlrrYpscZIzaFcy+sIqdO X-Developer-Key: i=alvin.sun@linux.dev; a=ed25519; pk=CHcwQp8GSoj25V/L1ZWNSQjWp9eSIb0s9LKr0Nm3WuE= X-Endpoint-Received: by B4 Relay for alvin.sun@linux.dev/20260317 with auth_id=684 Set `ThisModule =3D super::DriverModule` to provide the correct module pointer for file operations ownership. Signed-off-by: Alvin Sun --- drivers/gpu/drm/tyr/driver.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/tyr/driver.rs b/drivers/gpu/drm/tyr/driver.rs index 279710b36a104..9eb4561ab831d 100644 --- a/drivers/gpu/drm/tyr/driver.rs +++ b/drivers/gpu/drm/tyr/driver.rs @@ -176,6 +176,7 @@ impl drm::Driver for TyrDrmDriver { type Data =3D TyrDrmDeviceData; type File =3D TyrDrmFileData; type Object =3D drm::gem::Object; + type ThisModule =3D super::DriverModule; =20 const INFO: drm::DriverInfo =3D INFO; =20 --=20 2.43.0 From nobody Mon May 25 03:33:07 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CC9CF3909B7; Tue, 19 May 2026 06:26:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779171977; cv=none; b=a0H283EFgc4p5lVv7NWs4TkL2ynEF3gHV+mo+7u2cJTgjPl5wmtla/ZC89ZGEli7bRXv7q8VR+Jy4T1R57dlj9/JU0c+tB6AUh0bdNWP72T9gE8bGODYObtnawgQPrFMLqDQ0FMoEK9KaLZEkzKeEjDPGmeArwcYMwNmn0MvEIs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779171977; c=relaxed/simple; bh=OYexPkFtbNXLRo2lAEdq2hETmjni7pCbYaSDRmMBwas=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=l1ra3tpKIFGv1rKCrRQKtdvEJ9uEJQ90ZD7OmBnmSwb7VBX8yi/yspEXjin5PzhFoFrkNi40kNtFFngRRDlB8eOPwLH9YtxG+rgLK8LJOfesW19fdHkI9ExLhbGQTOCBsdbXMWAcKXj9B8mlq23CE6xKL8WC9HjW/LZQ5J1GHBE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=jYq1BxJE; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="jYq1BxJE" Received: by smtp.kernel.org (Postfix) with ESMTPS id 58486C32782; Tue, 19 May 2026 06:26:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux.dev; s=korg; t=1779171977; bh=OYexPkFtbNXLRo2lAEdq2hETmjni7pCbYaSDRmMBwas=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=jYq1BxJEdQvoKO+B5LkE3eiPcpa0MF5xhNY1fdxCle42kKHyxfk7R4sczzyTGNma2 r4joKWNmfvhvmSicZVj57PJe4ycBlSGeSiZGYm8DN7PZxe9bZlJwn9mElB733ut/Tl AYhjZS49JTvqhFkdRHEZ0tzUpVJQKk+dPEuxyGy0= Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4B5BDCD4F54; Tue, 19 May 2026 06:26:17 +0000 (UTC) From: Alvin Sun Date: Tue, 19 May 2026 14:26:18 +0800 Subject: [PATCH 6/8] rust: drm: set fops.owner from driver module pointer Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260519-fix-fops-owner-v1-6-2ded9830da14@linux.dev> References: <20260519-fix-fops-owner-v1-0-2ded9830da14@linux.dev> In-Reply-To: <20260519-fix-fops-owner-v1-0-2ded9830da14@linux.dev> To: Miguel Ojeda , Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , Danilo Krummrich , Luis Chamberlain , Petr Pavlu , Daniel Gomez , Sami Tolvanen , Aaron Tomlin , Greg Kroah-Hartman , "Rafael J. Wysocki" , David Airlie , Simona Vetter , Daniel Almeida , Arnd Bergmann Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, linux-modules@vger.kernel.org, driver-core@lists.linux.dev, dri-devel@lists.freedesktop.org, nova-gpu@lists.linux.dev, Alvin Sun X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1779171975; l=1749; i=alvin.sun@linux.dev; s=20260317; h=from:subject:message-id; bh=OYexPkFtbNXLRo2lAEdq2hETmjni7pCbYaSDRmMBwas=; b=ZyFmcBxw1iqk+SIxcFeBTJnMObx+OCnY/wJV2uLHPgpVqGkQc8wSk9AV2oIMUMbAUJCcFOIHy y/WAWqV40x1DC2MLK8BHskY3T8WYx1cAY5qNGMhhCRZZXMt4iSuiHzp X-Developer-Key: i=alvin.sun@linux.dev; a=ed25519; pk=CHcwQp8GSoj25V/L1ZWNSQjWp9eSIb0s9LKr0Nm3WuE= X-Endpoint-Received: by B4 Relay for alvin.sun@linux.dev/20260317 with auth_id=684 Change `create_fops()` to accept an owner module pointer instead of hardcoding `null_mut()`, ensuring the kernel correctly tracks the module owning the DRM device's file operations. Signed-off-by: Alvin Sun --- rust/kernel/drm/device.rs | 3 ++- rust/kernel/drm/gem/mod.rs | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/rust/kernel/drm/device.rs b/rust/kernel/drm/device.rs index 403fc35353c74..97bee53823346 100644 --- a/rust/kernel/drm/device.rs +++ b/rust/kernel/drm/device.rs @@ -111,7 +111,8 @@ impl Device { fops: &Self::GEM_FOPS, }; =20 - const GEM_FOPS: bindings::file_operations =3D drm::gem::create_fops(); + const GEM_FOPS: bindings::file_operations =3D + drm::gem::create_fops(::MO= DULE_PTR); =20 /// Create a new `drm::Device` for a `drm::Driver`. pub fn new(dev: &device::Device, data: impl PinInit) -= > Result> { diff --git a/rust/kernel/drm/gem/mod.rs b/rust/kernel/drm/gem/mod.rs index 01b5bd47a3332..9a203efc59116 100644 --- a/rust/kernel/drm/gem/mod.rs +++ b/rust/kernel/drm/gem/mod.rs @@ -357,10 +357,10 @@ impl AllocImpl for Object { }; } =20 -pub(super) const fn create_fops() -> bindings::file_operations { +pub(super) const fn create_fops(owner: *mut bindings::module) -> bindings:= :file_operations { let mut fops: bindings::file_operations =3D pin_init::zeroed(); =20 - fops.owner =3D core::ptr::null_mut(); + fops.owner =3D owner; fops.open =3D Some(bindings::drm_open); fops.release =3D Some(bindings::drm_release); fops.unlocked_ioctl =3D Some(bindings::drm_ioctl); --=20 2.43.0 From nobody Mon May 25 03:33:07 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DF7B93921D8; Tue, 19 May 2026 06:26:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779171978; cv=none; b=GtuzL753xdVPqyrKBYFaKzlbYmF3se2kZChlGUW6Jg49J3joS7/8VuCfjCLCCeZypE+Ftjj/O/Lkrr5gCS0L6xLkeS0uqi7rZoO7vK/JhgnoJ6m74h0SM4TWGYGIkSv+AnRYE0lPj5t3j2R92vWmhmuzur4Z7NFCDtrt9gCCknY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779171978; c=relaxed/simple; bh=w1EoH2KiN5QmfxawPU8PJaSlqVT8J3DiMsT2xzxxCS8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=EMAQz2qTCwrBvq0ggtAjCLLpuPsSPLQGZ+CQwCJSGbyvH1O2yDD1eAP7fedkp6euNLx8/CiuJu/Ahuogcleq/dCmKRTcwU3twoFq1vEh9+jfhmcW6NgUMto3wpA8+P0I2WTYpHiYxVU7uhXVZLZDN9ljbkdrV9KRcZHAa6z35x4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=pqFk2zvo; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="pqFk2zvo" Received: by smtp.kernel.org (Postfix) with ESMTPS id 66C95C4AF48; Tue, 19 May 2026 06:26:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux.dev; s=korg; t=1779171977; bh=w1EoH2KiN5QmfxawPU8PJaSlqVT8J3DiMsT2xzxxCS8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=pqFk2zvot/fGkAa2B95CruvT+F/m81RwHSe5EFDIyzYIQvyOEqVbEJlOVZidiGESB vzU6SsE1rDpeMtDRYXXBQYMDkHBWWc3PxtyOyf4C3nQLXUx4SOn996Ls4qBm5ECLmw z+p7x59zc2QfRifwq1u0QGQTVt1UcL9yY44xKpWQ= Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5C6ACCD4F5E; Tue, 19 May 2026 06:26:17 +0000 (UTC) From: Alvin Sun Date: Tue, 19 May 2026 14:26:19 +0800 Subject: [PATCH 7/8] rust: miscdevice: add `ThisModule` associated type to `MiscDevice` trait Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260519-fix-fops-owner-v1-7-2ded9830da14@linux.dev> References: <20260519-fix-fops-owner-v1-0-2ded9830da14@linux.dev> In-Reply-To: <20260519-fix-fops-owner-v1-0-2ded9830da14@linux.dev> To: Miguel Ojeda , Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , Danilo Krummrich , Luis Chamberlain , Petr Pavlu , Daniel Gomez , Sami Tolvanen , Aaron Tomlin , Greg Kroah-Hartman , "Rafael J. Wysocki" , David Airlie , Simona Vetter , Daniel Almeida , Arnd Bergmann Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, linux-modules@vger.kernel.org, driver-core@lists.linux.dev, dri-devel@lists.freedesktop.org, nova-gpu@lists.linux.dev, Alvin Sun X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1779171975; l=1248; i=alvin.sun@linux.dev; s=20260317; h=from:subject:message-id; bh=w1EoH2KiN5QmfxawPU8PJaSlqVT8J3DiMsT2xzxxCS8=; b=2boe+1XQRLD4hO3skU1aJJQcbDXlgDARy7PBUJ88luhYe/WLmSsDSDrEExQl2YbOWZ2Tl8h0e pmNkBMmnQSyAdamOhFMpfzrTeCuM7HWH36VOSdl/5OJbzmR7hEcHgBQ X-Developer-Key: i=alvin.sun@linux.dev; a=ed25519; pk=CHcwQp8GSoj25V/L1ZWNSQjWp9eSIb0s9LKr0Nm3WuE= X-Endpoint-Received: by B4 Relay for alvin.sun@linux.dev/20260317 with auth_id=684 Add a `ThisModule` associated type bound by `ModuleMetadata` to the `MiscDevice` trait, and use it to set the miscdevice fops owner field instead of defaulting to null. Signed-off-by: Alvin Sun --- rust/kernel/miscdevice.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rust/kernel/miscdevice.rs b/rust/kernel/miscdevice.rs index 05a6b6b9770f2..007caaae62697 100644 --- a/rust/kernel/miscdevice.rs +++ b/rust/kernel/miscdevice.rs @@ -38,6 +38,7 @@ ForeignOwnable, Opaque, // }, + ModuleMetadata, // }; use core::{ marker::PhantomData, @@ -137,6 +138,9 @@ pub trait MiscDevice: Sized { /// What kind of pointer should `Self` be wrapped in. type Ptr: ForeignOwnable + Send + Sync; =20 + /// The module implementing this driver. + type ThisModule: ModuleMetadata; + /// Called when the misc device is opened. /// /// The returned pointer will be stored as the private data for the fi= le. @@ -441,6 +445,7 @@ impl MiscdeviceVTable { } else { None }, + owner: ::MODULE_PTR, ..pin_init::zeroed() }; =20 --=20 2.43.0 From nobody Mon May 25 03:33:07 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F142F395D87; Tue, 19 May 2026 06:26:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779171978; cv=none; b=VtuMVM0qVNlyrpXl4cTLPjpOxmCZxOZMwMeCvEWJ3MxLwHijiyH8fG/oe5QE78PkVTGvE5ORPjZyPo7MMzridMiBAct7KQ5NgUUfqqOJzz22L9tCjHppl9GMBTAuFxoE2Ha7UcDtaVrjpHpdGWTjcahcHXYcblXyEgtEc8ZJ9m0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779171978; c=relaxed/simple; bh=I3viC+xei+z7Du+zKhaAbdeTTw0QaX58PY37KUiWlx0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=qxjrwTxlcr0YTh3hljzhp797VSTxkJsMBu3Mek1s3sxK8+MjU/zJeYZcM5WoasxxwpvEzsgB4OZNtGUQIVPSluo7gMVTnGMWJ4l6s8qisWFT1ZtXJD8DNbN422ocXtCdFvPA0TOUU33YZDwNpAoR+v/OdCtilhz5pQM3xjsIuto= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=0DWDv0YS; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="0DWDv0YS" Received: by smtp.kernel.org (Postfix) with ESMTPS id 79D26C4AF09; Tue, 19 May 2026 06:26:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux.dev; s=korg; t=1779171977; bh=I3viC+xei+z7Du+zKhaAbdeTTw0QaX58PY37KUiWlx0=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=0DWDv0YStWDiNp2eRzgkI7+ej1qmXthujxBH+MsQWflTKP/xdZvf2orjR5g3iiH35 956R+3pI+1lLcuEUKFb7dw8KyPWsTc9rYB7VYILW63MTxBe0h0gmu7lOGkC8GA2naT DvVTWmtKDvAx7VHzGd757z7H165p58/kzANNl3QM= Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6CB1DCD4F5B; Tue, 19 May 2026 06:26:17 +0000 (UTC) From: Alvin Sun Date: Tue, 19 May 2026 14:26:20 +0800 Subject: [PATCH 8/8] samples: rust: rust_misc_device: implement `ThisModule` for `RustMiscDevice` Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260519-fix-fops-owner-v1-8-2ded9830da14@linux.dev> References: <20260519-fix-fops-owner-v1-0-2ded9830da14@linux.dev> In-Reply-To: <20260519-fix-fops-owner-v1-0-2ded9830da14@linux.dev> To: Miguel Ojeda , Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , Danilo Krummrich , Luis Chamberlain , Petr Pavlu , Daniel Gomez , Sami Tolvanen , Aaron Tomlin , Greg Kroah-Hartman , "Rafael J. Wysocki" , David Airlie , Simona Vetter , Daniel Almeida , Arnd Bergmann Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, linux-modules@vger.kernel.org, driver-core@lists.linux.dev, dri-devel@lists.freedesktop.org, nova-gpu@lists.linux.dev, Alvin Sun X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1779171975; l=782; i=alvin.sun@linux.dev; s=20260317; h=from:subject:message-id; bh=I3viC+xei+z7Du+zKhaAbdeTTw0QaX58PY37KUiWlx0=; b=rU+vsujc7ps9LVjZzU2EMVWbRxlsY4wFfumiMPvocW2zu/qAFSe1VduxhoLk7OyuG0fnmJIIt Eprmd69bn3tAxqv+SqqTQzC3dXJdIYh/YoZDUxIWVdu64Gch28eCwMA X-Developer-Key: i=alvin.sun@linux.dev; a=ed25519; pk=CHcwQp8GSoj25V/L1ZWNSQjWp9eSIb0s9LKr0Nm3WuE= X-Endpoint-Received: by B4 Relay for alvin.sun@linux.dev/20260317 with auth_id=684 Set `ThisModule =3D RustMiscDeviceModule` to provide the correct module pointer for file operations ownership. Signed-off-by: Alvin Sun --- samples/rust/rust_misc_device.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/samples/rust/rust_misc_device.rs b/samples/rust/rust_misc_devi= ce.rs index 41e26c825060b..a4b012a35b5ec 100644 --- a/samples/rust/rust_misc_device.rs +++ b/samples/rust/rust_misc_device.rs @@ -176,6 +176,7 @@ struct RustMiscDevice { #[vtable] impl MiscDevice for RustMiscDevice { type Ptr =3D Pin>; + type ThisModule =3D RustMiscDeviceModule; =20 fn open(_file: &File, misc: &MiscDeviceRegistration) -> Result>> { let dev =3D ARef::from(misc.device()); --=20 2.43.0