Skip to content

Commit 747fb82

Browse files
committed
drm/asahi: Classless mutex etc
Signed-off-by: Asahi Lina <[email protected]>
1 parent 35b371c commit 747fb82

4 files changed

Lines changed: 6 additions & 19 deletions

File tree

drivers/gpu/drm/asahi/alloc.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
//! debugging with a GPU memory snapshot, since it makes it easier to identify use-after-free and
1313
//! caching issues.
1414
15-
use kernel::{c_str, drm::mm, error::Result, prelude::*, str::CString, sync::LockClassKey};
15+
use kernel::{drm::mm, error::Result, prelude::*, str::CString};
1616

1717
use crate::debug::*;
1818
use crate::driver::{AsahiDevRef, AsahiDevice};
@@ -692,8 +692,6 @@ pub(crate) struct HeapAllocator {
692692
name: CString,
693693
}
694694

695-
static LOCK_KEY: LockClassKey = kernel::static_lock_class!();
696-
697695
impl HeapAllocator {
698696
/// Create a new HeapAllocator for a given `Vm` and address range.
699697
#[allow(dead_code)]
@@ -730,13 +728,7 @@ impl HeapAllocator {
730728
total_garbage: 0,
731729
};
732730

733-
let mm = mm::Allocator::new(
734-
start,
735-
end - start + 1,
736-
inner,
737-
c_str!("HeapAllocator"),
738-
LOCK_KEY,
739-
)?;
731+
let mm = mm::Allocator::new(start, end - start + 1, inner)?;
740732

741733
Ok(HeapAllocator {
742734
dev: dev.into(),

drivers/gpu/drm/asahi/mmu.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -794,13 +794,7 @@ impl Vm {
794794
IOVA_USER_TOP
795795
};
796796

797-
let mm = mm::Allocator::new(
798-
min_va as u64,
799-
(max_va - min_va + 1) as u64,
800-
(),
801-
c_str!("asahi Vm"),
802-
static_lock_class!(),
803-
)?;
797+
let mm = mm::Allocator::new(min_va as u64, (max_va - min_va + 1) as u64, ())?;
804798

805799
Ok(Vm {
806800
id,

drivers/gpu/drm/asahi/slotalloc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ impl<T: SlotItem> SlotAllocator<T> {
156156

157157
let alloc = Arc::pin_init(pin_init!(SlotAllocatorOuter {
158158
// SAFETY: `mutex_init!` is called below.
159-
inner <- Mutex::new(inner, name, lock_key1),
159+
inner <- Mutex::new_with_key(inner, name, lock_key1),
160160
// SAFETY: `condvar_init!` is called below.
161161
cond <- CondVar::new(name, lock_key2),
162162
}))?;

rust/kernel/sync/lock.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ impl<T, B: Backend> Lock<T, B> {
110110
}
111111

112112
/// Constructs a new lock initialiser taking an initialiser/
113+
#[track_caller]
113114
pub fn pin_init<E>(t: impl PinInit<T, E>) -> impl PinInit<Self, E>
114115
where
115116
E: core::convert::From<core::convert::Infallible>,
@@ -119,14 +120,14 @@ impl<T, B: Backend> Lock<T, B> {
119120
}
120121

121122
/// Constructs a new lock initialiser.
122-
#[allow(clippy::new_ret_no_self)]
123123
#[track_caller]
124124
pub fn new_named(t: T, name: &'static CStr) -> impl PinInit<Self> {
125125
let (key, _) = caller_lock_class();
126126
Self::new_with_key(t, name, key)
127127
}
128128

129129
/// Constructs a new lock initialiser taking an initialiser/
130+
#[track_caller]
130131
pub fn pin_init_named<E>(t: impl PinInit<T, E>, name: &'static CStr) -> impl PinInit<Self, E>
131132
where
132133
E: core::convert::From<core::convert::Infallible>,

0 commit comments

Comments
 (0)