qemuHostdevPreparePCIDevices, virHostdevPreparePCIDevices are identical. Replacing qemu method with the generic one to reduce code duplication. This generic method will be used in ch driver to passthrough PCI devices. Signed-off-by: Praveen K Paladugu <prapal@xxxxxxxxxxxxxxxxxxx> --- src/qemu/qemu_hostdev.c | 17 ++--------------- src/qemu/qemu_hostdev.h | 6 ------ src/qemu/qemu_hotplug.c | 5 +++-- 3 files changed, 5 insertions(+), 23 deletions(-) diff --git a/src/qemu/qemu_hostdev.c b/src/qemu/qemu_hostdev.c index ab2769d482..894f12e04f 100644 --- a/src/qemu/qemu_hostdev.c +++ b/src/qemu/qemu_hostdev.c @@ -152,20 +152,6 @@ qemuHostdevPrepareNVMeDisks(virQEMUDriver *driver, name, disks, ndisks); } -int -qemuHostdevPreparePCIDevices(virQEMUDriver *driver, - const char *name, - const unsigned char *uuid, - virDomainHostdevDef **hostdevs, - int nhostdevs, - unsigned int flags) -{ - return virHostdevPreparePCIDevices(driver->hostdevMgr, - QEMU_DRIVER_NAME, - name, uuid, hostdevs, - nhostdevs, flags); -} - int qemuHostdevPrepareUSBDevices(virQEMUDriver *driver, const char *name, @@ -244,7 +230,8 @@ qemuHostdevPrepareDomainDevices(virQEMUDriver *driver, if (qemuHostdevPrepareNVMeDisks(driver, def->name, def->disks, def->ndisks) < 0) return -1; - if (qemuHostdevPreparePCIDevices(driver, def->name, def->uuid, + if (virHostdevPreparePCIDevices(driver->hostdevMgr, QEMU_DRIVER_NAME, + def->name, def->uuid, def->hostdevs, def->nhostdevs, flags) < 0) return -1; diff --git a/src/qemu/qemu_hostdev.h b/src/qemu/qemu_hostdev.h index b6dd2e0207..6f6c4f82bc 100644 --- a/src/qemu/qemu_hostdev.h +++ b/src/qemu/qemu_hostdev.h @@ -43,12 +43,6 @@ int qemuHostdevPrepareNVMeDisks(virQEMUDriver *driver, const char *name, virDomainDiskDef **disks, size_t ndisks); -int qemuHostdevPreparePCIDevices(virQEMUDriver *driver, - const char *name, - const unsigned char *uuid, - virDomainHostdevDef **hostdevs, - int nhostdevs, - unsigned int flags); int qemuHostdevPrepareUSBDevices(virQEMUDriver *driver, const char *name, virDomainHostdevDef **hostdevs, diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 4d4bcde1bc..d1c042c6a0 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -1544,8 +1544,9 @@ qemuDomainAttachHostPCIDevice(virQEMUDriver *driver, if (!cfg->relaxedACS) flags |= VIR_HOSTDEV_STRICT_ACS_CHECK; - if (qemuHostdevPreparePCIDevices(driver, vm->def->name, - vm->def->uuid, &hostdev, 1, flags) < 0) + if (virHostdevPreparePCIDevices(driver->hostdevMgr, QEMU_DRIVER_NAME, + vm->def->name, vm->def->uuid, + &hostdev, 1, flags) < 0) return -1; if (qemuDomainAdjustMaxMemLockHostdev(vm, hostdev) < 0) -- 2.44.0