diff mbox

[3/5] qdev: Move qdev_unplug() to qdev-monitor.c

Message ID 20170406131326.2418-4-quintela@redhat.com
State New
Headers show

Commit Message

Juan Quintela April 6, 2017, 1:13 p.m. UTC
It is not used by linux-user, otherwise I need to to create one stub
for migration_is_idle() on following patch.

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 hw/core/qdev.c | 34 ----------------------------------
 qdev-monitor.c | 34 ++++++++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+), 34 deletions(-)

Comments

Eric Blake April 6, 2017, 2:07 p.m. UTC | #1
On 04/06/2017 08:13 AM, Juan Quintela wrote:
> It is not used by linux-user, otherwise I need to to create one stub
> for migration_is_idle() on following patch.
> 
> Signed-off-by: Juan Quintela <quintela@redhat.com>
> ---
>  hw/core/qdev.c | 34 ----------------------------------
>  qdev-monitor.c | 34 ++++++++++++++++++++++++++++++++++
>  2 files changed, 34 insertions(+), 34 deletions(-)

Reviewed-by: Eric Blake <eblake@redhat.com>
Markus Armbruster April 11, 2017, 11:29 a.m. UTC | #2
Juan Quintela <quintela@redhat.com> writes:

> It is not used by linux-user, otherwise I need to to create one stub
> for migration_is_idle() on following patch.
>
> Signed-off-by: Juan Quintela <quintela@redhat.com>
> ---
>  hw/core/qdev.c | 34 ----------------------------------
>  qdev-monitor.c | 34 ++++++++++++++++++++++++++++++++++
>  2 files changed, 34 insertions(+), 34 deletions(-)

Makes sense because its buddy qdev_device_add() is already in
qdev-monitor.c.

Reviewed-by: Markus Armbruster <armbru@redhat.com>
diff mbox

Patch

diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index c26cf84..0df0050 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -271,40 +271,6 @@  HotplugHandler *qdev_get_hotplug_handler(DeviceState *dev)
     return hotplug_ctrl;
 }
 
-void qdev_unplug(DeviceState *dev, Error **errp)
-{
-    DeviceClass *dc = DEVICE_GET_CLASS(dev);
-    HotplugHandler *hotplug_ctrl;
-    HotplugHandlerClass *hdc;
-
-    if (dev->parent_bus && !qbus_is_hotpluggable(dev->parent_bus)) {
-        error_setg(errp, QERR_BUS_NO_HOTPLUG, dev->parent_bus->name);
-        return;
-    }
-
-    if (!dc->hotpluggable) {
-        error_setg(errp, QERR_DEVICE_NO_HOTPLUG,
-                   object_get_typename(OBJECT(dev)));
-        return;
-    }
-
-    qdev_hot_removed = true;
-
-    hotplug_ctrl = qdev_get_hotplug_handler(dev);
-    /* hotpluggable device MUST have HotplugHandler, if it doesn't
-     * then something is very wrong with it */
-    g_assert(hotplug_ctrl);
-
-    /* If device supports async unplug just request it to be done,
-     * otherwise just remove it synchronously */
-    hdc = HOTPLUG_HANDLER_GET_CLASS(hotplug_ctrl);
-    if (hdc->unplug_request) {
-        hotplug_handler_unplug_request(hotplug_ctrl, dev, errp);
-    } else {
-        hotplug_handler_unplug(hotplug_ctrl, dev, errp);
-    }
-}
-
 static int qdev_reset_one(DeviceState *dev, void *opaque)
 {
     device_reset(dev);
diff --git a/qdev-monitor.c b/qdev-monitor.c
index 5f2fcdf..bb3d8ba 100644
--- a/qdev-monitor.c
+++ b/qdev-monitor.c
@@ -836,6 +836,40 @@  static DeviceState *find_device_state(const char *id, Error **errp)
     return DEVICE(obj);
 }
 
+void qdev_unplug(DeviceState *dev, Error **errp)
+{
+    DeviceClass *dc = DEVICE_GET_CLASS(dev);
+    HotplugHandler *hotplug_ctrl;
+    HotplugHandlerClass *hdc;
+
+    if (dev->parent_bus && !qbus_is_hotpluggable(dev->parent_bus)) {
+        error_setg(errp, QERR_BUS_NO_HOTPLUG, dev->parent_bus->name);
+        return;
+    }
+
+    if (!dc->hotpluggable) {
+        error_setg(errp, QERR_DEVICE_NO_HOTPLUG,
+                   object_get_typename(OBJECT(dev)));
+        return;
+    }
+
+    qdev_hot_removed = true;
+
+    hotplug_ctrl = qdev_get_hotplug_handler(dev);
+    /* hotpluggable device MUST have HotplugHandler, if it doesn't
+     * then something is very wrong with it */
+    g_assert(hotplug_ctrl);
+
+    /* If device supports async unplug just request it to be done,
+     * otherwise just remove it synchronously */
+    hdc = HOTPLUG_HANDLER_GET_CLASS(hotplug_ctrl);
+    if (hdc->unplug_request) {
+        hotplug_handler_unplug_request(hotplug_ctrl, dev, errp);
+    } else {
+        hotplug_handler_unplug(hotplug_ctrl, dev, errp);
+    }
+}
+
 void qmp_device_del(const char *id, Error **errp)
 {
     DeviceState *dev = find_device_state(id, errp);