From 28463272f643baa30f6a4e9718f2218c94cc150c Mon Sep 17 00:00:00 2001 From: Admin Pupkin Date: Tue, 9 Jun 2026 09:29:45 +0300 Subject: [PATCH] redox-driver-sys: expose TOML quirk loaders to acpid runtime Promote the four runtime TOML loader families from pub(crate) to pub so consumers (acpid) can call them directly at startup: * read_toml_cpu_bug_entries / parse_cpu_bug_toml / load_cpu_bug_flags * read_toml_clocksource_entries / parse_clocksource_toml / load_clocksource_flags * read_toml_chipset_entries / parse_chipset_toml / load_chipset_flags * read_toml_usb_audio_entries / parse_usb_audio_toml / load_usb_audio_flags These read /etc/quirks.d/*.toml at startup and OR-accumulate the flags. Exposing them makes the quirks system data-driven for any caller, not just compiled-in drivers. The semantics are unchanged; only the visibility bumps from pub(crate)/fn to pub. 2026 Red Bear OS. --- .../source/src/quirks/toml_loader.rs | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/local/recipes/drivers/redox-driver-sys/source/src/quirks/toml_loader.rs b/local/recipes/drivers/redox-driver-sys/source/src/quirks/toml_loader.rs index a632bdcb96..6922ccb305 100644 --- a/local/recipes/drivers/redox-driver-sys/source/src/quirks/toml_loader.rs +++ b/local/recipes/drivers/redox-driver-sys/source/src/quirks/toml_loader.rs @@ -433,7 +433,7 @@ pub const CPU_BUG_FLAG_NAMES: &[(&str, CpuBugFlags)] = &[ ("X86_BUG_ITS", CpuBugFlags::X86_BUG_ITS), ]; -pub(crate) fn read_toml_cpu_bug_entries() -> std::io::Result> { +pub fn read_toml_cpu_bug_entries() -> std::io::Result> { let mut entries = Vec::new(); for path in sorted_toml_files(QUIRKS_DIR)? { let path_str = path.display().to_string(); @@ -456,7 +456,7 @@ pub(crate) fn read_toml_cpu_bug_entries() -> std::io::Result, path: &str, @@ -502,7 +502,7 @@ fn parse_cpu_bug_toml( /// Look up the CPU bug flags for a given CPUID across all /// runtime TOML entries. Returns the OR-accumulated flags. -pub(crate) fn load_cpu_bug_flags( +pub fn load_cpu_bug_flags( cpuid: &CpuId, vendor_id: u16, ) -> CpuBugFlags { @@ -524,7 +524,7 @@ pub const CLOCKSOURCE_FLAG_NAMES: &[(&str, ClocksourceQuirkFlags)] = &[ ("hpet_broken", ClocksourceQuirkFlags::HPET_BROKEN), ]; -pub(crate) fn read_toml_clocksource_entries() +pub fn read_toml_clocksource_entries() -> std::io::Result> { let mut entries = Vec::new(); for path in sorted_toml_files(QUIRKS_DIR)? { @@ -548,7 +548,7 @@ pub(crate) fn read_toml_clocksource_entries() Ok(entries) } -fn parse_clocksource_toml( +pub fn parse_clocksource_toml( doc: &toml::Value, out: &mut Vec, path: &str, @@ -603,7 +603,7 @@ fn parse_clocksource_toml( /// Look up the clocksource flags for the given PCI device /// (vendor, device, revision) across all runtime TOML entries. /// Returns the OR-accumulated flags. -pub(crate) fn load_clocksource_flags( +pub fn load_clocksource_flags( vendor: u16, device: u16, revision: u8, @@ -632,7 +632,7 @@ pub const CHIPSET_FLAG_NAMES: &[(&str, ChipsetQuirkFlags)] = &[ ("apple_airport_reset", ChipsetQuirkFlags::APPLE_AIRPORT_RESET), ]; -pub(crate) fn read_toml_chipset_entries() -> std::io::Result> { +pub fn read_toml_chipset_entries() -> std::io::Result> { let mut entries = Vec::new(); for path in sorted_toml_files(QUIRKS_DIR)? { let path_str = path.display().to_string(); @@ -655,7 +655,7 @@ pub(crate) fn read_toml_chipset_entries() -> std::io::Result, path: &str, @@ -710,7 +710,7 @@ fn parse_chipset_toml( /// Look up the chipset flags for the given (vendor, device, /// class) tuple across all runtime TOML entries. Returns /// the OR-accumulated flags. -pub(crate) fn load_chipset_flags(vendor: u16, device: u16, class: u16) -> ChipsetQuirkFlags { +pub fn load_chipset_flags(vendor: u16, device: u16, class: u16) -> ChipsetQuirkFlags { let mut flags = ChipsetQuirkFlags::empty(); if let Ok(entries) = read_toml_chipset_entries() { for entry in entries { @@ -754,7 +754,7 @@ pub const USB_AUDIO_FLAG_NAMES: &[(&str, UsbAudioQuirkFlags)] = &[ ("mixer_capture_linear_vol", UsbAudioQuirkFlags::MIXER_CAPTURE_LINEAR_VOL), ]; -pub(crate) fn read_toml_usb_audio_entries() -> std::io::Result> { +pub fn read_toml_usb_audio_entries() -> std::io::Result> { let mut entries = Vec::new(); for path in sorted_toml_files(QUIRKS_DIR)? { let path_str = path.display().to_string(); @@ -777,7 +777,7 @@ pub(crate) fn read_toml_usb_audio_entries() -> std::io::Result, path: &str, @@ -811,7 +811,7 @@ fn parse_usb_audio_toml( /// Look up the USB audio flags for the given (vendor, product) /// tuple across all runtime TOML entries. -pub(crate) fn load_usb_audio_flags(vendor: u16, product: u16) -> UsbAudioQuirkFlags { +pub fn load_usb_audio_flags(vendor: u16, product: u16) -> UsbAudioQuirkFlags { let mut flags = UsbAudioQuirkFlags::empty(); if let Ok(entries) = read_toml_usb_audio_entries() { for entry in entries {