dcavalca / rpms / qemu

Forked from rpms/qemu a year ago
Clone

Blame 0201-qdev-Reset-hot-plugged-devices.patch

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