]> git.proxmox.com Git - mirror_qemu.git/commitdiff
qdev: Add wrapper to set BUS as HotplugHandler
authorIgor Mammedov <imammedo@redhat.com>
Fri, 26 Sep 2014 09:28:22 +0000 (09:28 +0000)
committerAndreas Färber <afaerber@suse.de>
Wed, 15 Oct 2014 03:03:13 +0000 (05:03 +0200)
To be used for conversion of SCSI and USB devices,
and would allow to make every HBA/USB host switch
to HotplugHandler API without touching each controller
explicitly.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
hw/core/qdev.c
include/hw/qdev-core.h

index 9f18520219e76de6ac34ec46867ff4b6ae280882..b1da409eebcec0ab315fe8bcdc0abe90711c2eae 100644 (file)
@@ -112,6 +112,25 @@ void qdev_set_parent_bus(DeviceState *dev, BusState *bus)
     bus_add_child(bus, dev);
 }
 
+static void qbus_set_hotplug_handler_internal(BusState *bus, Object *handler,
+                                              Error **errp)
+{
+
+    object_property_set_link(OBJECT(bus), OBJECT(handler),
+                             QDEV_HOTPLUG_HANDLER_PROPERTY, errp);
+    bus->allow_hotplug = 1;
+}
+
+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);
+}
+
 /* Create a new device.  This only initializes the device state structure
    and allows properties to be set.  qdev_init should be called to
    initialize the actual device emulation.  */
index ba812c5f9e2dd9fa3a933bca43595ff26be972b5..48e9579a8808e4cecbdb6758895da8ebaf51b3e7 100644 (file)
@@ -363,13 +363,10 @@ extern int qdev_hotplug;
 
 char *qdev_get_dev_path(DeviceState *dev);
 
-static inline void qbus_set_hotplug_handler(BusState *bus, DeviceState *handler,
-                                            Error **errp)
-{
-    object_property_set_link(OBJECT(bus), OBJECT(handler),
-                             QDEV_HOTPLUG_HANDLER_PROPERTY, errp);
-    bus->allow_hotplug = 1;
-}
+void qbus_set_hotplug_handler(BusState *bus, DeviceState *handler,
+                              Error **errp);
+
+void qbus_set_bus_hotplug_handler(BusState *bus, Error **errp);
 
 static inline bool qbus_is_hotpluggable(BusState *bus)
 {