pci: Add a function to remove a PciDevice from the bus
Simple function relying on the retain() method from std::Vec, allowing to remove every occurence of the same device. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
parent
08604ac6a8
commit
f8e2008e0e
1 changed files with 5 additions and 0 deletions
|
|
@ -124,6 +124,11 @@ impl PciBus {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub fn remove_by_device(&mut self, device: &Arc<Mutex<dyn PciDevice>>) -> Result<()> {
|
||||
self.devices.retain(|dev| !Arc::ptr_eq(dev, device));
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn next_device_id(&self) -> u32 {
|
||||
self.devices.len() as u32
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue