History

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.

Alvin Sun committed 3 months ago

Commit f9a2e4f1 parent 3ef97581 file · +3 −1Browse files

Showing the changes to rust/kernel (1 of 1 file). Show all

Unified · Split

rust/kernel/miscdevice.rs+3−1
@@ -24,12 +24,13 @@ use crate::{ · 23 unmodified lines
24 IovIterSource, //24 IovIterSource, //
25 },25 },
26 mm::virt::VmaNew,26 mm::virt::VmaNew,
27 module::this_module,
27 prelude::*,28 prelude::*,
28 seq_file::SeqFile,29 seq_file::SeqFile,
29 types::{30 types::{
30 ForeignOwnable,31 ForeignOwnable,
31 Opaque, //32 Opaque, //
32 },33 }, //
33};34};
34use core::marker::PhantomData;35use core::marker::PhantomData;
35 36
@@ -430,6 +431,7 @@ impl<T: MiscDevice> MiscdeviceVTable<T> { · 394 unmodified lines
430 } else {431 } else {
431 None432 None
432 },433 },
434 owner: this_module::<T::OwnerModule>().as_ptr(),
433 ..pin_init::zeroed()435 ..pin_init::zeroed()
434 };436 };
435 437