[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 4/4] qdev-hotplug: Don't check type of qdev_get_mach
From: |
Eduardo Habkost |
Subject: |
[Qemu-devel] [PATCH 4/4] qdev-hotplug: Don't check type of qdev_get_machine() |
Date: |
Thu, 25 Apr 2019 17:00:51 -0300 |
Now that qdev_get_machine_hotplug_handler() is only compiled in
softmmu mode, we don't need to check if qdev_gt_machine() is
really of type TYPE_MACHINE.
Signed-off-by: Eduardo Habkost <address@hidden>
---
hw/core/qdev-hotplug.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/hw/core/qdev-hotplug.c b/hw/core/qdev-hotplug.c
index 8ab31043a7..017500c1e1 100644
--- a/hw/core/qdev-hotplug.c
+++ b/hw/core/qdev-hotplug.c
@@ -35,16 +35,11 @@ void qbus_set_bus_hotplug_handler(BusState *bus, Error
**errp)
HotplugHandler *qdev_get_machine_hotplug_handler(DeviceState *dev)
{
- MachineState *machine;
- MachineClass *mc;
- Object *m_obj = qdev_get_machine();
+ MachineState *machine = MACHINE(qdev_get_machine());
+ MachineClass *mc = MACHINE_GET_CLASS(machine);
- if (object_dynamic_cast(m_obj, TYPE_MACHINE)) {
- machine = MACHINE(m_obj);
- mc = MACHINE_GET_CLASS(machine);
- if (mc->get_hotplug_handler) {
- return mc->get_hotplug_handler(machine, dev);
- }
+ if (mc->get_hotplug_handler) {
+ return mc->get_hotplug_handler(machine, dev);
}
return NULL;
--
2.18.0.rc1.1.g3f1ff2140
- [Qemu-devel] [PATCH 0/4] Remove some qdev_get_machine() calls from CONFIG_USER_ONLY, Eduardo Habkost, 2019/04/25
- [Qemu-devel] [PATCH 3/4] qdev: Don't compile hotplug code in user-mode emulation, Eduardo Habkost, 2019/04/25
- [Qemu-devel] [PATCH 4/4] qdev-hotplug: Don't check type of qdev_get_machine(),
Eduardo Habkost <=
- [Qemu-devel] [PATCH 1/4] machine: Move gpio code to hw/core/gpio.c, Eduardo Habkost, 2019/04/25
- [Qemu-devel] [PATCH 2/4] move qdev hotplug code to qdev-hotplug.c, Eduardo Habkost, 2019/04/25
- Re: [Qemu-devel] [PATCH 0/4] Remove some qdev_get_machine() calls from CONFIG_USER_ONLY, no-reply, 2019/04/25
- Re: [Qemu-devel] [PATCH 0/4] Remove some qdev_get_machine() calls from CONFIG_USER_ONLY, Like Xu, 2019/04/26