[stable-0.15,02/36] qdev: Reset hot-plugged devices

Submitted by Andreas Färber on March 28, 2012, 12:52 p.m.

Details

Message ID 1332939159-16434-3-git-send-email-afaerber@suse.de
State New
Headers show

Commit Message

Andreas Färber March 28, 2012, 12:52 p.m.
From: Jan Kiszka <jan.kiszka@siemens.com>

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>
(cherry picked from commit 5ab28c8340f683121c081a181adfd9f72ab85cba)

[AF: Fixes BNC#722958 / LTC#75394.]
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 hw/qdev.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

Patch hide | download patch | download mbox

diff --git a/hw/qdev.c b/hw/qdev.c
index a0fcd06..b4ea8e1 100644
--- 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;
 }