aboutsummaryrefslogtreecommitdiff
path: root/hw/acpi/pcihp.c
diff options
context:
space:
mode:
authorAni Sinha <ani@anisinha.ca>2021-12-29 13:27:53 +0530
committerMichael S. Tsirkin <mst@redhat.com>2022-01-07 19:30:13 -0500
commit784802689f84b716de1fbdd2cef30e303b73b3e8 (patch)
tree7c0e20c5c667189a51ef7448c09873330d2a93bc /hw/acpi/pcihp.c
parentc8adb4d222c42951a9d0367e5f5d4e1f5e2c9ad7 (diff)
downloadqemu-784802689f84b716de1fbdd2cef30e303b73b3e8.zip
qemu-784802689f84b716de1fbdd2cef30e303b73b3e8.tar.gz
qemu-784802689f84b716de1fbdd2cef30e303b73b3e8.tar.bz2
acpihp: simplify acpi_pcihp_disable_root_bus
Get rid of the static variable that keeps track of whether hotplug has been disabled on the root pci bus. Simply use qbus_is_hotpluggable() api to perform the same check. This eliminates additional if conditional and simplifies the function. Signed-off-by: Ani Sinha <ani@anisinha.ca> Message-Id: <1640764674-7784-1-git-send-email-ani@anirban.org> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/acpi/pcihp.c')
-rw-r--r--hw/acpi/pcihp.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/hw/acpi/pcihp.c b/hw/acpi/pcihp.c
index a5e182d..6befd23 100644
--- a/hw/acpi/pcihp.c
+++ b/hw/acpi/pcihp.c
@@ -128,20 +128,15 @@ static void acpi_set_pci_info(void)
static void acpi_pcihp_disable_root_bus(void)
{
- static bool root_hp_disabled;
Object *host = acpi_get_i386_pci_host();
PCIBus *bus;
- if (root_hp_disabled) {
- return;
- }
-
bus = PCI_HOST_BRIDGE(host)->bus;
- if (bus) {
+ if (bus && qbus_is_hotpluggable(BUS(bus))) {
/* setting the hotplug handler to NULL makes the bus non-hotpluggable */
qbus_set_hotplug_handler(BUS(bus), NULL);
}
- root_hp_disabled = true;
+
return;
}