mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-27 22:13:55 -04:00
rust: miscdevice: set fops.owner from driver module pointer
Set the miscdevice fops owner field from the driver module pointer via the `this_module::<T::OwnerModule>()` helper, instead of defaulting to null. Assisted-by: opencode:glm-5.2 Reviewed-by: Andreas Hindborg <a.hindborg@kernel.org> Reviewed-by: Gary Guo <gary@garyguo.net> Acked-by: Danilo Krummrich <dakr@kernel.org> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by: Alice Ryhl <aliceryhl@google.com> Signed-off-by: Alvin Sun <alvin.sun@linux.dev> Link: https://patch.msgid.link/20260811-fix-fops-owner-v10-6-7e71776f9dbe@linux.dev Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
This commit is contained in:
@@ -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<T: MiscDevice> MiscdeviceVTable<T> {
|
||||
} else {
|
||||
None
|
||||
},
|
||||
owner: this_module::<T::OwnerModule>().as_ptr(),
|
||||
..pin_init::zeroed()
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user