Fix potential atomic mode breaks

This commit is contained in:
Ruihan Li 2025-11-25 17:08:55 +08:00 committed by Tate, Hongliang Tian
parent d99791ba57
commit 0fd2066ac3
2 changed files with 4 additions and 5 deletions

View File

@ -44,7 +44,7 @@ pub mod input_handler;
use alloc::{sync::Arc, vec::Vec};
use component::{init_component, ComponentInitError};
use ostd::sync::SpinLock;
use ostd::sync::Mutex;
use spin::Once;
use self::input_core::InputCore;
@ -117,13 +117,13 @@ fn component_init() -> Result<(), ComponentInitError> {
#[derive(Debug)]
struct Component {
input_core: SpinLock<InputCore>,
input_core: Mutex<InputCore>,
}
impl Component {
pub fn init() -> Result<Self, ComponentInitError> {
Ok(Self {
input_core: SpinLock::new(InputCore::new()),
input_core: Mutex::new(InputCore::new()),
})
}
}

View File

@ -40,8 +40,7 @@ const EVDEV_MAJOR_ID: u16 = 13;
static EVDEV_MINOR_COUNTER: AtomicU32 = AtomicU32::new(0);
/// Global registry of evdev devices.
static EVDEV_DEVICES: SpinLock<BTreeMap<MinorId, Arc<EvdevDevice>>> =
SpinLock::new(BTreeMap::new());
static EVDEV_DEVICES: Mutex<BTreeMap<MinorId, Arc<EvdevDevice>>> = Mutex::new(BTreeMap::new());
pub struct EvdevDevice {
/// Input device associated with this evdev.