]> git.ipfire.org Git - thirdparty/qemu.git/commit
qdev: Fix QOM unrealize behavior
authorAndreas Färber <afaerber@suse.de>
Mon, 15 Apr 2013 16:34:10 +0000 (18:34 +0200)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Mon, 13 May 2013 16:48:56 +0000 (11:48 -0500)
commit4d7f4556fc6ceafcf6ccd9ebce441e22c90f5756
treeb588c31bef09260413052e6bf472f953472d17d1
parent0486c27a36f0f6448f1f91ee8de3d9fdc49bde23
qdev: Fix QOM unrealize behavior

Since commit 249d41720b7dfbb5951b430b9eefdbee7464f515 (qdev: Prepare
"realized" property) setting realized = true would register the device's
VMStateDescription, but realized = false would not unregister it. Fix that.

Moving the code from unparenting also revealed that we were calling
DeviceClass::init through DeviceClass::realize as interim solution but
DeviceClass::exit still at unparenting time with a realized check.
Make this symmetrical by implementing DeviceClass::unrealize to call it,
while we're setting realized = false in the unparenting path.
The only other unrealize user is mac_nvram, which can safely override it.

Thus, mark DeviceClass::exit as obsolete, new devices should implement
DeviceClass::unrealize instead.

Cc: qemu-stable@nongnu.org
Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Message-id: 1366043650-9719-1-git-send-email-afaerber@suse.de
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit fe6c211781f80ef4fc246269cecbbc21981089f0)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
hw/qdev-core.h
hw/qdev.c