mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-31 09:20:13 -04:00
rust: drm: gem: shmem: Fix Default implementation for ObjectConfig
I completely forgot when coming up with this type that #[derive(Default)] only works if all generics mentioned in the type implement Default (and T usually doesn't). This being said: We don't use `T` for anything besides using it for a reference type, so whether or not it implements `Default` shouldn't actually need to matter. So, fix this by just manually implementing Default instead of deriving it. Signed-off-by: Lyude Paul <lyude@redhat.com> Link: https://patch.msgid.link/20260603195210.693856-2-lyude@redhat.com Signed-off-by: Alice Ryhl <aliceryhl@google.com>
This commit is contained in:
@@ -42,7 +42,6 @@
|
||||
///
|
||||
/// This is used with [`Object::new()`] to control various properties that can only be set when
|
||||
/// initially creating a shmem-backed GEM object.
|
||||
#[derive(Default)]
|
||||
pub struct ObjectConfig<'a, T: DriverObject, C: DeviceContext = Registered> {
|
||||
/// Whether to set the write-combine map flag.
|
||||
pub map_wc: bool,
|
||||
@@ -53,6 +52,16 @@ pub struct ObjectConfig<'a, T: DriverObject, C: DeviceContext = Registered> {
|
||||
pub parent_resv_obj: Option<&'a Object<T, C>>,
|
||||
}
|
||||
|
||||
impl<'a, T: DriverObject, C: DeviceContext> Default for ObjectConfig<'a, T, C> {
|
||||
#[inline(always)]
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
map_wc: false,
|
||||
parent_resv_obj: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A shmem-backed GEM object.
|
||||
///
|
||||
/// # Invariants
|
||||
|
||||
Reference in New Issue
Block a user