From 2897ae026758eac78284ba6c3bd7732f3a1d9987 Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Wed, 5 Feb 2014 16:36:48 +0100 Subject: 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 Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/acpi/pcihp.c | 3 ++- hw/acpi/piix4.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'hw/acpi') diff --git a/hw/acpi/pcihp.c b/hw/acpi/pcihp.c index 1ce6fc2768..3bd5a06a98 100644 --- a/hw/acpi/pcihp.c +++ b/hw/acpi/pcihp.c @@ -105,12 +105,13 @@ static PCIBus *acpi_pcihp_find_hotplug_bus(AcpiPciHpState *s, int bsel) static bool acpi_pcihp_pc_no_hotplug(AcpiPciHpState *s, PCIDevice *dev) { PCIDeviceClass *pc = PCI_DEVICE_GET_CLASS(dev); + DeviceClass *dc = DEVICE_GET_CLASS(dev); /* * ACPI doesn't allow hotplug of bridge devices. Don't allow * hot-unplug of bridge devices unless they were added by hotplug * (and so, not described by acpi). */ - return (pc->is_bridge && !dev->qdev.hotplugged) || pc->no_hotplug; + return (pc->is_bridge && !dev->qdev.hotplugged) || !dc->hotpluggable; } static void acpi_pcihp_eject_slot(AcpiPciHpState *s, unsigned bsel, unsigned slots) diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c index 0f45e11cad..077776a6c9 100644 --- a/hw/acpi/piix4.c +++ b/hw/acpi/piix4.c @@ -536,7 +536,6 @@ static void piix4_pm_class_init(ObjectClass *klass, void *data) DeviceClass *dc = DEVICE_CLASS(klass); PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); - k->no_hotplug = 1; k->init = piix4_pm_initfn; k->config_write = pm_write_config; k->vendor_id = PCI_VENDOR_ID_INTEL; @@ -551,6 +550,7 @@ static void piix4_pm_class_init(ObjectClass *klass, void *data) * e.g. by mips_malta_init() */ dc->cannot_instantiate_with_device_add_yet = true; + dc->hotpluggable = false; } static const TypeInfo piix4_pm_info = { -- cgit v1.2.1