vmd: extract removing devices to separate function

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: Idc9c7d0e5d0ebce8278e089bcfe5b7f76b86c270
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13953
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Tom Nabarro <tom.nabarro@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Konrad Sztyber 2022-07-04 14:15:36 +02:00 committed by Tomasz Zawadzki
parent ffa9953a14
commit 690eebb447

View File

@ -1369,6 +1369,17 @@ vmd_bus_handle_hotplug(struct vmd_pci_bus *bus)
}
}
static void
vmd_remove_device(struct vmd_pci_device *device)
{
device->pci.internal.pending_removal = true;
/* If the device isn't attached, remove it immediately */
if (!device->pci.internal.attached) {
vmd_dev_detach(&device->pci);
}
}
static void
vmd_bus_handle_hotremove(struct vmd_pci_bus *bus)
{
@ -1376,12 +1387,7 @@ vmd_bus_handle_hotremove(struct vmd_pci_bus *bus)
TAILQ_FOREACH_SAFE(device, &bus->dev_list, tailq, tmpdev) {
if (!vmd_bus_device_present(bus, device->devfn)) {
device->pci.internal.pending_removal = true;
/* If the device isn't attached, remove it immediately */
if (!device->pci.internal.attached) {
vmd_dev_detach(&device->pci);
}
vmd_remove_device(device);
}
}
}