cd9d161
From c09233797d29cc18bc7d304ceeb8bef72f3acefb Mon Sep 17 00:00:00 2001
cd9d161
From: Jan Kiszka <jan.kiszka@siemens.com>
cd9d161
Date: Sun, 24 Jul 2011 19:38:36 +0200
cd9d161
Subject: [PATCH] qdev: Reset hot-plugged devices
cd9d161
MIME-Version: 1.0
cd9d161
Content-Type: text/plain; charset=UTF-8
cd9d161
Content-Transfer-Encoding: 8bit
cd9d161
cd9d161
Device models rely on the core invoking their reset handlers after init.
cd9d161
We do this in the cold-plug case, but so far we miss this step after
cd9d161
hot-plug.
cd9d161
cd9d161
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
cd9d161
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
cd9d161
(cherry picked from commit 5ab28c8340f683121c081a181adfd9f72ab85cba)
cd9d161
cd9d161
[AF: Fixes BNC#722958 / LTC#75394.]
cd9d161
Signed-off-by: Andreas Färber <afaerber@suse.de>
cd9d161
---
cd9d161
 hw/qdev.c | 3 +++
cd9d161
 1 file changed, 3 insertions(+)
cd9d161
cd9d161
diff --git a/hw/qdev.c b/hw/qdev.c
cd9d161
index a0fcd06..b4ea8e1 100644
cd9d161
--- a/hw/qdev.c
cd9d161
+++ b/hw/qdev.c
cd9d161
@@ -289,6 +289,9 @@ int qdev_init(DeviceState *dev)
cd9d161
                                        dev->alias_required_for_version);
cd9d161
     }
cd9d161
     dev->state = DEV_STATE_INITIALIZED;
cd9d161
+    if (dev->hotplugged && dev->info->reset) {
cd9d161
+        dev->info->reset(dev);
cd9d161
+    }
cd9d161
     return 0;
cd9d161
 }
cd9d161
 
cd9d161
-- 
cd9d161
1.7.11.2
cd9d161