diff options
| author | Lyude Paul <lyude@redhat.com> | 2026-06-03 15:42:30 -0400 |
|---|---|---|
| committer | Alice Ryhl <aliceryhl@google.com> | 2026-06-04 10:40:44 +0000 |
| commit | fea3a2dd7d3fc1936211ced5f84420e610435730 (patch) | |
| tree | 68442516060bf595377f1ffc7cb12981e5ca97ba | |
| parent | 99676aed1fec109d62822e21a06760eb098dc5f4 (diff) | |
| download | linux-next-fea3a2dd7d3fc1936211ced5f84420e610435730.tar.gz linux-next-fea3a2dd7d3fc1936211ced5f84420e610435730.zip | |
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>
| -rw-r--r-- | rust/kernel/drm/gem/shmem.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/rust/kernel/drm/gem/shmem.rs b/rust/kernel/drm/gem/shmem.rs index 34af402899a0..084b798ce795 100644 --- a/rust/kernel/drm/gem/shmem.rs +++ b/rust/kernel/drm/gem/shmem.rs @@ -42,7 +42,6 @@ use gem::{ /// /// 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 |
