mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 08:13:54 -06:00
qdev:pci: refactor PCIDevice to use generic "hotpluggable" property
Get rid of PCIDevice specific PCIDeviceClass.no_hotplug and use generic DeviceClass.hotpluggable field instead. Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
5fdae20cef
commit
2897ae0267
16 changed files with 21 additions and 30 deletions
11
hw/pci/pci.c
11
hw/pci/pci.c
|
@ -1761,11 +1761,7 @@ static int pci_qdev_init(DeviceState *qdev)
|
|||
pci_dev->devfn);
|
||||
if (pci_dev == NULL)
|
||||
return -1;
|
||||
if (qdev->hotplugged && pc->no_hotplug) {
|
||||
qerror_report(QERR_DEVICE_NO_HOTPLUG, object_get_typename(OBJECT(pci_dev)));
|
||||
do_pci_unregister_device(pci_dev);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (pc->init) {
|
||||
rc = pc->init(pci_dev);
|
||||
if (rc != 0) {
|
||||
|
@ -1800,12 +1796,7 @@ static int pci_qdev_init(DeviceState *qdev)
|
|||
static int pci_unplug_device(DeviceState *qdev)
|
||||
{
|
||||
PCIDevice *dev = PCI_DEVICE(qdev);
|
||||
PCIDeviceClass *pc = PCI_DEVICE_GET_CLASS(dev);
|
||||
|
||||
if (pc->no_hotplug) {
|
||||
qerror_report(QERR_DEVICE_NO_HOTPLUG, object_get_typename(OBJECT(dev)));
|
||||
return -1;
|
||||
}
|
||||
return dev->bus->hotplug(dev->bus->hotplug_qdev, dev,
|
||||
PCI_HOTPLUG_DISABLED);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue