Remove unused code in PCI

This commit is contained in:
Ruihan Li 2026-01-14 16:55:16 +08:00 committed by Tate, Hongliang Tian
parent 08d54ec6ad
commit b11fcdcf0b
4 changed files with 4 additions and 38 deletions

View File

@ -2,8 +2,6 @@
//! PCI bus
#![expect(unused_variables)]
use alloc::{collections::VecDeque, sync::Arc, vec::Vec};
use core::fmt::Debug;
@ -50,7 +48,7 @@ impl PciBus {
pub fn register_driver(&mut self, driver: Arc<dyn PciDriver>) {
debug!("Register driver:{:#x?}", driver);
let length = self.common_devices.len();
for i in (0..length).rev() {
for _ in (0..length).rev() {
let common_device = self.common_devices.pop_front().unwrap();
let device_id = *common_device.device_id();
let device = match driver.probe(common_device) {

View File

@ -2,8 +2,6 @@
//! PCI device capabilities.
#![expect(dead_code)]
use alloc::vec::Vec;
use align_ext::AlignExt;
@ -18,13 +16,6 @@ pub mod vendor;
/// PCI Capability
#[derive(Debug)]
pub struct Capability {
id: u8,
/// Pointer to the capability.
pos: u16,
/// Next Capability pointer, 0xFC if self is the last one.
next_ptr: u16,
/// The length of this Capability
len: u16,
cap_data: CapabilityData,
}
@ -136,13 +127,7 @@ impl Capability {
0x14 => CapabilityData::Ea,
_ => CapabilityData::Unknown(cap_type),
};
capabilities.push(Self {
id: cap_type,
pos: cap_ptr,
next_ptr,
len: next_ptr - cap_ptr,
cap_data: data,
});
capabilities.push(Self { cap_data: data });
}
capabilities

View File

@ -2,9 +2,6 @@
//! MSI-X capability support.
#![expect(dead_code)]
#![expect(unused_variables)]
use alloc::{sync::Arc, vec::Vec};
use ostd::{irq::IrqLine, mm::VmIoOnce};
@ -58,7 +55,7 @@ impl CapabilityMsixData {
let table_bar;
let pba_bar;
let bar_manager = dev.bar_manager_mut();
let bar_manager = dev.bar_manager();
match bar_manager
.bar((pba_info & 0b111) as u8)
.clone()
@ -116,7 +113,7 @@ impl CapabilityMsixData {
dev.set_command(dev.command() | Command::INTERRUPT_DISABLE | Command::BUS_MASTER);
let mut irqs = Vec::with_capacity(table_size as usize);
for i in 0..table_size {
for _ in 0..table_size {
irqs.push(None);
}
@ -185,7 +182,3 @@ impl CapabilityMsixData {
msg_ctrl & 0x8000 != 0
}
}
fn set_bit(origin_value: u16, offset: usize, set: bool) -> u16 {
(origin_value & (!(1 << offset))) | ((set as u16) << offset)
}

View File

@ -2,8 +2,6 @@
//! PCI device common definitions or functions.
#![expect(dead_code)]
use alloc::vec::Vec;
use super::{
@ -111,14 +109,6 @@ impl PciCommonDevice {
Some(device)
}
pub(super) fn bar_manager_mut(&mut self) -> &mut BarManager {
&mut self.bar_manager
}
pub(super) fn capabilities_mut(&mut self) -> &mut Vec<Capability> {
&mut self.capabilities
}
}
/// The header type field of a PCI device struct in the PCI configuration space.