From mboxrd@z Thu Jan 1 00:00:00 1970 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 59B7B345EA7; Thu, 23 Jul 2026 02:11:23 +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=1784772683; cv=none; b=KR8YA1bPuXpBe5AxiRyZek9EPA6glC5u7rLKJa2CkvwE4b22YXLHRp18I+jCD0UQjYx0HZRmwTGnUwD7jPWW6Ns8ZCrn3ctRcJ9Vcho/6HcN+ZNSU9yVpMls0Umv3UOelWRG2/K755XT6OYS5k2J4QCHfdEZn+LqYAbF3GFYq6g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784772683; c=relaxed/simple; bh=F2CI+FBdyNzgpm/+lalqrgOCl4op0DIet6QiBNuXJNI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=E1HfSTXqEH2V0HHVubRqOBdYgcNg1p0x5V2Q1h6gKmJDsi+zIpf8EwKKgxmqacMYe+Ef//EH/LL2iPgc9s/1ZZypv1PwctzQZ+lSnHLGyFb8QpaZg1gqCDfhuuhuFmrSzE9trgJRn3rRp4/6Hv0PS7e32l0sEYK7oev/6bap5e8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=qhUcu1OD; 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="qhUcu1OD" Received: by smtp.kernel.org (Postfix) with ESMTPS id C0582C4DDE8; Thu, 23 Jul 2026 02:11:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux.dev; s=korg; t=1784772682; bh=F2CI+FBdyNzgpm/+lalqrgOCl4op0DIet6QiBNuXJNI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=qhUcu1ODNgrlW2FGiwWAntJqTBAeyzWa/VchunRLoi5nbaHQfGDGVfc5z4WZpL7mg MY8ZMB4xPI68EnviLVHBtuqLU4wDF7K4zCYWSx1Bc4eujg3FPGDnUFhhWXyjAIApGI dgWy95WaPD0aQfvnmKxiKGHtNDxx/0MNxjaTW8Fo= 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 A91E9C44536; Thu, 23 Jul 2026 02:11:22 +0000 (UTC) From: Alvin Sun Date: Thu, 23 Jul 2026 10:10:29 +0800 Subject: [PATCH v9 06/10] rust: miscdevice: set fops.owner from driver module pointer Precedence: bulk X-Mailing-List: nova-gpu@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260723-fix-fops-owner-v9-6-c1c3af7f7bcb@linux.dev> References: <20260723-fix-fops-owner-v9-0-c1c3af7f7bcb@linux.dev> In-Reply-To: <20260723-fix-fops-owner-v9-0-c1c3af7f7bcb@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 , Brendan Higgins , David Gow , Rae Moar , Breno Leitao , Jens Axboe , Dave Ertman , Leon Romanovsky , Igor Korotin , FUJITA Tomonori , Bjorn Helgaas , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , =?utf-8?q?Arve_Hj=C3=B8nnev=C3=A5g?= , Todd Kjos , Christian Brauner , Carlos Llamas Cc: rust-for-linux@vger.kernel.org, linux-modules@vger.kernel.org, driver-core@lists.linux.dev, dri-devel@lists.freedesktop.org, nova-gpu@lists.linux.dev, linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-pci@vger.kernel.org, Alvin Sun X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1784772679; l=1259; i=alvin.sun@linux.dev; s=20260317; h=from:subject:message-id; bh=F2CI+FBdyNzgpm/+lalqrgOCl4op0DIet6QiBNuXJNI=; b=b1YiLB/69Su44v2ps7laeoetpRGghonjYzajdU0tUf089j7rW4bO8E1v6QG6ciuRN8OhQ0vn/ BSLz4daJXirBqvGF2coxaGuxm7sPbiDxeIYLc3vzgdLWZsq7KnM6Lmu 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 the miscdevice fops owner field from the driver module pointer via the `this_module::()` helper, instead of defaulting to null. Assisted-by: opencode:glm-5.2 Reviewed-by: Andreas Hindborg Reviewed-by: Gary Guo Acked-by: Danilo Krummrich Acked-by: Greg Kroah-Hartman Reviewed-by: Alice Ryhl Signed-off-by: Alvin Sun --- rust/kernel/miscdevice.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rust/kernel/miscdevice.rs b/rust/kernel/miscdevice.rs index 83ce50def5ac9..2a4329f98614e 100644 --- a/rust/kernel/miscdevice.rs +++ b/rust/kernel/miscdevice.rs @@ -24,12 +24,13 @@ IovIterSource, // }, mm::virt::VmaNew, + module::this_module, prelude::*, seq_file::SeqFile, types::{ ForeignOwnable, Opaque, // - }, + }, // }; use core::marker::PhantomData; @@ -430,6 +431,7 @@ impl MiscdeviceVTable { } else { None }, + owner: this_module::().as_ptr(), ..pin_init::zeroed() }; -- 2.43.0