From 2c9be2e9b80131eeebdb19830441b38bbeeefe6d Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Sat, 30 Aug 2025 20:12:20 +0200 Subject: [PATCH] xhcid: Remove unused InterruptSources methods and fields --- xhcid/src/main.rs | 7 ++----- xhcid/src/xhci/mod.rs | 38 +++++--------------------------------- 2 files changed, 7 insertions(+), 38 deletions(-) diff --git a/xhcid/src/main.rs b/xhcid/src/main.rs index 74b83a3ff0..7cd01894d7 100644 --- a/xhcid/src/main.rs +++ b/xhcid/src/main.rs @@ -26,7 +26,7 @@ extern crate bitflags; use std::fs::File; -use std::sync::{Arc, Mutex}; +use std::sync::Arc; use pcid_interface::irq_helpers::read_bsp_apic_id; #[cfg(target_arch = "x86_64")] @@ -78,10 +78,7 @@ fn get_int_method(pcid_handle: &mut PciFunctionHandle) -> (Option, Interru table_entry_pointer.write_addr_and_data(msg_addr_and_data); table_entry_pointer.unmask(); - ( - Some(interrupt_handle), - InterruptMethod::MsiX(Mutex::new(info)), - ) + (Some(interrupt_handle), InterruptMethod::Msi) }; pcid_handle.enable_feature(PciFeature::MsiX); diff --git a/xhcid/src/xhci/mod.rs b/xhcid/src/xhci/mod.rs index bbbfb9ffbd..24e611cc34 100644 --- a/xhcid/src/xhci/mod.rs +++ b/xhcid/src/xhci/mod.rs @@ -13,10 +13,9 @@ use std::collections::BTreeMap; use std::convert::TryFrom; use std::fs::File; use std::sync::atomic::AtomicUsize; -use std::sync::{Arc, Mutex, MutexGuard}; +use std::sync::{Arc, Mutex}; use std::{mem, process, slice, thread}; -use pcid_interface::msi::MappedMsixRegs; use syscall::error::{Error, Result, EBADF, EBADMSG, EIO, ENOENT}; use syscall::{EAGAIN, PAGE_SIZE}; @@ -70,11 +69,8 @@ pub enum InterruptMethod { /// Legacy PCI INTx# interrupt pin. Intx, - /// Message signaled interrupts. + /// (Extended) Message signaled interrupts. Msi, - - /// Extended message signaled interrupts. - MsiX(Mutex), } impl Xhci { @@ -1142,32 +1138,8 @@ impl Xhci { Ok(ring) } - pub fn uses_msi(&self) -> bool { - if let InterruptMethod::Msi = self.interrupt_method { - true - } else { - false - } - } - pub fn uses_msix(&self) -> bool { - if let InterruptMethod::MsiX(_) = self.interrupt_method { - true - } else { - false - } - } - // TODO: Perhaps use an rwlock? - pub fn msix_info(&self) -> Option> { - match self.interrupt_method { - InterruptMethod::MsiX(ref info) => Some(info.lock().unwrap()), - _ => None, - } - } - pub fn msix_info_mut(&self) -> Option> { - match self.interrupt_method { - InterruptMethod::MsiX(ref info) => Some(info.lock().unwrap()), - _ => None, - } + fn uses_msi_interrupts(&self) -> bool { + matches!(self.interrupt_method, InterruptMethod::Msi) } /// Checks whether an IRQ has been received from *this* device, in case of an interrupt. Always @@ -1175,7 +1147,7 @@ impl Xhci { pub fn received_irq(&self) -> bool { let mut runtime_regs = self.run.lock().unwrap(); - if self.uses_msi() || self.uses_msix() { + if self.uses_msi_interrupts() { // Since using MSI and MSI-X implies having no IRQ sharing whatsoever, the IP bit // doesn't have to be touched. trace!(