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
2424 IovIterSource, //
2525 },
2626 mm::virt::VmaNew,
27+ module::this_module,
2728 prelude::*,
2829 seq_file::SeqFile,
2930 types::{
3031 ForeignOwnable,
3132 Opaque, //
32− },
33+ }, //
3334 };
3435 use core::marker::PhantomData;
3536
@@ -430,6 +431,7 @@ impl<T: MiscDevice> MiscdeviceVTable<T> { · 394 unmodified lines
430431 } else {
431432 None
432433 },
434+ owner: this_module::<T::OwnerModule>().as_ptr(),
433435 ..pin_init::zeroed()
434436 };
435437