summaryrefslogtreecommitdiffstats
path: root/hw/core/bus.c
diff options
context:
space:
mode:
authorMichael Roth2019-02-12 19:24:59 +0100
committerDavid Gibson2019-02-17 11:54:02 +0100
commit94d1cc5f03a8f7e45925928d0c9a5ee9782e6c85 (patch)
tree59c66ae00bd12efa21bd116ff00c8d38258dd95d /hw/core/bus.c
parentxive: Only set source type for LSIs (diff)
downloadqemu-94d1cc5f03a8f7e45925928d0c9a5ee9782e6c85.tar.gz
qemu-94d1cc5f03a8f7e45925928d0c9a5ee9782e6c85.tar.xz
qemu-94d1cc5f03a8f7e45925928d0c9a5ee9782e6c85.zip
qdev: pass an Object * to qbus_set_hotplug_handler()
Certain devices types, like memory/CPU, are now being handled using a hotplug interface provided by a top-level MachineClass. Hotpluggable host bridges are another such device where it makes sense to use a machine-level hotplug handler. However, unlike those devices, host-bridges have a parent bus (the main system bus), and devices with a parent bus use a different mechanism for registering their hotplug handlers: qbus_set_hotplug_handler(). This interface currently expects a handler to be a subclass of DeviceClass, but this is not the case for MachineClass, which derives directly from ObjectClass. Internally, the interface only requires an ObjectClass, so expose that in qbus_set_hotplug_handler(). Cc: Michael S. Tsirkin <mst@redhat.com> Cc: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Greg Kurz <groug@kaod.org> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Reviewed-by: Cornelia Huck <cohuck@redhat.com> Acked-by: Halil Pasic <pasic@linux.ibm.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Message-Id: <154999589921.690774.3640149277362188566.stgit@bahia.lan> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'hw/core/bus.c')
-rw-r--r--hw/core/bus.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/hw/core/bus.c b/hw/core/bus.c
index 4651f24486..e09843f6ab 100644
--- a/hw/core/bus.c
+++ b/hw/core/bus.c
@@ -22,22 +22,15 @@
#include "hw/qdev.h"
#include "qapi/error.h"
-static void qbus_set_hotplug_handler_internal(BusState *bus, Object *handler,
- Error **errp)
+void qbus_set_hotplug_handler(BusState *bus, Object *handler, Error **errp)
{
-
object_property_set_link(OBJECT(bus), OBJECT(handler),
QDEV_HOTPLUG_HANDLER_PROPERTY, errp);
}
-void qbus_set_hotplug_handler(BusState *bus, DeviceState *handler, Error **errp)
-{
- qbus_set_hotplug_handler_internal(bus, OBJECT(handler), errp);
-}
-
void qbus_set_bus_hotplug_handler(BusState *bus, Error **errp)
{
- qbus_set_hotplug_handler_internal(bus, OBJECT(bus), errp);
+ qbus_set_hotplug_handler(bus, OBJECT(bus), errp);
}
int qbus_walk_children(BusState *bus,