common: Initialize PeripheralMutex state with closure to ensure it's done in-place.

This commit is contained in:
Dario Nieuwenhuis
2021-08-02 20:13:41 +02:00
parent e238079d7d
commit 3f28bb6c77
4 changed files with 28 additions and 29 deletions

View File

@ -67,12 +67,11 @@ where
class_set: S,
irq: I,
) -> Self {
let initial_state = StateInner {
let mutex = PeripheralMutex::new_unchecked(irq, &mut state.0, || StateInner {
device,
classes: class_set.into_class_set(),
_interrupt: PhantomData,
};
let mutex = PeripheralMutex::new_unchecked(&mut state.0, initial_state, irq);
});
Self {
inner: RefCell::new(mutex),
}