qdev: Reset hot-plugged devices
authorJan Kiszka <jan.kiszka@siemens.com>
Sun, 24 Jul 2011 17:38:36 +0000 (19:38 +0200)
committerAnthony Liguori <aliguori@us.ibm.com>
Fri, 29 Jul 2011 13:17:40 +0000 (08:17 -0500)
Device models rely on the core invoking their reset handlers after init.
We do this in the cold-plug case, but so far we miss this step after
hot-plug.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
hw/qdev.c

index a0fcd0609424ec468e843219cdac2c87e82aed06..b4ea8e13d16f253be9e9b15c054056a7691ec6cb 100644 (file)
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -289,6 +289,9 @@ int qdev_init(DeviceState *dev)
                                        dev->alias_required_for_version);
     }
     dev->state = DEV_STATE_INITIALIZED;
+    if (dev->hotplugged && dev->info->reset) {
+        dev->info->reset(dev);
+    }
     return 0;
 }